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’; }

Display all search results

The quick and dirty way to do it would be to use query_posts again, doubling the number of database calls. <?php if (have_posts()) : ?> <?php query_posts(‘showposts=999’); ?> Better would be to add this to functions.php, altering the original query before it is executed: function change_wp_search_size($query) { if ( $query->is_search ) // Make sure it … Read more

Add option to “Gallery Settings” section

Thanks to the hint with the multiple galleries plugin from Niall Campbell and thanks to this question How to Add a Custom Colum on Thickbox Media Gallery Tab? (where I got the hook admin_head-media-upload-popup from), I was able to complete the task. I’ve added an option to add a style attribute to the gallery shortcode. … Read more

Reorder custom submenu item

Got it, thanks to cjbj‘s help, I was able to get the final solution: add_filter( ‘custom_menu_order’, ‘submenu_order’ ); function submenu_order( $menu_order ) { # Get submenu key location based on slug global $submenu; $settings = $submenu[‘options-general.php’]; foreach ( $settings as $key => $details ) { if ( $details[2] == ‘blogging’ ) { $index = $key; … Read more

Get Content From Blog Page

You are using get_the_content() wrong, it can’t take a ID, which is what get_option(‘page_for_posts’) does return, and generally gets the content of the current post inside the loop, in which it has to be used. To get the actual content of that page you can do: $page_for_posts_id = get_option( ‘page_for_posts’ ); $page_for_posts_obj = get_post( $page_for_posts_id … Read more

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