I think you want bloginfo(‘url’). See the Codex here.
Thread Starter
frntk
(@frntk)
Hi vtxyzzy! Thanks for your reply.
That’s what I’m currently using but it’s not what I’m looking for. Let me elaborate.
– My blog is set up at http://domain.com/ (this is what bloginfo(‘url’) returns)
– My front page is set to display a “static page” (I called this page “home”)
– My posts page is set to display another page I created called “news”.
What I want is a link back to “http://example.com/news/” when I’m in single.php displaying posts, but bloginfo(‘url’) gives me the front page URL.
(sidenote: oddly, when I use get_bloginfo(‘url’) it gives me the current post URL! I’ll research more into this).
Thanks!
I think this is what you want:
<?php $permalink = get_permalink( $id ); ?>
Where $id is the ID of your news page.
You can use the following, which doesn’t require you to find the ID of the page (and will also update if you change pages)
<a href="<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>">View News</a>
It’s the same as vtxyzzy’s, but it just gets the option you selected as the posts page, as opposed to a static ID.
Thread Starter
frntk
(@frntk)
That’s wat I needed. Thanks a lot, to both of you, for your help!