Hi There,
I'm building a custom function for breadcrumbs and I need to retrieve the permalink value for the is_home() function.
I went to 'Settings > Reading' and set a 'static front page' and chose my 'posts page'.
is_home() is working as expected, returning the page name for my 'posts page' which was manually set up above.
I just need to know how to retrieve the url or permalink of the is_home() function?
btw: bloginfo(url) and bloginfo(siteurl) are both returning the URL of the static homepage. Can't seem to figure out how to return the value of the posts page?
I greatly appreciate your help.
Cheers.
Pippin Williamson answers:
Use the home_url() function:
[[LINK href="http://codex.wordpress.org/Function_Reference/home_url"]]http://codex.wordpress.org/Function_Reference/home_url[[/LINK]]
WP Answers comments:
home_url() is returning the URL of the static homepage (ie: www.xxxx.com)
looking to retrieve my 'posts page' url which is: www.xxxx.com/blog
Pippin Williamson comments:
Here you go:
[[LINK href="http://wordpress.org/support/topic/get_-link-to-blog-page"]]http://wordpress.org/support/topic/get_-link-to-blog-page[[/LINK]]
WP Answers comments:
Awesome. Just figured it out. Thank you brother!
Andrzej answers:
can you tell me how your hard-coded post page permalink looks like? you can hide domain name i.e. www.xxxx.com/posts/ ?
WP Answers comments:
Sure thing.
http://www.xxxx.com/post-title
juan manuel incaurgarat answers:
try <?php echo home_url(); ?>
that would return the url for home :)
Ali Hussain answers:
You could use a simple php code
<a href="<?php ($_SERVER['REQUEST_URI']=='/') ;?>">your home page link</a>
<?php ($_SERVER['REQUEST_URI']=='/') ;?>
Ryan Riatno answers:
I'm not sure about your code, but I think get_permalink($id) maybe solve your problem http://codex.wordpress.org/Function_Reference/get_permalink