![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: Blog, breadcrumb, duplicate
-
AuthorPosts
-
October 6, 2015 at 6:28 pm #514671
Hello,
I have a site with a news / blog page defined in the Enfold Options (with ‘News’ as its title), and I am using a category for those posts, also called ‘News’.
When I open a post in “News”, I get the term ‘News’ duplicated in my breadcrumb, I understand it sort of makes sense, as the first ‘News’ links to the ‘News’ page itself while the second one seems to link to the category archive (…/blog/news).
I have tried removing the setting of my News page as the Blog page in Enfold’s Options, and something even weirder happens to the breadcrumb when I do that: it then duplicates the post’s title in the breadcrumb, inserting it before and after the ‘News’ item.
In my case I would just like to be able to get rid of duplicate terms in my breadcrumb but I’m not being able to figure out the best way to do that on my own, so I’m hoping you can help me with that.
Best regards!
October 7, 2015 at 11:45 am #515099Hi José!
you did not show us which item you want to hide exactly and I am guessing it’s this one:
h1.post-title.entry-title { display: none; }
Add this code into your Quick CSS field.
Best regards,
AndyOctober 7, 2015 at 12:44 pm #515121Hello,
Sorry if my explanation wasn’t clear enough.
I think the item you (and your code) are referring to seems to be for the default post title, which I want to keep, at least for now.My problem is with the breadcrumb construction for single posts, I am attaching a screenshot of the actual item I want to remove, highlighted on DevTools:
https://www.dropbox.com/s/8uf7eqqjys9grc3/Screenshot%202015-10-07%2011.29.08.pngBest regards,
José-
This reply was modified 8 years, 11 months ago by
dZ_EB. Reason: correcting image attachment
October 8, 2015 at 12:25 pm #515722Hey!
try this solution: https://kriesi.at/support/topic/removing-category-in-the-blogs-breadcrumb/#post-138577
Cheers!
AndyOctober 8, 2015 at 5:49 pm #516022Hi Andy,
Thanks for the support!
The solution you linked to does what I wanted, but only if I do that change directly in the main theme files.
I am using a child-theme for most of my customizations, and I tried doing that change in the child-theme (replicating that part of the theme’s folder structure on my child theme and duplicating the class-breadcrumb.php file into it) so it would be a bit more ‘update proof’, but I guess that logic of working with child-themes only works for template files and such, as it doesn’t seem to be working with this file.
Would it be possible to do this change in a more ‘child-theme friendly’ way?
Best regards,
JoséOctober 9, 2015 at 1:48 pm #516447Hey!
try to move the class-breadcrumb.php’s code to the child theme’s function.php.
Regards,
AndyOctober 9, 2015 at 6:45 pm #516629Hey Andy,
Thank you for the suggestion, but apparently I didn’t get it to work.
I tried copying the full content of the class-breadcrumb.php file into the bottom of my functions.php, but that ended up causing the following Fatal Error:
“Fatal error: Cannot redeclare avia_breadcrumbs() (previously declared in D:\xampp\htdocs\malabar\wp-content\themes\enfold-child\functions.php:769) in D:\xampp\htdocs\malabar\wp-content\themes\enfold\framework\php\class-breadcrumb.php on line 521”
(I am trying these changes in a local development version of another site I’m building with enfold, in order to avoid problems on my ‘live’ site, hence the local file paths.)
Best regards,
JoséOctober 12, 2015 at 8:58 am #517184Hi!
Please provide a link to the actual post with the issue. We can use a filter in the functions.php file to modify the breadcrumb’s output. Example:
add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 2 ); function avia_breadcrumbs_trail_mod( $trail, $args ) { if ( is_single() ) { unset($trail[1]); } return $trail; }
Cheers!
IsmaelOctober 12, 2015 at 12:16 pm #517294Hi again,
I have set up a ‘test copy’ of my site so there’s no problem with changing stuff there, and I’m providing a link to a post with the issue on the ‘Private Content’ of this reply (although the issue happens with all posts).
I tried adding that snippet you provided to my functions.php but it didn’t solve my issue (I suppose that is because it was just meant as an example and would need adjustment for my specific case).
-
This reply was modified 8 years, 11 months ago by
dZ_EB. Reason: forgot to mention testing of the suggested code snippet
October 13, 2015 at 3:35 pm #518128Hi!
Thank you for the info. Please remove browser cache then check the page: http://dev.creativemary.com.pt/news/may-design-series-furniture-fair/
Best regards,
IsmaelOctober 14, 2015 at 5:05 pm #518815Hi Ismael!
I was having trouble opening that link, but I quickly found out it’s publishing settings had changed to scheduled and it was saying it had missed schedule, but I just had to change its status back to published and it got back to normal.
I saw your snippet did exactly what I wanted, and that you just had to change
unset($trail[1]);
tounset($trail[2]);
.Thank you very much for the help!
Best regards,
JoséOctober 15, 2015 at 9:54 am #519087 -
This reply was modified 8 years, 11 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.