I have a CPT/Pods, so it makes Post to Country, but it's the almost identical.

Content to Post (or Country) is easy, example: /country/page/5 (Content) to /country/taiwan/ (Post).

while ( $query->have_posts() ) :
  ?><a name="title<?php echo get_the_ID()?>"></a>
  <?php echo '<a href="'.esc_url( get_permalink() ).'">'.get_the_title()."</a>";

On Post (Country), I also wanted to go to the previous before. So how I go back /country/taiwan to /country/page/5#title58? I can not go to /country/page/5#title58, nor /country/page/5, only manual /country/.

<a href="/country/page/">Country</a>

Can you show me the -> Content, that is the function linking to /country/page/5#title58?

  • It sounds like you're looking to build these links contextually which means allowing the user to go back to the previous page they were on (like the browser's back button). Is that correct? – MikeNGarrett Apr 22 '19 at 14:04
  • I can go to the /country/page/5 -> /country/taiwan, but can not go to /country/taiwan -> /country/page/5 – Dani Apr 22 '19 at 14:25
  • How do you know they came from page 5? Could they have reached the Taiwan page from other places? What if they used a search engine to land on that page directly? – MikeNGarrett Apr 22 '19 at 14:32
  • If they have search engine, submit "taiwan", still wanted to go to /country/page/5#title58 if they choose. If they have another place, say /country/netherlands, wanted to go to ex. /country/page/3#title34 if they choose (link). – Dani Apr 22 '19 at 14:59
  • It sounds like you're going to have to build something custom for each country. This is too custom for WordPress to be able to provide these links. – MikeNGarrett Apr 22 '19 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.