Create a custom taxonomy template that loops through child categories in term order?

Here’s what we’ve come up with so far, and there’s definitely room for improvement. remove_action( ‘genesis_loop’, ‘genesis_do_loop’ ); add_action( ‘genesis_loop’, ‘ahso_custom_taxonomy_archive_loop’ ); function ahso_custom_taxonomy_archive_loop() { global $wp_query; // globalize it. // get category ID $cat_id = $wp_query->get_queried_object_id(); // get current category // get all child categories $cat_args = array( ‘type’ => ‘products’, ‘child_of’ => $cat_id, … Read more

Saving meta box data?

What you are trying to do is not going to work the way you are trying to do it because on post save WordPress will process the data and then redirect back to the originating page. That means that any global you set before the redirect isn’t going to be there afterwards. However, your custom … Read more

Single.php for Custom Post Type > Taxonomy > Term

You can load a different template for single posts via the single_template filter. Just use the has_term() function to check if the post has a specific term in your custom taxonomy. function wpa_107626_single_template( $single_template ) { // check if the post fits some condition if ( has_term( ‘term1’, ‘film_cat’ ) ) { $single_template = get_stylesheet_directory() … Read more

Add filter to Admin list for all custom post types by their custom taxonomies

I found a code which work only with single taxonomy and modified it. add_action( ‘restrict_manage_posts’, ‘my_restrict_manage_posts’ ); function my_restrict_manage_posts() { global $typenow, $post, $post_id; if( $typenow != “page” && $typenow != “post” ){ //get post type $post_type=get_query_var(‘post_type’); //get taxonomy associated with current post type $taxonomies = get_object_taxonomies($post_type); //in next loop add filter for tax if … Read more

Query Custom Post by taxonomy multiple categories

This should give you an OR relationship: $args[‘tax_query’] = array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘id’, ‘terms’ => array(1,2), ‘operator’ => ‘IN’ ) ); As would this: $args[‘tax_query’] = array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘project-type’, ‘field’ => ‘id’, ‘terms’ => array(1) ), array( ‘taxonomy’ => ‘project-type’, ‘field’ => ‘id’, ‘terms’ => array(2) … Read more

How to add href=”” custom post type?

this would help you do that.. http://wordpress.org/plugins/advanced-custom-fields/ then you can set up the custom field to only show on cptbc_post_type only.. on the template you can then get the value you set on the admin like this: <a href=”https://wordpress.stackexchange.com/questions/108258/<?php echo get_field(“field_name’, $post->ID);?>”>Link</a>

Update custom field value

Something like this should do: function track_editor_wpse_108606() { if (is_single()) { $current_user = wp_get_current_user(); if (user_can( $current_user, ‘editor’ )) { global $post; $current = get_post_meta($post->ID,’editor_tracker’,true); $current = (!empty($current)) ? $current + 1 : 1; update_post_meta($post->ID,’editor_tracker’,$current); } } } add_action(‘wp_head’,’track_editor_wpse_108606′); This is not especially efficient. You are reading and writing to the database for these page … Read more