How To View Site from Non-Logged-In User’s Perspective
See this related question. You should be able to add this code to your themes functions.php add_filter( ‘edit_post_link’, ‘__return_false’ );
See this related question. You should be able to add this code to your themes functions.php add_filter( ‘edit_post_link’, ‘__return_false’ );
I wrote a tutorial for Incorporating the Settings API in WordPress Themes. The only real difference for Plugins is that you’ll use add_settings_page() instead of add_theme_page(). The rest should pretty much be the same.
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’; }
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
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
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
Basically to distinguish between false boolean value and ” empty string you must use more strict comparison operator. var_dump( ” == false ); // this is ‘true’, treated like two ’empty()’ values var_dump( ” === false ); // this is ‘false’, because values are both ’empty()’ BUT of different type But there is more. Since … Read more
You could delete an existing cache for your option before you call get_option(): $GLOBALS[‘wp_object_cache’]->delete( ‘your_option_name’, ‘options’ ); $value = get_option( ‘your_option_name’ );
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
Look at the table schema in wp-admin/includes/schema.php: // regular blog tables CREATE TABLE $wpdb->options ( option_id bigint(20) unsigned NOT NULL auto_increment, option_name varchar(64) NOT NULL default ”, option_value longtext NOT NULL, autoload varchar(20) NOT NULL default ‘yes’, PRIMARY KEY (option_id), UNIQUE KEY option_name (option_name) ) $charset_collate; // Multisite options CREATE TABLE $wpdb->sitemeta ( meta_id bigint(20) … Read more