I want to simply create a link to a page that I know the title (or ID), but I want to make sure it works on any Wordpress install. What is the best way to do this?


You probably want to use get_permalink and get_the_title. Example:

<a href="<?php echo get_permalink( YOUR POST ID ); ?>"><?php echo get_the_title( YOUR POST ID ); ?></a>

Replace YOUR POST ID with the ID of the post you'd like to link to. Post ID's will change from install to install, however, so this might not work as expected.

http://codex.wordpress.org/Function_Reference/get_the_title http://codex.wordpress.org/Function_Reference/get_permalink

| improve this answer | |

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.