Formulate a url to show posts with both taxonomy terms

Looks like you can define the AND logical operator with the URL parameters, specifically adding the “+” between your terms like this: url?taxonomy=term1+term2 This will ensure that only posts containing all terms listed are returned. Example: https://example.com/blog?food=sauce+cheese [tax_query] => WP_Tax_Query Object ( [queries] => Array ( [0] => Array ( [taxonomy] => food [terms] => … Read more

List a current posts’ taxonomy terms in a widget in WordPress

This is a simple conversion of the Taxonomy terms list plugin to a widget: class WPSE_5394_Widget extends WP_Widget { public function __construct() { parent::__construct( ‘wpse5394_widget’, ‘Taxonomy Terms List’ ); } public function widget( $sidebar_args, $widget_options ) { if ( ! is_single() ) { // I don’t think we can display anything sensible on a page … Read more

List Terms in Category

Since you are in a category the your query will get the posts of that category, you only need to add ‘posts_per_page’ => -1 to that query so it will get you all the posts in that category and not the default “at most” number. so something like: query_posts( $query_string . ‘&posts_per_page=-1’ ); this will … Read more

How to create new category for custom post type?

You could create a taxonomy called Job Types and your terms would be PHP Jobs etc. In your register post type function change: ‘taxonomies’ => array( ‘post_tag’, “category”), to ‘taxonomies’ => array(‘job_types’), add_action(‘init’ , ‘c3m_job_taxonomis’ ); function c3m_job_taxonomies() { $labels = array( ‘name’ => _x( ‘Job Types’, ‘taxonomy general name’ ), ‘singular_name’ => _x( ‘Job … Read more

How to list 2 taxonomy terms for a post, based on their hierarchy

I managed to hack this together using wp_get_object_terms. The ‘orderby’ => ‘term_id’ was most helpful. It’s probably not the best method, but seems to work fine. Because the child terms (suburbs) are always created after the parent terms (Cities), they will always have a higher ID. <?php $terms = wp_get_object_terms($post->ID, ‘location’, array(‘orderby’ => ‘term_id’, ‘order’ … Read more

WordPress as thesaurus/dictionnary: what approach?

I would create custom post types and custom taxonomy, taking the standard “Posts” out of the loop. You can then have two separate Taxonomies (Tag systems) for synonyms and antonyms. http://codex.wordpress.org/Post_Types http://codex.wordpress.org/Taxonomies You can then use a plugin like Gravity Forms to have your users register for the site and submit their words, which can … Read more

How do I query a taxonomy term range

You could take the query var and programatically expand the numbers between your minimum value and maximum value. Assuming http://tax.jenswedin.com/age/10,20/ is rewritten to http://tax.jenswedin.com/?age=10,20, then (pseudo code) $parts = explode(get_query_var(‘age’), ‘,’); $min_val = $parts[0]; // Should be 10 in this example $max_val = $parts[1]; // Should be 20 in this example $range = range($min_val, $max_val); … Read more

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