Tag Info

New answers tagged

0

The previous answer is not working for me and I think it can not work for most people. Even if it works for someone, it overrides the WordPress configuration site-wide and it is not specific for the required custom post type. For me, the correct way to enable comments in a custom post type and remove the comments status meta box is something like this ...


0

Place this function in your functions.php: function adjacent_post_by_category( $category, $direction, $content ) { // Info $postIDs = array(); $currentPost = get_the_ID(); // Get posts based on category $postArray = get_posts( array( 'category' => $category, 'orderby'=>'post_date', 'order'=> 'DESC' ...


0

Unfortunately webtoure's solution didn't work so i decided to dive into Wordpress's database structure and came up with the following working code: global $wpdb; $taxonomy = 'country'; $environment = 0; function _get_term_taxonomy_id($term_id){ global $wpdb; $results = $wpdb->get_results(" SELECT tt.term_taxonomy_id FROM ...


0

Can't you just use this: <?php the_tags( '<span class="tags">', ', ', '</span>' ); ?> https://codex.wordpress.org/Function_Reference/the_tags get_terms gives you all the tags from your site I think.


0

Use the Co-Authors Plus to assign the authors and the post will show automatically on both author pages. I've used it and works pretty well.


0

You can use the template functions given by Co-Authors Plus plugin such as, coauthors_posts_links() - Co-Authors Plus equivalent of the_author_posts_link() template tag. coauthors() - Co-Authors Plus equivalent of the_author() template tag. Please refer to their documentation


0

Ok I finally notice what is it that I have to do! :D The variable was already set in the array in the shortcode atts. All I had to do was set the parent=$category in the before the filter: $terms = get_terms('cat_portfolio', array('hide_empty'=> true, 'parent'=> $category)); For wordpress developers maybe this is very easy but I am learning. Hope ...


3

I use template_redirect hook for this purpose. I suppose rented in your question is not taxonomy itself, but one term of some taxonomy. function my_page_template_redirect() { if( is_singular( 'rentals' ) && has_term('rented', 'your taxonomy name') ) { wp_redirect( home_url(), 301 ); exit(); } } add_action( ...


0

If I'm understanding your requirement correctly, then the least painful way to do this is with the Term Management Tools plugin. You can reorganize your terms in the admin interface once imported. EDIT: turns out I didn't understand your requirements correctly :)


0

If you just want to list them you can use the get_terms function: $terms = get_terms( 'my_taxonomy' ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ echo '<ul>'; foreach ( $terms as $term ) { echo '<li>' . $term->name . '</li>'; } echo '</ul>'; } Read the codex, it has a lot of examples: ...


1

There are quite a few steps involved here and also, with that 5000 posts figure you are mentioning, this will be an expensive task to do it through WordPress itself. However, here is what I came up with (I haven't tested this so you may wish to use it on a backup first and see if it works): global $wpdb; /* The ( 'from_term_id', 'to_term_id' ) map. */ ...


1

Strictly regarding your question: get_object_taxonomies( 'user' ); since user is the $object_type that it is used when the author registers the taxonomy.


1

Okay, I managed to track down the answer, with help from the "Debug This" plugin and investigating the coding of the "Beautiful Taxonomy Filters" plugin. So far as I can find, Wordpress saves full details (including Title, ID and Slug) of only the first taxonomy and first term queried. For any additional terms or taxonomies queried, Wordpress saves only ...


0

I have finally been able to come up with a solution based on some help from my more MySQL oriented question at Stack Overflow: add_filter( 'posts_fields', 'posts_fields' ); function posts_fields( $fields ) { if ( ( is_woocommerce() || is_search() ) && ! is_admin() ) { $add = " , CASE wt.slug WHEN 'antique' THEN ...


0

The easiest way would be to install the Yoast SEO plugin then in your wp-admin go to SEO -> Titles & Meta -> Taxonomies and click 'no index, follow' next to the ones you don't wish to be indexed. Edit: Sorry, slightly confused. Your taxonomy pages have two urls? is that it?


0

This should works. $args = array( 'taxonomy' => 'your_taxonmy_name', // replace with your taxonomy name ); $categories = get_categories( $args ); $ids = array(); // lets get all post IDs foreach ( $categories as $category ) { $args = array( 'cat' => $category->term_id, 'post_type' => 'homepage', // your post type ...



Top 50 recent answers are included