Tag Info

New answers tagged

0

Since individual entries in taxonomies are terms, the template tag for displaying them, used between the_title() and the_content() hint-hint, would be the_terms() :)


2

Edit If this is your goal: I want to use the Wordpress gallery to show all pictures of one category in a gallery (on a fixed page), which I do not have to update all the time by inserting the pictures manually. Then the easiest way to accomplish it is via custom page template. Create the template Copy your page.php template file, and name it ...


0

Most probably the term was not found and $current_term returned as false: $current_term = get_term_by( 'slug', $term_slug, $taxonomyName ); $term_id = $current_term->term_id; According to the docs, get_term_by() return values are Term Row (object or array) from database. Will return false if $taxonomy does not exist or $term was not found. ...


1

Per the Codex: relation (string) - The logical relationship between each inner taxonomy array when there is more than one. Possible values are 'AND', 'OR'. Do not use with a single inner taxonomy array. So you are on the right track, but your tax_query is wrong. relation is part of the outer tax_query array and not part of the top level query ...


-1

Code is here: Wordpress chained categories I write the same code for categories. You can edit for your needs. I used the that js plugin: http://www.appelsiini.net/projects/chained


0

You can also append &posts_per_page=-1 to the query_string inside query_posts: if ( have_posts() ): query_posts($query_string.'&posts_per_page=-1'); while ( have_posts() ): the_post(); etc


0

I got it! The result will show all attachments in a specific term inside term's archive page. Thanks Chip! <?php $queried_object = get_queried_object(); $term_id = $queried_object->term_id; global $wp_query; $original_query['tax_query'] = array( array( 'taxonomy' => 't-arte', 'terms' => $term_id, 'field' => 'id', ),); $original_query ...


0

I think the problem is that you're passing the wrong arguments to the $attachments query, causing you not to get the intended posts in the $attachments query. Here's what you're doing: $args = array( 'post_status' => 'inherit', 'numberposts' => 0, 'post__not_in' => array_merge($do_not_duplicate,get_option( 'sticky_posts' )), ...


0

First of all note that a post can have more than one category, also posts can have no category, what you'll do in that cases? And what about post update? That said, if you look at the url when in edit.php and select a category by clicking on its name, you'll notice that the only thing that change in the url is that the param category_name is appended to ...


0

To guarantee that your taxonomy is never queried on the front end, you could strip it from all front end queries. add_action( 'pre_get_posts', function($qry) { if (is_admin()) return; $kill = 'genre'; // kill this taxonomy $tax_query = $qry->get('tax_query'); if (empty($tax_query)) return; $relation = false; if ...


1

Looking at your comment, photos and videos aren't custom post types but actually categories. I'm changing my answer to reflect your comment. You can use WP_Query to exclude specific categories in your loop. You can achieve that with $query = new WP_Query( 'cat=-1,-2,-3' ); This will exclude categories with ID's 1, 2 and 3, and will only show categories ...


2

Probably you're making a wrong use of taxonomies. Instead of using only the Categories taxonomy, you should create several Custom Taxonomies. I mean Blog Categories, Download Categories, Team Departments, etc... should be different taxonomies, and you should assing each of these taxonomies to the custom post type(s) they're related to... Check the function ...


6

Normally to add fields to quick edit field, we should use 'quick_edit_custom_box' action hook that is triggered only for custom colums, because core colums are explicitly exluded (see code). If we add a custom column, then it will be shown in the list table, but it doesn't make sense, because the column description is already present. However we have the ...


1

Totally untested and I'm not 100% sure I understand your question, but this should (in theory) get 5 posts that share any of the same venues as the current post. I would probably suggest adding some Transients to this so that you aren't constantly running queries. If it doesn't work, I suspect the syntax of my tax query is a little off. It always gets me ...


2

You are using wrong number of arguments in add_filter, you specified to get 2 arguments and you are looking for third one: Update your add_filter code to this: add_filter( 'manage_post_tag_custom_column' , 'my_custom_column' , 10 , 3 ); The 3 in the end tells the filter to provide all the three arguments to your function.


1

Probably post_status but this answer is probably irrelevant in your case. You have your own application with its own usage pattern of the DB therefor the assumptions used when designing wordpress DB for use by core might not fit you. Maybe you will need to add another index to the posts table, maybe create optimized table of your own. Caching is also an ...


-1

Try for example the get_term_by() function: $term = get_term_by('term_taxonomy_id', 123, 'category'); echo $term->name;


0

To use get_term_by we need the term object before it gets deleted. Therefore, we should use the action hook delete_term_taxonomy that runs before the term is deleted. Now, we can go ahead and perform some tasks such as deleting all the postmeta related to the term being deleted. The code is: add_action( 'delete_term_taxonomy', function($tt_id) { ...



Top 50 recent answers are included