switch theme on fly

You can use Theme Switch and Preview. If you are up for coding this yourself, you can use the template and stylesheet filters. E.g.: to switch to Twenty Ten: function custom_load_twenty_ten_template() { return ‘twentyten’; } function custom_load_twenty_ten_stylesheet() { return ‘twentyten’; } add_filter( ‘template’, ‘custom_load_twenty_ten_template’ ); add_filter( ‘stylesheet’, ‘custom_load_twenty_ten_stylesheet’ );

Enable / Add Custom Keyboard Shortcuts To Work With WordPress’ HTML Editor

The toolbar / editor used on Stack Exchange websites (and in my plug-in WP-MarkDown) is PageDown. This comes with three JavaScript files: One that handles MarkDown to HTML conversion One that handles sanitization One that handles the editor (the toolbar and previewer) Included in the latter are the MarkDown keyboard shortcuts you mentioned. The following … Read more

How to search in a Custom Field?

The following function needs to be put in the functions.php of your template code. Or in a plugin. function custom_search_query( $request ) { $query = new WP_Query(); // the query isn’t run if we don’t pass any query vars $query->parse_query($request); $request[‘post_type’] = ‘LAW’; // this is the actual manipulation; do whatever you need here if(isset($_GET[‘search’])) … Read more

How to get shortcode working from custom meta field

You can do this by using ‘the_content’ filter. That way, WordPress will treat the content as it was came from the editor field and execute all the shortcodes: <?php $meta = get_post_meta($post->ID, ‘intSlider’, true); ?> <div id=”sliderWrap”> <div id=”slider” class=”floatLeft”> <? echo apply_filters(‘the_content’, $meta); ?> </div> </div> Just be careful because it will wrap the … Read more

Enabling Sessions in WordPress 3.0

If you need to manually enable the session globally, use this in your functions.php (I included a line for manually setting a session variable as an example, not required): add_action(‘init’, ‘session_manager’); function session_manager() { if (!session_id()) { session_start(); } $_SESSION[‘foo’] = ‘bar’; } and if you wanted to manually clear the session on an event … Read more

How to make custom bulk actions work on the media/upload page?

If you want to use your code, try this: If you want to check if the medias are attachments, you can try to use $_REQUEST[‘detached’] add_action( ‘load-upload.php’, ‘export_media_test’ ); function export_media_test() { if ( ! isset( $_REQUEST[‘action’] ) ) return; echo ‘Export Media’; if ( isset( $_REQUEST[‘detached’] ) ) { die( ‘No attachments’ ); } … Read more

How can I remove the sitename or homepage title from all page titles?

By default WordPress use _wp_render_title_tag to hook wp_head ( see here ) add_action( ‘wp_head’, ‘_wp_render_title_tag’, 1 ); This function is wrapper of wp_get_document_title to show title tag on theme if add_theme_support( ‘title-tag’ ); added in theme file functions.php ( commonly ). https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/general-template.php#L944 If you see filter document_title_parts on function wp_get_document_title(), we can filter parameters that … Read more

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