• I’m using a shortcode that creates tabbed content. When I try to place a destination anchor in one tab, clicking on the anchored link in a different tab doesn’t take me to the tab where the destination anchor is located.

    Anyone know if anchors are possible within shortcodes? Or if not, if there might be some type of workaround?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter zenkamal

    (@zenkamal)

    Bump. Anyone have some insight?

    Yes it is possible to use shortcuts to create anchors. Here’s a simple example

    function my_anchor( $atts ) {
    	return '<div id="myanchor"></div>';
    }
    add_shortcode( 'anchor', 'my_anchor' );
    
    function my_toanchor( $atts ) {
    	return '<a href="#myanchor">To the Anchor</a>';
    }
    add_shortcode( 'toanchor', 'my_toanchor' );

    The id on the div is the anchor, the hashtag goes toit.

    /peter

    Thread Starter zenkamal

    (@zenkamal)

    Hi Peter– I’d like to use anchors within shortCODES not use shortCUTS to create anchors 🙂

    Anchors aren’t working within shortcodes, so any content I place in one tab of a tab-creating shortcode cannot be anchored to another tab.

    What I showed was how to create a short code that uses anchors. Are you creating the short code or just using one that someone else programmed?
    /peter

    Thread Starter zenkamal

    (@zenkamal)

    I’m using a shortcode that someone else programmed. It is #4 on this page, “Tabbed Content”…
    http://www.elegantthemes.com/preview/TheProfessional/shortcodes/#tabs

    When I try to use anchors in between tabs, it doesn’t work.

    Zenkamal,

    Did you ever figure this out?
    I’m using the same theme and would like to use anchors in short codes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can you anchor within shortcodes?’ is closed to new replies.