techneg
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Post Type UI] Create Shortcode To Display Custom TaxonamyI am marking this as resolved because the problem has been solved. The code for the following is this:
function specs(){ global $post; $categories = get_the_terms( $post, 'manufacturer'); if ( isset( $categories[0] ) ) { return '<span>' . esc_html( $categories[0]->name ) . '</span>'; } } add_shortcode( 'manufacturer', 'specs' );- This reply was modified 3 years, 11 months ago by techneg.
Forum: Plugins
In reply to: [Custom Post Type UI] Create Shortcode To Display Custom TaxonamyIt’s just showing terms for a given taxonomy for a single post at a time.
Forum: Plugins
In reply to: [Custom Post Type UI] Create Shortcode To Display Custom TaxonamyHey there,
Thanks for reaching out.I’m sorry if I am very bad at explaining the problem.
It’s like this:
I’ve created a custom taxonomy for every specification of the product. Such as [Manufacturer, Graphics Processor, Launch Price, Release Date… etc]. See the image below:
https://im.ge/i/uLbA3fNow, I want to create Shortcode for each custom taxonomy like:
shortcode [gpu_manufacturer] for custom taxonomy “Manufacturer” and upon placing the shortcode somewhere (in the table cell in my case), I want it to display the value I’ve put for the tag “Manufacturer” in some custom post type page. For eg: there’s one page for RTX 3060 GPU, and I’ve filled “NVIDIA” in the “Manufacturer” taxonomy, so I want that shortcode to display “NVIDIA” when placed inside that RTX 3060 GPU Post.And WPDataTable Work as follows:
I created one table named “GPU Database” and that single table will be inserted into every single of the GPU Specification listing page through the WPDataTable shortcode.
See the image below:
https://im.ge/i/ss2.uLbC4mSo in “[Shortcode here]” will be the shortcode for custom taxonomies [manufacturer, ram… etc].
Can you please share the code for the function? I Don’t know how all these terms etc work in WordPress and neither do I understand that get_the_terms(), you shared. I am sure it’s a very simple problem.
Forum: Plugins
In reply to: [Custom Post Type UI] Create Shortcode To Display Custom TaxonamyI just figured out that if I manage to create a shortcode to display a specific custom taxonomy and place it in the WPDataTable table cell and then place that table in a specific post through shortcode, it would basically show the custom taxonomy’s value of that page. I figured this out by using this code to generate a shortcode for the title and when I placed the shortcode inside the table, it showed the title of that page.
function page_title_sc( ){ return get_the_title(); } add_shortcode( 'page_title', 'page_title_sc' );So now one problem’s solved. I just need to create a function to display custom taxonomy values and shortcodes to trigger that specific function. Please help me with that because I have literally no idea how to create a function for CPT UI that will pull the custom taxonomy.
Forum: Plugins
In reply to: [Custom Post Type UI] Create Shortcode To Display Custom TaxonamyIt’s like this:
I am creating a GPU Database. So I have created a custom post type “GPU Database” and multiple custom taxonomy like “Manufacturer”, “Ram”, “Ram Type”…. and so many others. Then when I create a new post in “GPU Database Type”, I fill in all those tags with respective values such as in “Ram” I fill 8 GB, and in “Ram Type” I fill GDDR6. So now, what I want to do is create a shortcode for all those custom taxonomies which I’ll then place inside a table generated by WPDataTables to display specifications. I’ll only create only Table which I’ll embed on multiple GPU Database Post Types and I want that table to show the values of that specific post type’s custom taxonomy. Such as I created a table with 2 cols and rows.Specification Value
Ram Type [gpu_ram_type]here gpu_ram_type will be a shortcode for custom taxonomy Ram Type which will have different values for different custom posts (GPU Database).
So, I want to [1] create a shortcode for custom taxonomy [2] use that taxonomy through shortcodes in one single table created by WPDataTables [3] embed that table through shortcode on multiple different custom post type posts which will have different values for custom taxonomy (ram, speed etc). [4] want that table to show the value of custom taxonomies for that specific custom post.
I may be asking for a lot but I don’t have any bit of knowledge about WordPress coding so please help me solve this problem.