i want add conditional for add category in wordpress

If I understood your question correctly, then something like this might do the trick. // html markup for the selects <select name=”main_cat”> <option value=”A”>A</option> <option value=”B”>B</option> </select> <select name=”sub_cat_for_A” class=”sub-cat-select hidden”> <option value=”C”>C</option> <option value=”D”>D</option> <option value=”E”>E</option> </select> <select name=”sub_cat_for_B” class=”sub-cat-select hidden”> <option value=”F”>F</option> <option value=”G”>G</option> <option value=”H”>H</option> </select> If you change your mind and … Read more

Updating WooCommerce product field when product author updates profile field

So combined with that code for setting the value before it’s inserted in the db, you also need to add this code to add the post ID to an array stored in the user’s meta (after it has been updated): add_action( ‘wp_insert_post’, ‘smyles_update_user_products’, 10, 3 ); function smyles_update_user_products( $post_ID, $post, $update ) { if ( … Read more

Adding a second button next to the shop button Woocommerc [closed]

Code is tested with 2019 theme. Open the functions.php file of your active theme and drop this code at end of the file. add_action( ‘woocommerce_after_shop_loop_item’, ‘wpse2019_add_pdf_download_button’, 10 ); function wpse2019_add_pdf_download_button() { global $product; if( $product ) { printf( ‘<a href=”https://wordpress.stackexchange.com/questions/329837/%s” class=”pdf-button button btn” role=”button”>%s</a>’, “YOUR PDF LINK HERE”, __( ‘DWONLOAD PDF’, ‘text-domain’ ) ); } … Read more

Clickable product image with hover effect

You can use some Javascript to trigger the click. For example: $(‘.product-thumb’).click(function(event) { var product_link = $(this).find(‘product-thumb-primary a’); // Don’t trigger a click on the existing link if(!event.target.href && product_link.length) { document.location.href = product_link.attr(‘href’); } }); Un-tested but that’s the basic logic.

Merge “description” and “additional informations” product tab

The callback used to render the “Description” tab is woocommerce_product_description_tab(), which simply loads the template file single-product/tabs/description.php. And for the “Additional Information” tab, the callback is woocommerce_product_additional_information_tab() and the template is single-product/tabs/additional-information.php. So if you want to merge the two tabs, you can copy the “relevant” contents from the template file, like so: add_filter( ‘woocommerce_product_tabs’, … Read more