Override Current Theme Setting in wp_config.php

Drop this in a plugin & activate. I should note this doesn’t take into account things like child themes – it’s purely for toggling which theme renders based on SOME_FLAG. add_filter( ‘stylesheet’, ‘switch_ma_theme’ ); add_filter( ‘template’, ‘switch_ma_theme’ ); function switch_ma_theme() { // Return the theme directory name return SOME_FLAG ? ‘theme-1’ : ‘theme-2’; }

Why is styling comments so complex?

If you prefer simple template files, you can do that with custom comment callbacks too. Call wp_list_comments() with a custom callback handler: wp_list_comments( array( ‘callback’ => ‘custom_comment_callback’, ‘style’ => ‘ol’ ) ); Now make that callback function very simple: function custom_comment_callback( $comment, $args, $depth ) { include ‘comment-template.php’; } And now you can use comment-template.php … Read more

How to disable 3.1 “Admin Bar” via script for the admin user?

You could use a function inside your theme’s functions file to selectively disable it for specific users. function disable_bar_for_user( $ids ) { if( !is_user_logged_in() ) return; global $current_user; if( is_numeric( $ids ) ) $ids = (array) $ids; if( !in_array( $current_user->data->ID, $ids ) ) return; add_filter( ‘show_admin_bar’, ‘__return_false’, 9 ); } Then call it for the … Read more

Add colors to existing color palette without replacing it

You can merge palettes $existing = get_theme_support( ‘editor-color-palette’ ); $new = array_merge( $existing[0], array( array( ‘name’ => __( ‘Strong magenta’, ‘themeLangDomain’ ), ‘slug’ => ‘strong-magenta’, ‘color’ => ‘#a156b4’, ), array( ‘name’ => __( ‘Light grayish magenta’, ‘themeLangDomain’ ), ‘slug’ => ‘light-grayish-magenta’, ‘color’ => ‘#d0a5db’, ), )); add_theme_support( ‘editor-color-palette’, $new);

How to alter the text of the post “Excerpt” box label in WordPress post editor?

there is a filter hook you can use and it is gettext here: add_filter( ‘gettext’, ‘wpse22764_gettext’, 10, 2 ); function wpse22764_gettext( $translation, $original ) { if ( ‘Excerpt’ == $original ) { return ‘My Excerpt label’; }else{ $pos = strpos($original, ‘Excerpts are optional hand-crafted summaries of your’); if ($pos !== false) { return ‘My Excerpt … Read more

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