-
AuthorPosts
-
January 24, 2014 at 7:18 pm #214549
Hello,
The Enfold theme is quite good. After buying I am working on it on a development site. I have found the following aspect to point out, which is in contrast with the basic WordPress structure of Categories and Posts. Following your advice on the Themeforest site, I am moving here the discussion.
Consider the following structure:
Categories: Offers, News and Events
In each category various posts are contained.I use the basic permalink structure: /%category%/%postname%/ which returns something like this:
=> domain name / category archive / postname
=> mysite . com/offers/my-special-offer/
=> mysite . com/events/christmas-lunch/
And so on.When I am in the archive page for “Events” for instance, the archive page URL is: mysite . com/offers/
And the breadcrumb in my opinion shouls reflect the WP structure:
Home / OffersWhen I am in the post page for “My special offer” in the Event category the URL is: mysite .com/offers/my-special-offer/
And the breadcrumb in my opinion should the reflect structure, too:
Home / Offers / My special offerThis is not what happens in Enfold.
Just take your demo page http://kriesi.at/themes/enfold/category/breaking-news/
The breadcrumb is Home / BLOG / Breaking newsAnd if you visit one post, such as http://kriesi.at/themes/enfold/2013/10/21/the-lone-balloon/
The breadcrumb is Home / BLOG / Breaking news / The lone balloonIn practice, you use the BLOG page between Home and Category, in any situation.
What I would like to do is keep the structure as:
In category archives:
Home / Category
mysite .com/offers/In Posts:
Home / Category / Postname
mysite .com/offers/christmas-offers/This is the basic WordPress structure, and the breadcrumb should be able to reproduce it as it is.
I tried to go through the various files the whole afternoon, but the code structure is rather complicated.
Thank you for your attention.
January 24, 2014 at 8:18 pm #214578Hey Cum_Vincere!
You can change the breadcrumb structure easily – open up wp-content/themes/enfold/includes/helper-template-logic.php and delete this code:
else if(get_post_type() === "post" && (is_category() || is_archive() || is_tag())) { $front = avia_get_option('frontpage'); $blog = avia_get_option('blogpage'); if($front && $blog) { $blog = '<a href="' . get_permalink( $blog ) . '" title="' . esc_attr( get_the_title( $blog ) ) . '">' . get_the_title( $blog ) . '</a>'; array_splice($trail, 1, 0, array($blog)); } }
Another possible solution would be to deselect the blog page (Enfold > Theme settings). Then you can use the layout builder to add a blog element to your “blog” page but Enfold won’t recognize it as blog page anymore and thus it will just display the categories in the post breadcrumb.
Best regards,
PeterJanuary 25, 2014 at 11:43 pm #214909Hello Dude, thank you for your answer.
I tried to remove the code as you suggested but nothing changes. I still get:
URL in Archive: mysite .com/events/ = OK
Breadcrumb in Archive: Home / Events = OKURL in the post: mysite .com/events/u2-concert/
Breadcrumb in the post: Home / U2 concert = NO
It should be: Home / Events / U2 concertUnfortunately solution 2 does not solve the question: I cannot use a page with the same url /events/ as the taxonomy archive, as the system will always open the category and not the page.
I should set a different URL for the page, such as mysite .com/my-events/, but it would not be correct, as the post would still be mysite .com/events/u2-concert/. I want to achieve the normal WP continuity from /archive/ to /archive/post/, which is optimal for SEO.
Is there another possibility?
Thanks a lot.
January 26, 2014 at 12:13 pm #214998Hi!
Please try to insert following code at the bottom of functions.php
if(!function_exists('avia_modify_single_post_breadcrumb')) { function avia_modify_single_post_breadcrumb($trail) { if(!is_single()) return $trail; $category = get_the_category(get_the_ID()); if(empty($category)) return $trail; $newtrail = array(); foreach($category as $cat) { if(empty($cat->parent)) { $category_link = get_category_link($cat->term_id); $newtrail[] = '<a href="'.esc_url( $category_link ).'" title="'.$cat->cat_name.'">'.$cat->cat_name.'</a>'; } } if(empty($newtrail)) return $trail; array_unshift($newtrail, $trail[0]); $newtrail['trail_end'] = $trail['trail_end']; return $newtrail; } add_filter('avia_breadcrumbs_trail','avia_modify_single_post_breadcrumb'); }
Best regards,
PeterJanuary 27, 2014 at 12:47 am #215110Oh, boy! Everything seems to work fine!
Thank you Dude.
Tomorrow morning I’ll check everything back again.
Thanks a lot!January 27, 2014 at 9:27 am #215223Hey!
Great :)
Cheers!
Peter -
AuthorPosts
- The topic ‘Breadcrumbs for Home / Category / Postname’ is closed to new replies.