Skip to main content

Timeline for Widget logic conditional widget

Current License: CC BY-SA 3.0

17 events
when toggle format what by license comment
Jun 23, 2015 at 12:42 comment added Pieter Goosen No problem. Enjoy :-)
Jun 23, 2015 at 12:40 vote accept da_root
Jun 23, 2015 at 12:09 comment added da_root Hi All, Finally is works well,I should answered here cause I can't post a answered (banned) the code I used is: has_term( 'statistical-news', 'news' ) Thanks All for the clue
Jun 22, 2015 at 12:51 comment added da_root I see, yes maybe I have some other issue on that. Thanks
Jun 22, 2015 at 12:42 comment added Pieter Goosen It should work. You have some other issue somewhere then. You are adding the code wrong, or your $post global is broken or you are using query_posts somewhere which is breaking the main query. Please, do not post code in comments, it is unreadable. File an edit and add code directly in your question
Jun 22, 2015 at 12:38 comment added da_root Hi, really thanks still help me: this my code on widget logic: global $post; if ( $post->post_type == 'resource' // checks the post type of the post && is_single() // Checks if this is a single post && has_term( 'statistical-news', 'news', $post->ID ) // Check if post has specific term ) { // Do something if our condition is true } and still no luck, I am really new using this widget logic
Jun 22, 2015 at 12:30 comment added Pieter Goosen Did you change the values in my code. My code is not copy&paste ready, you need change the values yourself to your desired values. As I said, your terminology does not make sense, so I do not know what to use as the correct values. That you have to sort yourself
Jun 22, 2015 at 12:24 comment added da_root Same, is not working. May be my structure not too good. Maybe it helps if I am write down the situation. I have post type with name resource, on the resource have the main custom taxonomy (category) News, and news have the sub-taxonomy Statistical News. What I want is, on the single post of the Resource with Statistical News will show the specific Widget. Sorry for bad explanation
Jun 22, 2015 at 12:11 answer added Pieter Goosen timeline score: 1
Jun 22, 2015 at 11:35 answer added Anand timeline score: -1
Jun 22, 2015 at 11:32 comment added da_root Yes :), for example I have custom taxonomy with name resources, and child taxonomy of the resources is economic_news so I want to display the widget only on the single page of that taxonomy.
Jun 22, 2015 at 11:29 comment added Pieter Goosen Do you mean a specific term, or for all terms under a specific taxonomy
Jun 22, 2015 at 11:27 comment added da_root So, what the conditional should be for the cuatom taxonomy? As per I knew, in_category is only for default
Jun 22, 2015 at 11:13 comment added da_root Hi Pieter, the error I got is the sidebar widget not showing anything.
Jun 22, 2015 at 11:11 comment added Pieter Goosen I don't know what errors you are getting or what exactly your issue is, but in_term() according to my knowledge is invalid
Jun 22, 2015 at 11:09 history edited Pieter Goosen CC BY-SA 3.0
added 4 characters in body
Jun 22, 2015 at 11:06 history asked da_root CC BY-SA 3.0