[wp-hackers] get_page_link by page name/slug?

Matt Mullenweg m at mullenweg.com
Mon Nov 27 16:38:58 GMT 2006


Lee Kelleher wrote:
> Yeah, Robin is right... I'm using it in the header/footer of my template
> (outside of the loop).
> 
> Essentially I wanted a way to link to a page (not a post) regardless of the
> permalink structure - but using the slug/name as the reference.
> 
> My code works fine, but was more curious if there was a more native way
> using the WP-core code?

<?php query_posts('pagename=about'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_permalink(); ?>
<?php endwhile; endif; ?>


-- 
Matt Mullenweg
  http://photomatt.net | http://wordpress.org
http://automattic.com | http://akismet.com


More information about the wp-hackers mailing list