Adding new divs with custom classes to products on WooCommerce shop page [closed]

Why not edit the template file instead of using hooks? https://github.com/woocommerce/woocommerce/blob/3.8.0/templates/content-product.php This template can be overridden by copying it to yourtheme/woocommerce/content-product.php. A small example <li <?php wc_product_class( ”, $product ); ?>> <div class=”col-md-5 offset-md-1″> <?php /** * Hook: woocommerce_before_shop_loop_item. * * @hooked woocommerce_template_loop_product_link_open – 10 */ do_action( ‘woocommerce_before_shop_loop_item’ ); /** * Hook: woocommerce_before_shop_loop_item_title. * * … Read more

WordPress plugin blog creation

pluginprefix_setup_post_type() is a method inside the SoaneNews class, not a function, but inside your activate() method you’ve called a function with that name: function activate(){ pluginprefix_setup_post_type(); flush_rewrite_rules(); } To call the pluginprefix_setup_post_type() method from within the class, you need to do it like this: $this->pluginprefix_setup_post_type();

Enqueue script only on child pages of custom post types

Issues The code you shared has some issues: First of all calling a function like this won’t work on the bootstrapping process of the WordPress and can’t get necessary values where and when necessary, so the conditions might not work as you expected. Solution: Hook the function to an appropriate hook, and wp_enqueue_scripts is such … Read more