custom taxonomy category for the slideshow
Hi everyone, how can i set a custom taxonomy category for the widget that show slides in homepage? I'm trying Royale News Lite
Inside file 'royale-news-sidebar-widget.php' on Line 24, there is 'taxonomy' => 'category'. Replace the 'category' with the name slug of taxonomy that you've registered. For more information, you can see, https://codex.wordpress.org/Function_Reference/wp_dropdown_categories . This is the function that is used to create drop-down.
Hope you got your answer.
Thank for your reply, i'm sorry I had not seen the answer before, the file to edit for the slideshow widget on homepage is "royale-news-highlight.php" in the same directory. Precisely I edited the line 395 for the main slideshow, 427 for the topright, 461 for right bottom slideshow.
I replieced "taxonomy = 'my_custom_tax_slug" in the three points referred to the main slideshow, the top-right and the bottom-right, and actually the dropdown menu on the widget area in the backend shows correctly my custom taxonomy.
But if I select here, one of my custom category, in the frontend disappears the slideshow which should show the custom category. If I leave the default value "show recent post", instead, it works correctly...can you help me?
Maybe there is a problem by retrieving the list of categories in the function that returns them to the slideshow: 'royale_news_show_categories', is declared in "theme-tags.php" in the "themebeez" directory. I'm trying to figure out how to include both my custom taxonomy and the default taxonomy "category" in this function. Do you have any suggestions? Thank you so much for the support
Ok, I just edited royale-news-higligths.php on every call to the loop (in the $args when is called the wp_query) with:
'post_type' => array ('post' , 'my_custom_type'), 'taxonomy' => array ( 'category' , 'my_custom_taxonomy' )
but it seems useless, any suggestions? Thank you very much in advance for support
That is, I only got to be able to show the posts of my custom taxonomy through the "recent post" function (so the slideshow is now able to show them) but if I try to specify the custom category directly from the backend ... it simply disappears the single slideshow, be it the main one on the left, the one on the top right or the bottom right
Sorry for the late response. You've mentioned that at the backend part, the dropdown is showing the correct result but at the front end posts related to particular taxonomy is not being displayed. The problem is in the query, you've not queried properly. Here's a reference link to build up a query with WP_Query class, https://codex.wordpress.org/Class_Reference/WP_Query As for how to query, here's a link https://isabelcastillo.com/related-custom-post-type-taxonomy .
As for terms of your taxonomy similar to that of category in themes-tags.php, you can use wp_get_post_terms() function, here's the link, s https://codex.wordpress.org/Function_Reference/wp_get_post_terms /.
Let me break it down for you, in WordPress, category and tags are taxonomies defined for the post type, post. Similarly whenever you want to create a taxonomy, it must be related to some post type. It can be post, page or some custom post type. To query the terms related to a particular custom taxonomy, we use get_terms() function.
I hope after reading through it you can get some insight.