WordPress.org

Forums

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

  1. kaplunkiigirl
    Member
    Posted 1 year 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 1 year 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 1 year 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.'"';

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • SEO Internal Link Shortcode
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags