Remove action within a class in a parent theme from the child theme

To remove an action or filter, the function/method name and the priority must match with the previously added action/filter. The action you want to remove is added with a priority of 10 (default value) while you are trying to remove the action with priority of 99. Try this: remove_action( ‘woocommerce_product_options_inventory_product_data’, array( ‘Electro_WC_Helper’, ‘product_options_inventory_product_data’ ) ); … Read more

why does bones theme call the_excerpt function with parameters?

This is a bug in the theme. The real function does indeed not use the parameter: /** * Display the post excerpt. * * @since 0.71 * @uses apply_filters() Calls ‘the_excerpt’ hook on post excerpt. */ function the_excerpt() { echo apply_filters(‘the_excerpt’, get_the_excerpt()); } PHP will just ignore it, but the unnecessary gettext call should be … Read more

Select menu on browser resize

I think the plugin you mention is the one I wrote so if you’re looking for answer on how to do it take a look at the code. http://wordpress.org/extend/plugins/dropdown-menus/ Essentially all I did was create a custom menu walker class so I could output the menus created in the backend as a dropdown. If it … Read more

How do I change the gallery that is inserted in the post?

You can filter the default gallery shortcode. Here is something I’ve used in the past. add_filter( ‘post_gallery’, ‘wpse_gallery’, 10, 2 ); function wpse_gallery() { global $post; /* Orderby */ if ( isset( $attr[‘orderby’] ) ) : $attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] ); if ( !$attr[‘orderby’] ) unset( $attr[‘orderby’] ); endif; /* * Extract default gallery settings … Read more

Activate different theme for temporary preview

You can Detect Server Remote Address and if it matches with your IP then you can use different theme following way. function wp_set_preview_theme( $current_theme ) { if ( ‘YOUR_IP_ADDRESS’ === $_SERVER[‘REMOTE_ADDR’] ){ // Use your preview theme instead return ‘THEME_YOU_WANT_TO_USE’; } else { // Otherwise, keep the current theme return $current_theme; } } add_filter( ‘stylesheet’, … Read more

WordPress themes under GPL license

The GPL absolutely does not preclude selling code, for cost. In fact, the terms of the license explicitly allow for selling of code. The GPL merely allows the end user, whether he received the GPL-licensed code for free or for cost, to use the code however he likes, to redistribute the code, to modify the … Read more

Removing the default sidebar from admin panel

If you mean the default WordPress Widgets, you would add this to the functions.php file: <?php // unregister all default WP Widgets function unregister_default_wp_widgets() { unregister_widget(‘WP_Widget_Pages’); unregister_widget(‘WP_Widget_Calendar’); unregister_widget(‘WP_Widget_Archives’); unregister_widget(‘WP_Widget_Links’); unregister_widget(‘WP_Widget_Meta’); unregister_widget(‘WP_Widget_Search’); unregister_widget(‘WP_Widget_Text’); unregister_widget(‘WP_Widget_Categories’); unregister_widget(‘WP_Widget_Recent_Posts’); unregister_widget(‘WP_Widget_Recent_Comments’); unregister_widget(‘WP_Widget_RSS’); unregister_widget(‘WP_Widget_Tag_Cloud’); unregister_widget(‘WP_Nav_Menu_Widget’); } add_action(‘widgets_init’, ‘unregister_default_wp_widgets’, 1); ?> EDIT: register_sidebar(array(‘name’=>’sidebar2’, ‘before_widget’ => ‘<ul><li>’, ‘after_widget’ => “</li></ul>”, ‘before_title’ => ‘<h2 class=”widgettitle”>’, … Read more

How do I get a parent theme modification from a child theme?

If you look at how the code works, you should notice that theme mods are saved in the *_options table under theme_mods_{theme_slug} with the theme slug being, as near as I can tell, the directory name containing the theme stylesheet, so: $ptheme = get_template_directory(); $theme_slug = basename($ptheme); $mods = get_option( “theme_mods_$theme_slug”); As a function: function … Read more

Theme Demo in live Site

Drop this inside a .php file in in wp-content/mu-plugins: add_filter(‘template’, ‘check_for_theme_preview’); add_filter(‘stylesheet’, ‘check_for_theme_preview’); // if you want to display the theme selector // (this is wrong, you need a custom action in each of your themes, after <body>) add_action(‘wp_head’, ‘display_template_selector’); // checks for the “theme-preview” argument, and changes the template function check_for_theme_preview($template){ session_start(); if(isset($_SESSION[‘template’])) $template … Read more