How to Filter Posts by Custom Fields?

Since you have not provided any code, below code snippet assumes a ‘property’ as post type and price as meta field. I think the code will provide you some direction and you can take it from there. Feel free to make changes as needed: $args = array(‘post_type’ => ‘property’, ‘meta_key’ => ‘price’, ‘orderby’ => ‘meta_value’, … Read more

Genesis filterable portfolio isotope [closed]

The archive or taxonomy code: add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ ); wp_enqueue_script(‘isotope’, get_stylesheet_directory_uri() . ‘/js/jquery.isotope.min.js’, array(‘jquery’), ‘1.5.25’, true); wp_enqueue_script(‘isotope_init’, get_stylesheet_directory_uri() . ‘/js/isotope_corsi.js’, array(‘isotope’), ”, true); wp_enqueue_style(‘isotope_css’, get_stylesheet_directory_uri() . ‘/css/isotope_corsi.css’); //* Add custom body class add_filter( ‘body_class’, ‘filerable_portfolio_add_body_class’ ); //* Filterable Portfolio custom body class function filerable_portfolio_add_body_class( $classes ) { $classes[] = ‘filterable-portfolio-page’; return $classes; } remove_action( ‘genesis_loop’, … Read more

Archive for custom taxonomy lists all posts instead of current taxonomy

You have a syntax error in your query. According to the documentation for WP_Query, tax_query is an array of arrays of parameters, which is to say that it should probably look like this: ‘tax_query’ => array( array( ‘taxonomy’ => ‘semester’, ‘field’ => ‘slug’, ‘terms’ => $getterm, ‘include_children’ => true, ‘operator’ => ‘IN’ ), ),

Custom Post Type / Two level deep taxonomy (cat. and subcat.) uri problem (error 404)

After many headaches, I’ve spent days and hours finding a solution. I’ve find a solution for two problems commented above. I hope it helps to someone: PROBLEM 1: I realized that when I changed Permalink to Plain (wordpress admin > settings > permalink > Plain) and when I click in Breadcrumb link “iluminacion interior” it … Read more

Retrieve value of a category’s custom field

http://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/ prety much covers what you’re after I believe. So in your example while ( $projects->have_posts() ) { $projects->the_post(); $category_classes = array(); $categories = get_the_terms( get_the_ID(), ‘project_category’ ); if ( $categories ) { foreach ( $categories as $category ) { $categories_included[] = $category->term_id; $color = get_field(‘color’, ‘project_category_’.$category->term_id); } } You can also pass a term … Read more

I used the Tax-meta-class by bainternet but i still can’t get it to display any of the results.

There’s a slight catch to using bainternet’s Tax Meta Class: the way you save and retrieve data changes depending on your WordPress version. If you are using the latest version of WordPress then use get_term_meta instead of get_tax_meta. https://github.com/bainternet/Tax-Meta-Class/issues/115#issuecomment-170365995 I believe the exact version is WordPress 4.4. If your WP version is before 4.4, use … Read more

Get posts by name and taxonomy term

Note that if you have the post slug, you don’t need the additional taxonomy query to find that post, so it makes sense to drop the expensive taxonomy query in core in that case. Otherwise you could try instead the post_name__in parameter: [ ‘post_name__in’ => [ ‘<postslug>’ ], ‘tax_query’ => [ [ ‘taxonomy’ => ‘<taxonomy>’, … Read more

Insert terms for custom taxonomy on plugin activation, or each page load (init hook)

50 is relatively not much, and you should create them on the plugin activation hook. For more then 100 (just pulled the number out of my ass 😉 do your own testing on some slow shared hosting) I would create a settings page and initialize the DB from there. The reason is that users do … Read more