Archive Widget – Count only parent posts

I haven’t tested this, but I found a sample that was close. I have modified it to be similar to what you want. I’m not sure it is 100%, but it should get you really close: add_action(‘pre_get_posts’,’wpse_filter_parents_only’); function wpse_filter_parents_only($query){ if (!is_admin() && is_category(’26’)){ $query->set(‘post_parent’,0); } return $query; } This should update what WP_Query retrieves from … Read more

how to make video autoplay in widget

You can do that by writing JavaScript. Like, in your theme footer (footer.php) if you place code like below (before the ending </body> tag): <script> var vid = document.querySelector(‘video.wp-video-shortcode’); vid.autoplay = true; vid.load(); </script> It will autoplay all the videos of all the video widgets on the DOM (or in fact all the videos with … Read more

Widgets are not displaying in my theme

Change Id of register sidebar. i have tested and after changing id it is working fine. let me know if this solve you issue. function universalSearch() { register_sidebar( array( ‘name’ => ‘Universal Search’, ‘id’ => ‘universal-search-field’, ‘before_widget’ => ‘<div class=”chw-widget”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h2 class=”chw-title”>’, ‘after_title’ => ‘</h2>’, ) ); register_sidebar( array( ‘name’ … Read more