Understanding wp_add_inline_style

wp_add_inline_style() is intended to add additional CSS to an existing stylesheet. The idea is that you may need to dynamically alter the stylesheet – for instance, you have user-selected colours associated with categories and you would like to colour each category’s title accordingly. You can’t hardcode this since the colours in question are not known, … Read more

Add a dropdown to theme customizer

Add Section to Theme Customizer: $wp_customize->add_section( ‘parsmizban_options’, array( ‘title’ => __( ‘Theme Options’, ‘parsmizban’ ), //Visible title of section ‘priority’ => 20, //Determines what order this appears in ‘capability’ => ‘edit_theme_options’, //Capability needed to tweak ‘description’ => __(‘Allows you to customize settings for Theme.’, ‘parsmizban’), //Descriptive tooltip ) ); Add new Setting: $wp_customize->add_setting( ‘bootstrap_theme_name’, //No … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)