Register_Sidebar overwriting itself and doesn’t exist in global $wp_registered_sidebars;

The solution was simple and made me feel tremendously stupid. 90% of the issues I could find remotely similar to my issue were all issues relating to the casing. Throughout this whole process I overlooked the “_HOMEPAGE” and “_RIGHT_SIDEBAR” in my IDs. Those should be lowercase. id – Sidebar id – Must be all in … Read more

Post Query not working

For the type of your $catId, you must use the cat parameter. You can check here the differents parameters allowed. cat (int) – use category id. category_name (string) – use category slug. category__and (array) – use category id. category__in (array) – use category id. category__not_in (array) – use category id.

How to create a widget like this?

Your question is a little short on detail, but let’s suppose you have retrieved the posts using wp_query and are looping through it like this: $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); STUFF } wp_reset_postdata(); } In the position of STUFF you want to distinguish … Read more

“All posts” in the category widget

If the default category widget’s interface doesn’t offer what you want, there are roughly two courses of action: find another widget or adapt the existing one. The first would be outside the scope of this site, the second one is a bit too broad, but here’s what you would do for big adaptations: Build the … Read more

Enqueue script only when side widget is used

is_widget_active is what you want e.g. function sidedish_slide_script() { wp_register_script(‘add-sd-js’, get_template_directory_uri() . ‘/form-slider/jquery-1.8.2.min.js’, array(‘jquery’),’null’, true ); wp_register_script(‘add-sd-custom’, get_template_directory_uri() . ‘/form-slider/formslider.js’, array(‘jquery’),’null’, true ); wp_register_style(‘add-sd-css’,get_stylesheet_directory_uri() . ‘/form-slider/styles.css’, ”,”,’screen’ ); if ( is_active_widget( false, ‘widget_id’, $this->id_base, true ) ) { wp_enqueue_script (‘add-sd-js’); wp_enqueue_script (‘add-sd-custom’); wp_enqueue_style (‘add-sd-css’); } } add_action(‘wp_enqueue_scripts’,’sidedish_slide_script’); https://codex.wordpress.org/Function_Reference/is_active_widget