Get main term from a sub term in Woocommerce

code function wc_origin_trail_ancestor( $link = false, $trail = false ) { if (is_product_category()) { global $wp_query; $q_obj = $wp_query->get_queried_object(); $cat_id = $q_obj->term_id; $descendant = get_term_by(“id”, $cat_id, “product_cat”); $descendant_id = $descendant->term_id; $ancestors = get_ancestors($cat_id, ‘product_cat’); $ancestors = array_reverse($ancestors); $origin_ancestor = get_term_by(“id”, $ancestors[0], “product_cat”); $origin_ancestor_id = $origin_ancestor->term_id; $ac = count($ancestors); } else if ( is_product() ) { … Read more

Custom Taxonomy terms with latest post ordered by date pagination issue

to change the number of posts per page you can do it in the wp dashboard like in this picture This function on functions.php works for me function tcPostsPerPage( $query ) { if (is_home()){$query->set(‘posts_per_page’, 6);} if (is_archive()){$query->set(‘posts_per_page’, 6);} } add_action( ‘pre_get_posts’, ‘tcPostsPerPage’ ); the two 6 is limiting to 6 per page, if this doest … Read more

Contact Form 7 – Populating dropdown list with terms relative to the post

Use the dynamic_dropdown tag functionality offered by the Smart Grid layout extension. The dynamic tag can take 3 sources of data (a given taxonomy, or branch within that taxonomy, a list of post titles, or the results of a filtered hook function). Use the filter hook to populated your dropdown as, add_filter(‘cf7sg_dynamic_dropdown_custom_options’, ‘filter_options’,10,3); function filter_options($options, … Read more

Problem with query_posts for a custom taxonomy in theme options

I see three things. if ( function_exists( ‘of_get_option’ ) ) : query_posts( ‘cat=” . $homepage_feature = of_get_option( “homepage_feature’ ) . ‘&posts_per_page=3’ ); You have a syntax error. There is no endif;. Maybe that is a typo, but maybe not. If you are trying to write a one-line if, remove the colon. Your title states “custom … Read more

Display custom taxonomy for product

Instead of using wp_tag_cloud pls try this in product page <?php $terms = get_the_terms( $post->ID , ‘city’ ); foreach ( $terms as $term ) { $term_link = get_term_link( $term, ‘city’ ); if( is_wp_error( $term_link ) ) continue; echo ‘<a href=”‘ . $term_link . ‘”>’ . $term->name . ‘</a>’; } ?>

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