Add custom ID attribute to all woocommerce products on archive pages

Copy /woocommerce/templates/content-product.php to /yourtheme/woocommerce/content-product.php and modify it as needed. In this case, we can change the opening <li> tag from this: <li <?php post_class(); ?>> to this: <li <?php post_class(); ?> id=”<?php echo esc_attr( ‘post-‘ . get_the_ID() ); ?>”> The updated content-product.php file will look like this: <?php /** * The template for displaying product … Read more

Conditional Fields depending on checkboxes

I’ve written something very similar with Contact Form 7. Instead of a Country -> City relation, the relation is Car make -> Car model -> car year. https://bdwm.be/how-to-create-dynamically-populated-cascading-dropdown-lists-for-contact-form-7/ You could start from a CSV file that looks like this: Country, City Germany, Berling Germany, Stuttgart China, Peking … Then create a contact form like this … Read more

Displaying Children of several pages

This is a working code. If you place the code in proper place it will surely gonna work [inshALLAH]. You can use this as a function or even shortcode. global $post; $parent_id = $post->ID; //if you are within a loop $childpages = new WP_Query([ ‘post_type’ => ‘page’, ‘post_parent’ => intval( $parent_id ), ‘posts_per_page’=> 3, // … Read more