Support » Fixing WordPress » URL to a specific position of another page.

  • Resolved michalrama

    (@michalrama)


    Hello,

    I need to create a link that redirects me to another page of the site, but in addition to a specific position. – e.g. http s://example.cz/people/

    I found the id generated for div and added it to the URL (e.g. http s://example.cz/people/#contact, but it doesn’t work. The page will load as if you were using a classic link.

    Please help.

    Thank you

    PS. A space is added there only so that it does not consider it a real link.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I found the id generated for div and added it to the URL (e.g. https://example.cz/people/#contact, but it doesn’t work. The page will load as if you were using a classic link.

    If it loads but jumps to the specified ID, then it’s working… that’s how HTML works.

    As you’ve linked to the absolute URL https://example.cz/people/#contact, provided the ID is correct and unique, clicking on this link will actually reload the page again, but it will jump to the specified ID.

    If you don’t want the page to reload at all, you have to use just #contact and not the full URL. The downside is that this will ONLY work on the page where the ID is found. On any other page without the ID, it will do nothing.

    If the page doesn’t jump to the ID after it loads, you’ll need to share your real URL so I can take a look and see what’s going on.

    Good luck!

    If it loads but jumps to the specified ID, then it’s working… that’s how HTML works.

    Yes, that’s exactly what I want, but it doesn’t work.

    If you don’t want the page to reload at all, you have to use just #contact and not the full URL.

    This is exactly the method I use on another one-page website, and it works.

    If the page doesn’t jump to the ID after it loads, you’ll need to share your real URL so I can take a look and see what’s going on.

    https://ms-jarni.cz/pro-rodice/ – There is a link under “Provozní řád Mateřské školky Jarní” that redirects you to another page, where I found the generated id for a specific div and added it to the link, but the page will only load classically without jumping to the div.

    So I visited the page https://ms-jarni.cz/pro-rodice/

    I clicked on ” Provozní řád Mateřské školky Jarní”, which leads to:

    https://ms-jarni.cz/mesicni-dochazka/#pb_line_4C10BC8EF8559759A502CEB84AC224E4

    Now I viewed the HTML source of the destination page https://ms-jarni.cz/mesicni-dochazka/, but the ID you’re using as the anchor pb_line_4C10BC8EF8559759A502CEB84AC224E4 doesn’t appear anywhere in the HTML at all. This is why the anchor link is not working.

    … where I found the generated id for a specific div and added it to the link…

    I see several of these pb_line_XXXXXXX IDs, but not the specific one you linked to. These IDs seem to be dynamically generated by your page builder plugin, and I have no idea if they’re permanent or change over time.

    These IDs seem to be dynamically generated by your page builder plugin, and I have no idea if they’re permanent or change over time.

    You’re right. The id is generated and that’s the problem. Anyway, on that one-page site, I added an id to each element. However, I’m using a different theme here (Fable) and I haven’t figured out how to add the id here. Could this be solved using a plugin or code editing, please?

    Thank you

    I think we can conclude this with the fact that the ID is always generated new and therefore it cannot be used. Of course, it is possible to get the used ID and use JS to jump to the required DIV, but that would be on discussion separately.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.