Save selectlist value (taxonomy) in wp:wp_set_object_terms

solved it so: $part_brand = get_terms(‘brands’, ‘hide_empty=0′); <label for=”part_brand”>Бренд</label> <select name=”part_brand” id=’part_brand’> <option value=”” <?php **$brand_names = wp_get_object_terms($post->ID, ‘brands’);** if (!count($brand_names)) echo “selected”; ?>>None</option> <?php foreach($part_brand as $brand) { if (!is_wp_error($brand_names) && !empty($brand_names) && !strcmp($brand->slug, $brand_names[0]->slug)) echo “<option value=”” . $brand->slug . “” selected>” . $brand->name . “</option>\n”; else echo “<option value=”” . $brand->slug . … Read more

How to use PHP code with wordpress page

The best way to create dynamic data outputs really depends on the what, why, and how. For example, if you’re creating a theme that creates its own custom post type, say, to store information about the head honchos that run the business behind the site, then just create a “single-$CPTNAME.php” template that has the code … Read more

Hide cart when empty [closed]

Just add another AND (&&) clause to the end of it. <?php if ( is_woocommerce_activated() && isset( $woo_options[‘woocommerce_header_cart_link’] ) && ‘true’ == $woo_options[‘woocommerce_header_cart_link’] && sizeof( $woocommerce->cart->cart_contents ) !== 0) {…} Probably best to take a look at some of the PHP tutorials or documentation around as you will be coming up against this type of … Read more