{"id":1112124,"date":"2016-05-09T02:14:19","date_gmt":"2016-05-09T09:14:19","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/"},"modified":"2016-05-09T02:35:40","modified_gmt":"2016-05-09T09:35:40","slug":"theming-listview-to-match-category-2","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/","title":{"rendered":"Theming listview to match category"},"content":{"rendered":"<p>Hi Brook,<\/p>\n<p>I have implemented your code in our custom widget code. However, it does not provide the information I needed.<\/p>\n<p>I have created a category under Events and an identical category under Post. Then I run a code where I get the Post category; however no matter what category reference (e.g, \u201cAdobe Connect\u201d or \u201cadobe-connect\u201d) I use I do not get the result needed. Is there something I am missing in order to make the do_shortcode working?<\/p>\n<pre><code>&lt;CODE&gt;\n\/\/ WIDGET: Display related courses\nclass displayrelatedcourses extends WP_Widget {\nfunction __construct() {\nparent::__construct(\n\/\/ Base ID of your widget\n&#039;displayrelatedcourses&#039;,\n\/\/ Widget name will appear in UI\n__(&#039;Widget - Display Related Courses&#039;, &#039;wpb_widget_domain&#039;),\n\/\/ Widget description\narray( &#039;description&#039; =&gt; __( &#039;Custom widget displaying related courses&#039;, &#039;wpb_widget_domain&#039; ), )\n);\n}\n\n\/\/ Creating widget front-end\npublic function widget( $args, $instance ) {\n\/\/ ****** TITLE OF WIDGET ******\n$title = apply_filters( &#039;widget_title&#039;, $instance[&#039;title&#039;] );\n\/\/ before and after widget arguments are defined by themes\necho $args[&#039;before_widget&#039;];\nif ( ! empty( $title ) )\necho $args[&#039;before_title&#039;] . $title . $args[&#039;after_title&#039;];\n\n\/\/ ****** CONTENT ******\n$cat_difficulty = array(); \nforeach((get_the_category()) as $childcat) {\n\/\/ Post category ID for &#039;Events&#039; equals 54\nif (cat_is_ancestor_of(54, $childcat)) {\ndo_shortcode(&#039;[tribe_events_list category=&quot;&#039;.$childcat-&gt;cat_name.&#039;&quot;]&#039;);\n}\n}\necho $args[&#039;after_widget&#039;];\n}\n} \/\/ WIDGET END\n\n\/\/ Register and load the widget\nfunction wpb_load_widget() {\n\tregister_widget( &#039;displayrelatedcourses&#039; );\n}\nadd_action( &#039;widgets_init&#039;, &#039;wpb_load_widget&#039; );\n&lt;\/CODE&gt;<\/code><\/pre>\n<p>Regards,<\/p>\n<p>Svend Tveden-Nyborg<\/p>\n","protected":false},"template":"","class_list":["post-1112124","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Theming listview to match category -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Theming listview to match category -\" \/>\n<meta property=\"og:description\" content=\"Hi Brook, I have implemented your code in our custom widget code. However, it does not provide the information I needed. I have created a category under Events and an identical category under Post. Then I run a code where I get the Post category; however no matter what category reference (e.g, \u201cAdobe Connect\u201d or [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-05-09T09:35:40+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/\",\"name\":\"Theming listview to match category -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-05-09T09:14:19+00:00\",\"dateModified\":\"2016-05-09T09:35:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Welcome!\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Pre-Sales Questions\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Theming listview to match category\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Theming listview to match category -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/","og_locale":"en_US","og_type":"article","og_title":"Theming listview to match category -","og_description":"Hi Brook, I have implemented your code in our custom widget code. However, it does not provide the information I needed. I have created a category under Events and an identical category under Post. Then I run a code where I get the Post category; however no matter what category reference (e.g, \u201cAdobe Connect\u201d or [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/","article_modified_time":"2016-05-09T09:35:40+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/","name":"Theming listview to match category -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-05-09T09:14:19+00:00","dateModified":"2016-05-09T09:35:40+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/theming-listview-to-match-category-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Welcome!","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/"},{"@type":"ListItem","position":4,"name":"Pre-Sales Questions","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/"},{"@type":"ListItem","position":5,"name":"Theming listview to match category"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1112124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1112124\/revisions"}],"predecessor-version":[{"id":1112135,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1112124\/revisions\/1112135"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1112124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}