tjramage
Member
Posted 9 months ago #
I am trying to get a "Back to Blog..." link at the bottom of the post when viewing single.php, but cannot figure out how to get the URL of the main posts page (where all the blog posts are). Using bloginfo('url') only provides the url to the front page...
There's probably a really easy solution for this, but I just can't figure it out... :S
Thanks,
- Tim.
tjramage
Member
Posted 9 months ago #
At the minute I'm doing this:
<?php echo bloginfo('url') . '/blog/'; ?>
But that will only work when the blog posts page is on /blog... I'm hoping there is a better way of doing this which works 100% of the time.
Not tested but what about:
<?php if( get_option( 'show_on_front' ) == 'page' ) echo get_permalink( get_option('page_for_posts' ) );
else echo bloginfo('url');?>
tjramage
Member
Posted 9 months ago #
That works perfectly! Thank you :-)