Friday, October 10, 2014

Create custom add_menu_page and add_submenu_page in admin panel


function theme_options_panel(){
  add_menu_page('Theme page title', 'Theme menu label', 'manage_options', 'theme-options', 'wps_theme_func');
  add_submenu_page( 'theme-options', 'Settings page title', 'Settings menu label', 'manage_options', 'theme-op-settings', 'wps_theme_func_settings');
  add_submenu_page( 'theme-options', 'FAQ page title', 'FAQ menu label', 'manage_options', 'theme-op-faq', 'wps_theme_func_faq');
}
add_action('admin_menu', 'theme_options_panel');

function wps_theme_func(){
                
}
function wps_theme_func_settings(){
                
}
function wps_theme_func_faq(){
                
}

Wednesday, May 7, 2014

Remove shortcode from the_content_rss


 
function filter_shortcode_from_content_rss($content) {
$content = strip_shortcodes($content);
return $content;
}
add_filter('the_content_rss', 'filter_shortcode_from_content_rss');

Thursday, February 6, 2014

Deleting WordPress Revisions


DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'

Thursday, January 30, 2014

WordPress Error Reporting

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);