Display multiple taxonomies in a function
Display multiple taxonomies in a function
Display multiple taxonomies in a function
If I try to add &posts_per_page=15 to url, it doesn’t work: it won’t change number of post. I wonder if you’re looking for a custom query variable, e.g. ppp, to change the number of posts for the main query: add_filter( ‘query_vars’, function( $vars ) { $vars[] = “ppp”; return $vars; } ); add_action( ‘pre_get_posts’, function( … Read more
You can check if term exists, see here add_action( ‘woocommerce_before_single_product’, ‘display_category_list’,20 ); function display_category_list() { global $post; $term = ‘term_name’; // Term name string or array $taxonomy = ‘product_cat’; // your taxonomy if( has_term($term, $taxonomy, $post) ){ // if post belongs to term(s) wc_get_template( ‘woocommerce/single-product/single-product-top- content.php’ ); } }
Based on your code, if the url is: http://example.com/page/?eth=1&t=1 Then the resulting query will be: $tax_query_args = array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘filters’, ‘field’ => ‘slug’, ‘terms’ => array( ”, ‘twitter’, ”, ”, ”, ”, ”, ”, ”, ” ), ‘operator’ => ‘IN’ ), array( ‘taxonomy’ => ‘platform’, ‘field’ => ‘slug’, ‘terms’ => … Read more
How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
That’s quite possible by changing add_permstruct or filtering rewrite_rules. But what is your strategy for generating links for city? How will implement second taxonomy? I would go for implementing this as rewrite rule for something like add_filter( ‘rewrite_rules_array’, function( $rules ) { global $wp_rewrite; $new_rules = array( ‘(company|profession)/([^/]+)/([^/]+)/?$’ => ‘index.php?$matches[1]=$matches[2]&city=$matches[3]’ ); $rules = array_merge($new_rules, $rules); … Read more
The rewrite rules to resolve these requests are fairly simple: function wpd_property_rules(){ add_rewrite_rule( ‘property-city/([^/]+)/([^/]+)/page/?([0-9]{1,})/?$’, ‘index.php?property_city=$matches[1]&property_type=$matches[2]&paged=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘property-city/([^/]+)/([^/]+)/?$’, ‘index.php?property_city=$matches[1]&property_type=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘wpd_property_rules’ ); There are a couple of problems though. You’ll need to generate these links somehow, but there’s no relationship between two taxonomies except by looking at all posts to … Read more
There’s a few things wrong with your code here. Your call to the function has the parameters mixed up. $args are passed first to the function but in your function definition they are expected to be passed second. The typo that you’ve fixed of $argo to $args In your functions foreach loop you’re generating a … Read more
register_taxonomy_for_object_type (images) : how to use it ?
function link_words( $text ) { $replace=””; $tags = get_the_tags(); $count=0; if ( $tags ) { foreach ( $tags as $tag ) { $count++; echo $sep . ‘<a href=”‘.get_tag_link($tag->term_id).'”>’.$tag->name.'</a>’; $sep = ‘, ‘; if( $count > 2 ) break; } } } add_filter( ‘the_content’, ‘link_words’, 10, 1 ); Check this.