WordPress.org

Ready to get started?Download WordPress

Forums

SEO Internal Link Shortcode
Is there a way to include anchors in a link? (3 posts)

  1. kaplunkiigirl
    Member
    Posted 5 months ago #

    I want to link to a specific section on another internal page, using an anchor. Is there a way to do this with this plugin?

    Thanks,

    Nikki

    https://wordpress.org/plugins/seo-internal-link-shortcode/

  2. chimericdream
    Member
    Posted 4 months ago #

    I second this. I need to jump to a specific fragment on the page, but it doesn't appear to be supported yet. Perhaps just adding a new attribute such as this would work:

    [link id="1234" fragment="jumphere"/]

    Edit: forgot to add the expected output:

    <a href="http://domain.com/post-slug/#jumphere">Post Title</a>
  3. chimericdream
    Member
    Posted 4 months ago #

    This should do the trick. I just tested it on a local site.

    if ( !empty($href) )
        {
            if ( !empty($atts['fragment']) )
            {
                $href .= '#' . $atts['fragment'];
            }
            $output = '<a href="'.$href.'"';

Reply

You must log in to post.

About this Plugin

About this Topic

Tags