Breadcrumbs: Direct the "Home" Link to the blog page when using static homepage
-
I am using WP as a small CMS. I set up the frontpage to be a static page and my blog should be on the “news” page.
My theme (Arthemia Premium) is using breadcrumbs out of the box. But now I have the problem, that the “Home” link in the breadcrumbs leads back to the static frontpage.
Since I want to change this and the “Home” link should direct to the blog page (“News”), i searched the web and found this solution:
template tag to get URL for blog page when using static homepage?
I followed the instructions there and now I have a function that looks like this in functions.php:
<?php if ( ! function_exists( 'mytheme_get_posts_page' ) ) : function mytheme_get_posts_page($info) { if( get_option('show_on_front') == 'page') { $posts_page_id = get_option( 'page_for_posts' ); $posts_page = get_page( $posts_page_id ); $posts_page_title = $posts_page->post_title; $posts_page_url = get_page_uri( $posts_page_id ); } else $posts_page_title = $posts_page_url = ''; if ($info == 'url') { return $posts_page_url; } elseif ($info == 'title') { return $posts_page_title; } else { return false; } } endif; ?>
I call this function on my single.php like this (just where the breadcrumbs should appear on the template):
<span id="map"><a href="<?php echo mytheme_get_posts_page('url'); ?>"><?php echo mytheme_get_posts_page('title'); ?></a> » <?php the_category(', ') ?></span>
Well, this works so far, but what seems strange to me is, that the “Home” link now looks like this (when I hover over it, I can see this adress at the bottom of my browser):
http://localhost/mydomain.com/2013/01/02/this-is-a-post/news
How can I make it look like this:
http://localhost/mydomain.com/news
Any help is really appreciated! Thank you in advance…
- The topic ‘Breadcrumbs: Direct the "Home" Link to the blog page when using static homepage’ is closed to new replies.