Hot answers tagged

2

The get_adjacent_post() function has multiple arguments. The fourth and last one is the taxonomy, which per default is 'category': $post_prev = get_adjacent_post( true, '', true, 'product_cat' ); $post_next = get_adjacent_post( true, '', false, 'product_cat' );


2

You may need to include a tax_query for the Woocommerce taxonomy (called 'product_cat'): $tax_query = array( array( 'taxonomy' => 'product_cat' ), ); $query->set( 'tax_query', $tax_query ); } return $query; } However, you'll have to ensure that you can return posts AND pages AND product categories and also ...


2

If the code you have provided is the only code you are using to achieve what you want then thats incomplete code. Below is the tested version of code which works well. I hope this helps: /* Add the field to the checkout */ add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); function my_custom_checkout_field( $checkout ) { echo ...


2

Ok I found out the solution. Because, as I said, WooCommerce has it's own hooks, first of all I've searched for a WooCommerce hook about registration. I discovered the existence of a hook very similiar to the one used by WordPress: woocommerce_registration_errors. Obviously it works in the same way. Then I simply replaced the WordPress hook with the ...


2

Sorry I can not comment yet on this site Could you be removing an action before it is registered? Have you tried wrapping this with an on init hook? Perhaps using remove_filter would be a better choice. function my_init() { remove_filter( 'storefront_header', array( 'Galleria_Structure', 'galleria_top_bar_wrapper' ) ); remove_filter( ...


2

You can do in the following way! Create an array of CSS class names and message values $colors_stings = array( 'Message one' => 'message_color_green', 'Message two' => 'message_color_red', 'Message three' => 'message_color_blue' ); Check if message string exist in array then assign CSS color class to variable. $css_class = ...


2

As the keys already hold PHP generated output, it should be possible to simply wrap them in some MarkUp woocommerce_wp_select( array( 'id' => 'productstatus_select', 'label' => __( 'Product Status', 'woocommerce' ), 'options' => array( 'Message one' => sprintf( '<span ...


1

It's a bit hard to tell without knowing what shop theme you are using but I'll try anyways…  The code <?php wc_get_template_part( 'content', 'product' ); ?> is basically calling the template file content-product.php. I would however not recommend you alter the default file. On a standard woocommerce install you will find that default template file ...


1

The best practice for editing a Woocommerce theme is similar to Wordpress as you should use Hooks and Filters when possible. https://docs.woothemes.com/document/introduction-to-hooks-actions-and-filters/ But if you do need to edit a template Woocommerce outlines this on their website as well: https://docs.woothemes.com/document/template-structure/ You just ...


1

Customizer Controls can be displayed based on context. With active_callback API introduced in WordPres 4.0, you can control where to show your specific options. Add your customizer options like this with the optional active_callback argument. $wp_customize->add_control( 'wc_cart_page_option', array( 'label' => esc_html__( 'Cart Page Options' ...


1

You need first to buy WooCommerce Quick View plugin, because woocommerce lightbox plugin doesn't work without it. Please read this: Woocommerce single product show in modal…? And if you go to the wordpress page of woocommerce lightbox plugin, you will see that is a complementary plugin.



Only top voted, non community-wiki answers of a minimum length are eligible