How can I set up a category “overview” page?
There is no default rewrite to a template for a category or taxonomy landing page. You are correct, that this can be done by creating a custom template and applying it to a page.
There is no default rewrite to a template for a category or taxonomy landing page. You are correct, that this can be done by creating a custom template and applying it to a page.
Try hooking into the save_post action to check the custom terms when a post gets saved: add_action( ‘save_post’, ‘set_default_category’ ); function set_default_category( $post_id ) { // Get the terms $terms = wp_get_post_terms( $post_id, ‘your_custom_taxonomy’); // Only set default if no terms are set yet if (!$terms) { // Assign the default category $default_term = get_term_by(‘slug’, … Read more
It doesn’t have it wrapped inside a function you can use, but the following will work: $taxonomy = ‘my-taxonomy’; $taxonomy_object = get_taxonomy( $taxonomy ); $object_type = get_post_type($post_id); if ( $terms = get_the_terms( $post_id, $taxonomy ) ) { $out = array(); foreach ( $terms as $t ) { $posts_in_term_qv = array(); $posts_in_term_qv[‘post_type’] = $object_type; if ( … Read more
ok, this is my working solution: <?php $args=array( ‘post_type’ => ‘biblioteka’, ‘child_of’ => 0, ‘parent’ => ”, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ‘hierarchical’ => 1, ‘exclude’ => ”, ‘include’ => ”, ‘number’ => ”, ‘taxonomy’ => ‘kategoria-pozycji’, ‘pad_counts’ => false ); $categories=get_categories($args); foreach ( $categories as $category ) { if ( … Read more
I encountered a very similar situation, and I believe it may very well be the same situation you are experiencing. Please read the WPSE question Programmatically insert hierarchical terms & set terms for post causes glitch? and follow up with the answer provided by @Manny Fleurmond.
The only really interesting (and very important) part of the 3rd query is this: ‘project_location_children’, ‘a:7:{i:22;a:1:{i:0;i:23;}…etc…}}’ The a:n:{i:n; etc } stuff is a serialized PHP array. WordPress – for some historical reason – keeps track of term children in one option entry per taxonomy term. The painful thing is, that a lot of people don’t … Read more
WordPres has a function that extract IPTC info from images, that function is wp_read_image_metadata. That function is only available on admin side and, according with the codex, it doesn’t extract IPTC keywords. But you can use iptcparse from PHP at your own to extract IPTC keywords and set them as post tags. In your question, … Read more
try this.. $filter_terms = array(); foreach ($widget[‘select’] as $key => $name) { $filter_terms[$key] = get_term_by( ‘name’, $name, ‘portfolio-categories’); }
But when I try example.com/lesson I get page not found error. Like I pointed in my comment to your question, that’s actually how it works, where the term slug needs to be specified in the URL. That’s why example.com/lesson/english (term slug is english) and example.com/lesson/french (term slug is french) work, but not example.com/lesson (term slug … Read more
Your permalink structure for taxonomy will conflict with default one for pages. In the case of the address domain.com/item-one/item-two how does WordPress know if it’s a page item-two with the parent page item-one or item-two is custom post type and item-one is term of region taxonomy? The order of rewrite rules will decide, and because … Read more