Hello,
I have an issue with the breadcrumbs. I would like clicking on the part of the breadcrumbs that links to the category to go to a specific page instead of the category itself. How can I do that?
This is because I am grouping all my articles by a page that acts as a container, rather than by category.
So, I would like something similar to: Home > Container Page > Article Name
Hi maryano, this can be done only if you edit the theme files or an alternative will be to try to use an dedicate plugin that can edit the breadcrumbs: WordPress plugins to change breadcrumbs
Thank you!
Hi,
You need to edit the post template files that you want to use, for example if you are using post template 1 you’ll need to edit the file wp-content/plugins/td-composer/legacy/Newsmag/parts/single/loop-single-1.php you should edit this line of code – https://i.imgur.com/bQzzqqa.png
Thank you!
Hi,
From the code, it seems that the breadcrumbs are generated using the functions:
-get_category()
-get_title()
The structure is fine as it is, but I would like to replace the “get_category()” function to show custom pages instead of the category.
This is because my categories are called in custom pages. I have made the categories noindex to not show them to visitors, and I have transformed some pages into categories by inserting a block that calls the articles of that category. However, when I access an article and click on the breadcrumb, it takes me to the category, which I want to avoid.
I probably need to associate each category with the corresponding page also through a script, for example:
Category Windows –> Page Windows
Category macOS –> Page macOS
etc…
My question is: Is the right way to do this by modifying the “get_category()” function? If so, where can I find it to modify it?
To make it clearer:
This is the custom page that I transformed into a category: https://i.ibb.co/zstP4hf/Pagina-Windows.png
This is the category, which I cannot customize and want to avoid showing to visitors: https://i.ibb.co/cQHfBh6/Categoria-Windows.png
-
This reply was modified 2 years by
maryano.
Hi maryano, my question is what is the difference between the page and category because on layout I see that are quite the same, so why should you use a page instead f category (this can affect the results in the google results for the article).
Now related to the changes, there is no need to change the functions, what can be done is to comment that line of code and add your own code that will set the breadcrumbs and should add the page link. I think it can be done using a shortcode in code and custom files per article where to select the page you want to set in the breadcrumbs, doing this you’ll have the possibility to set one code line that will display the correct breadcrumbs by getting the value from your custom filed.
Thank you!
Hi, thanks for the responses.
So, the page created to contain the articles is customizable via TagDiv Composer, whereas the categories are not. It might seem like the same thing, but there’s a significant difference. When I need to make important changes, I won’t be able to do so in the categories, only in the page. My intention is to transform those customizable pages into categories.
Regarding the functions, since I have 6 pages that act as 6 categories, the script uses the “get_category()” function to determine the category associated with the article. So how can I tell the breadcrumbs “Hey, take the customized page that contains the articles and not the category”? How does the “get_category()” function identify the category associated with the article? Through an ID? Through an index of an array?
For example:
If in my “article 1” the breadcrumb is as follows:
Home > category 1 > article 1
And I want to transform it into:
Home > container page 1 > article 1
I think that in the “get_category()” function, when it identifies the category, I need to pass it the URL of the page that contains that category. Otherwise, how could I do it?
In the categories page, there is this white element (see photo), how can I change its color?
Photo 1: https://i.ibb.co/SdM78kz/1.png
Photo 2: https://i.ibb.co/VvfnCk3/2.png5
Hi maryano, “the page created to contain the articles is customizable via TagDiv Composer, whereas the categories are not. It might seem like the same thing, but there’s a significant difference. When I need to make important changes, I won’t be able to do so in the categories, only in the page. My intention is to transform those customizable pages into categories.” – but if yo are using the Newspaper theme and cloud templates, you can customize all templates from the website, author, category, tags, CPT templates etc. using the tagDiv Composer, also you can use as many templates you want, for example you can use for each category a different template – https://i.imgur.com/q65q9GA.png – https://i.imgur.com/1sbm4ur.jpeg – https://i.imgur.com/1sbm4ur.jpeg
The articles/posts have categories assigned, so in database each article has a field with the categories ids and base on those are created the breadcrumbs.
If you need to continue with the code:
Here’s an example of how you can achieve this by customizing the breadcrumb output using the bcn_display function from the Breadcrumb NavXT plugin. If your theme uses a different breadcrumb plugin or custom code, you can adapt this approach accordingly.
Step 1: Install Breadcrumb NavXT Plugi
Step 2: Create a Custom Breadcrumb Filter
Add the following code to your theme’s functions.php file. This code checks the category ID in the breadcrumbs and replaces it with a custom page link. (example code)- https://pastebin.com/LBS8wixq
Now this is only an example and it is possible to be need to do many changes to the code.
Thank you!
I installed Breadcrumb NavXT and added the code in the functions.php file.
Now I need to display the Breadcrumb NavXT plugin in the article template. I need to activate the ‘bcn_display’ function here:: wp-content/plugins/td-composer/legacy/Newsmag/parts/single/loop-single-7.php
Is that correct?
Hi,
If you are using the post template style 7, then yes, the file is wp-content/plugins/td-composer/legacy/Newsmag/parts/single/loop-single-7.php the code line that should be replace is on line 16 – https://i.imgur.com/7maP1xY.png
I hope this will help you!
It still doesn’t work. At this point, it seems to me that the ideal solution is to use the category page and maybe modify it to make it similar to my container page. Unfortunately, any future modifications to the category pages will need to be done through code, and this will take time.
I have been exploring this possible solution for a while, as I was asking above: In the categories page, there is this white element (see photos), how can I change its color? I would like to make it gray like the rest of the block.
Photo 1: https://i.ibb.co/1fLc1Rd/1.png
Photo 2: https://i.ibb.co/5LPvjqM/2.png
Photo 3: https://i.ibb.co/J3kxNJ2/3.png
Hi,
All you need to do to change that color to be as the rest of the page is to use a custom css like this one:
.td_category_template_3 .td-scrumb-holder .td-pb-span12 {
background: transparent;
}
This code should be set in the theme panel . custom code> custom css and the results should be like this – https://i.imgur.com/KyNwT0M.png
Thank you!