I want to link a Page with an anchor tag and send some data through a URL from another Page. I have made a page template and I tried to link to it, but it does not work. I can open the page by creating menu link but I can't open it directly using the link. My anchoring code is:

<p><?php echo $post_excerpt;?> <a href="<?php echo add_query_arg( array('id' => $id), home_url()."/fullpost/" ); ?>" style="color: #4e2011;">Read More...</a></p>

Now the problem is when I click on Read More the URL works fine, id is added to the URL, but I still end up on the same page, not my desired page. I have Googled several times about this problem but haven't found a solution.

  • what does it mean "I don't get my desired page" Sep 17 '16 at 15:18
  • What fullpost.php is meant to do?
    – Rarst
    Sep 17 '16 at 17:55
  • No, that part will /fullpost/ only. Not fullpost.php. I have edited it. Thanks. @Rarst
    – Kallol Das
    Sep 18 '16 at 4:21

Actually the problem was with my page settings. If someone wants to link a php file to another php file by anchor tag (a href="....") and wants to send some data through URL, he/she must has to make the targeted php file a page template. Like this

Template Name: Gallery

Then he/she has to create a new page from the dashboard with this page template. Only after this process the link will work properly.

I didn't create the page from dashboard.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.