Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?

The cart widget isn’t showing because it’s configured to not show on the cart and checkout page. If you want to change that take a look at class-wc-widget-cart.php, there you find the following line: if ( is_cart() || is_checkout() ) return; Change it to: if ( is_cart() ) return; To show the widget on the … Read more

Change capability type of post type registered by plugin

@PieterGoosen is cool, and still awake like me and answering like boss. To simplify his code and make it work to this specifically without a bunch of junk on your page: /** * Pieter Goosen writes awesome code */ add_filter( ‘register_post_type_args’, ‘change_capabilities_of_the_custom_css_js_posttype’ , 10, 2 ); function change_capabilities_of_the_custom_css_js_posttype( $args, $post_type ){ // Do not filter … Read more

Run WP-CLI using PHP

Regarding the wp –info output, that makes sense. If you don’t have any packages installed (see wp package –help or a global configuration files (wp-cli.yml) then those items would be blank. You can run the wp command from any location. If you’re anywhere within your website’s folder structure it will automatically detect the site you’re … Read more

Make thumbnails in woocommerce replace the main image instead of opening fancybox

I have just achieved the effect by my own. I will post it here in case others find this thread: jQuery(document).on(‘click’,’.thumbnails .zoom’, function(){ var photo_fullsize = jQuery(this).find(‘img’).attr(‘src’).replace(‘-100×132’,”); jQuery(‘.woocommerce-main-image img’).attr(‘src’, photo_fullsize); return false; }); .replace(‘-100×132’) eliminates the size from url of the image to return the full image and not the thumbnail. Replace it with your … Read more

Sell one unique item with Woocommerce? [closed]

This should be possible with the built-in features of WordPress. In your WooCommerce Settings, in the Inventory tab, enable Stock Management. Then, when you create or edit a product, select the Inventory tab in the Product Data section and enable stock management for that product. You will then be able to set a stock quantity … Read more

Creating a WordPress admin page without a menu for a plugin

I am less convinced that I know what you are doing than I once was. // Add menu and pages to WordPress admin area add_action(‘admin_menu’, ‘myplugin_create_top_level_menu’); function myplugin_create_top_level_menu() { // This is the menu on the side add_menu_page( ‘MyPlugin’, ‘MyPlugin’, ‘manage_options’, ‘myplugin-top-level-page’ ); // This is the first page that is displayed when the menu … Read more

How do I make my plugin load before the headers are output so I can redirect wordpress?

The correct hook to use is template_redirect which allows you to have the necessary info available to do checks while also early enough to actually redirect. As per the example on the codex page: function my_page_template_redirect() { if( is_page( ‘goodies’ ) && ! is_user_logged_in() ) { wp_redirect( home_url( ‘/signup/’ ) ); exit(); } } add_action( … Read more