Get ID and slug from taxonomy object

It sounds like you’re looking for the get_term_link() function. Your code will look something like this: <?php $catid = get_sub_field(‘selected_category’); $term_link = get_term_link( intval( $catid ), ‘product_cat’ ); ?> <h4><a href=”https://wordpress.stackexchange.com/questions/95584/<?php echo esc_url( $term_link ); ?>”><?php the_sub_field(‘title’); ?></a></h4> As you can see, get_term_link() takes two argument, the term and taxonomy. If you’re saving the term … Read more

Extending wordpress search to include excerpts and taxonomies?

With WordPress 4.2.2 I’m using the following (admittedly fragile) method to search excerpts as well as the content and title without a plugin. This is the relevant snippet from functions.php. add_filter(‘posts_where’, ‘custom_posts_where’); function custom_posts_where($where) { if (is_search()) { $where = preg_replace( “/(\w+).post_title LIKE (‘%.*?%’)/”, “$1.post_title LIKE $2) OR ($1.post_excerpt LIKE $2”, $where); } return $where; … Read more

How to add custom field to custom taxonomy in 4.4

You can implement this in two ways to add meta boxes through plugin or wordpress predefined hooks https://wordpress.org/plugins/taxonomy-metadata/ **OR** Add the following code in functions.php in your theme function mj_taxonomy_add_custom_meta_field() { ?> <div class=”form-field”> <label for=”term_meta[class_term_meta]”><?php _e( ‘Add Class’, ‘MJ’ ); ?></label> <input type=”text” name=”term_meta[class_term_meta]” id=”term_meta[class_term_meta]” value=””> <p class=”description”><?php _e( ‘Enter a value for this … Read more

Woocommerce custom taxonomies page

After digging all over the place, it really was as simple as adding theme support. Go figure, just add the following: //Adding theme support function mytheme_add_woocommerce_support() { add_theme_support( ‘woocommerce’ ); add_theme_support( ‘wc-product-gallery-zoom’ ); //Only if want woocommerce built in add_theme_support( ‘wc-product-gallery-lightbox’ );//Only if want woocommerce built in add_theme_support( ‘wc-product-gallery-slider’ );//Only if want woocommerce built in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)