Archived topic
How to add " related products" & " related blogs" at end of each page
42 replies · Started by Paul on October 17, 2022
hello david
thanks for your help.
now they are all separate page.
So, need to create Taxonomies Under the menu of Pages. just like the Taxonomies Under the menu of Posts. https://prnt.sc/5FJPxSmDNYsy
But, it is the defaul Taxonomies from the wordpress for The Posts.
Now need me to create a plugin in order to add Taxonomies for my pages, it is difficult for me to create a plugin.
so,
option 1, can you tell me how to add it or tell me the code, i will it to Additional CSS?
option 2, can you tell me if there is ready-made wordpress Taxonomies plugin?
awaiting your reply and thanks in advance, have a great day.
For your Pages taxonomy - Do you want to use the same Categories and Tags you have for Posts?
e.g i create a Post Category of Metal, do you want Pages to also see Category > Metal
Hello David
The method you recommend is really good.
My products are stainless steel, aluminum, titanium
For posts, I can write blog posts about stainless steel, aluminum, and titanium separately.
I could use the words Stainless Steel, Aluminum, Titanium as Categories or Tags.
In the same way, I can also classify the taxonomy of products by Categories or Tags.
Please see the screenshot https://prnt.sc/nZj0b7oGGD-D, there is no Categories or Tags under my Page
Fernando gave me a link before, they are in the screenshot in the article https://prnt.sc/AYWPGDNq_bCW, which has Categories or Tags under the Page, why it has them?
If so, how would that be done? Need CSS code or a plugin to add Categories or Tags?
Another, if i don't want to use the same Categories and Tags as Posts, then how to do that?
thanks in advance
Option 1 - use the Post categories and tags on Pages:
Add this PHP Snippet to your site:
function add_categories_to_pages() {
register_taxonomy_for_object_type( 'category', 'page' );
}
add_action( 'init', 'add_categories_to_pages' );
function add_tags_to_pages() {
register_taxonomy_for_object_type( 'post_tag', 'page' );
}
add_action( 'init', 'add_tags_to_pages');
Option 2 - a custom taxonomy for pages and categories is much more complicated, and would either require custom development or a more complex plugin
hello david
thanks for help
PHP snippet wil be added to Additional CSS from this screenshot https://prnt.sc/hyGeKNJYUcfa?
i never did that before and dont know to to do that?
1. is it possible to make the video guide for me?
2. If solving this issue of Taxonomies, then i will add the section of "related to products" at end of the product pges?
3. If solving this issue of Taxonomies, i can add the BreadCrumbs for all pages and achives?
4. This PHP Snippet can be added or deleted by myself based on my requirement? it will not effecth theme php if i delete it in the future? right? pls explain and confirm that, thanks in advance.
No PHP is not CSS. This document explains how to add PHP:
https://docs.generatepress.com/article/adding-php/
TLDR:
Are you using a Child Theme?
If YES, then the PHP gets added to the Child Theme > functions.php
If NO, install the Code Snippets plugin, then in Snippets > Add New, paste in the code, and Save it.
Answers to 2, 3 and 4 = Yes.
hello david
Are you using a Child Theme?
If YES, then the PHP gets added to the Child Theme > functions.php
If NO, install the Code Snippets plugin, then in Snippets > Add New, paste in the code, and Save it.
What is a Child Theme? im using GeneratePress + GP Premium + GenerateBlocks Pro
Also, although we are using Child Theme, can i use Code Snippets plugin?
How to use a child theme: https://docs.generatepress.com/article/using-child-theme/
Yes, even if you are using a child theme (but I don't think you are using one), you can still use code snippet plugin.
hello how are you
1. i downloaded the child theme. it seems that this child theme is also done by Generatepress.
To be honest, i never heard of this child them since i bought this theme.
I would like to know when we can consider using this child theme?
when you bought this theme, i only know to use GP Premium and GeneratePress, never see this child theme in Downloads of the account?
2. although i am not good dat Child Theme and how to use functions.php, could yuou give some blog article or docs , or video from generatetheme? I want to check them and learn them well for the future use?
thanks in advance
A Child theme is a WordPress concept. The "Child" theme you downloaded is a child theme to GeneratePress theme. Intrinsically, you're still using GeneratePress theme
To make it simple, generally, child theme are used if you'll be making edits to the theme's files. This is because if you make edits on the Parent theme(Original GeneratePress theme), the changes you'll be making will be deleted once there is an update.
With that said, if you're not planning to make any kind of "change/edit" to the files of GeneratePress code-wise, and you're just planning to "add" code, then using Code snippets would be good.
For more reading on Child themes, I found this on Google: https://www.wpbeginner.com/beginners-guide/wordpress-child-theme-pros-cons/
hello
yes, i dont want to make big or many chagnes for orignial generatepress theme
Child theme is mainly for Designers and developers with big customized task
if only adding few or small funciton, better to use code snippet plugin
I see. Then Code Snippets Plugin is definitely the way to go.
You can find it here: https://wordpress.org/plugins/code-snippets/ or in Plugins > Add new in your admin dashboard.
Hi Fernando
Thanks for quick rely.
Now i will add PHP snippet from this screenshot https://prnt.sc/_M_PxyyONk0y by Code Snippets Plugin
Once the above is done, then i will see the result from the screenshot https://prnt.sc/ID7GEgxrwbSM
Just As David told me yesterday, Pages taxonomy and Posts taxonomy – use the same taxonomy including Categories and Tags?
thanks for checking them for me again and thanks in advance
Yes, that's correct.
thanks for all
so the final result is like this https://prnt.sc/Ms17zWL97SOW
1, 2 , 3, are the same as the picture
5, 6 is blank
then save.