Support » Fixing WordPress » How to create a direct links to a blog post sub headings?

  • Resolved Bluemad

    (@bluemad)


    Hello!

    I saw that some of the WordPress bloggers use direct links to a specific post sub heading. Once user click on that link, it automatically open that blog post and scroll down to the focused sub heading. How do I do it?

    Most of these links are just like this http://mydomain.com/mypost.html#

    If i put my subheading after the #, nothing happen, only open the blog post. 🙁

Viewing 4 replies - 1 through 4 (of 4 total)
  • I saw this type of thing use Disqus, for instance. http://mydomain.com/mypost.html#comment-787684982

    Yes, that should be possible, but you have to have and use a valid id for the sub-heading being linked to. For example, in the link above, the comment being linked to would have this id in the HTML for that comment – something like:

    <div id="comment-787684982" .... >Comment here</div>

    So that will only work if your subheadings have id’s or you assign them in the HTML of your content.

    Friend, is this method correct?

    For instance I have a sub heading, it’s How to use Google

    Then I added this type of thing to post text area.

    <div id=”How to use Google”>How to use Google</div>

    Is it OK?

    Yes, it working. Thank you friend. 😀

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to create a direct links to a blog post sub headings?’ is closed to new replies.