Call dynamic_sidebar but include/exclude named widgets?

dynamic_sidebar() calls wp_get_sidebars_widgets() to get all widgets per sidebar. I think filtering this output is the best way to remove a widget from an sidebar. add_filter( ‘sidebars_widgets’, ‘wpse17681_sidebars_widgets’ ); function wpse17681_sidebars_widgets( $sidebars_widgets ) { if ( is_page() /* Or whatever */ ) { foreach ( $sidebars_widgets as $sidebar_id => &$widgets ) { if ( ‘my_sidebar’ … Read more

Using Bootstrap in themes

A few things to consider: Enqueue stylesheets properly, using wp_enqueue_style(), and hooked into either wp_enqueue_scripts or wp_print_styles Enqueue scripts properly, using wp_enqueue_script(), and hooked into `wp_enqueue_scripts() Ensure that enqueued stylesheets and scripts are only enqueued on the front end, and not in the admin back end. Bootstrap and similar frameworks should only be used on … Read more

Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere

You could do something like : $related_posts_query = new WP_Query( $related_posts_args ); if( $related_posts_query->found_posts < 10 ){ $args = array(/* new wp_query args*/); $newquery = new WP_Query( $args ); } # merge the two results $related_posts_query->posts = array_merge( $related_posts_query->posts, $newquery->posts ); $related_posts_query->post_count = count( $related_posts_query->posts ); # do your loop here

WordPress Settings API error

I believe the underlying problem is that the option array keys don’t exist yet. Let’s start here, in your initialization function: if( false == get_option( ‘thanathos_theme_display_options’ ) ) { add_option( ‘thanathos_theme_display_options’ ); } First, this: false == get_option( ‘thanathos_theme_display_options’ ) …should be this: false === get_option( ‘thanathos_theme_display_options’ ) …because you’re expecting an array to be … Read more

List of all theme customizer control types?

Have a look in the source: http://core.trac.wordpress.org/browser/trunk/wp-includes/class-wp-customize-control.php Basic control types: text checkbox radio select dropdown-pages Also some advanced control types (as-described by Otto): WP_Customize_Color_Control – extends the built in WP_Customize_Control class. It adds the color wheel jazz to places where color selection is needed. WP_Customize_Upload_Control – This gives you an upload box, for allowing file … Read more