How to reset the plugins without deactivate the plugin

You could make another function with will (re)set the default option values: function wpse_91307_set_option_defaults() { $options = array( ‘ptechsolcopy_notice’ => ‘Copyright ©’, ‘ptechsolcopy_reserved’ => ‘All Rights Reserved’ ); foreach ( $options as $option => $default_value ) { if ( ! get_option( $option ) ) { add_option( $option, $default_value ); } else { update_option( $option, $default_value … Read more

How do I rename a category in the menu bar only?

Actually this is pretty simple and straightforward: when you set up your menu (under Appearance > Menu) you will find out you can add Categories there. After adding them, click on the down-pointing arrow on the right of the navigation element, it will give you the possibility to change the Label, while keeping the Original … Read more

wp-load.php redeclares classes

The problem happens when you have a function declared in the root file of the plugin or in the functions.php file of a theme. You need to require_once a file for functions and move those functions into that file. For example: Your plugin is called some-plugin and the root file is some-plugin.php. Any function on … Read more

Change the style of h1, h2, only in post entry

You can change the styling of the editor content with your own CSS stylesheet via the add_editor_style function: function wpa_add_editor_styles() { add_editor_style( ‘custom-editor-style.css’ ); } add_action( ‘init’, ‘wpa_add_editor_styles’ ); Then in your stylesheet, add your rules: body#tinymce.wp-editor h1 { font-size: 50%; }

Use different single.php file based on condition

In a previous edit you used: if (in_category(’21’)) { include (TEMPLATEPATH . ‘/single-21.php’); } else { include (TEMPLATEPATH . ‘/single-29.php’); } This is part of your solution, but before I continue, some important notes: Don’t use include like that, instead get_template_part(‘single-21’); works better Indent correctly This clashes with how IDs work in the template heirarchy. … Read more

Use conditional logic for woocommerce variable product

Late to the party but here you go: <?php if( $product->is_type( ‘simple’ ) ){ // a simple product } elseif( $product->is_type( ‘variable’ ) ){ // a variable product } // If you need a Product object for the above: $product = new WC_Product( get_the_ID() ); Found it here: https://gist.github.com/patrickgilmour/9d4a28b4a2f0c1dcecbf and here https://wordpress.org/support/topic/condition-to-check-if-product-is-simple-or-variable. I’m glad this … Read more