New answers tagged

0

The code shown isn't working as wished, what is wrong? you're using only the first tag : $first_tag = $tags[0]->term_id; to grab posts from all tags you have to iterate the whole array until a max of 5. The code below ( untested) grabs a max of 25 posts theoretically using up to 5 tags..BUT if you have 25 posts belonging to the first tag you will have ...


1

On your code, the function wp_get_post_terms() return an array of WP_Term objects, so you can't access directly to an object property without specifying an index for the array like : $terms[0]->slug Otherwise, you should iterate through the whole array of terms and retrieve the slug into an another array, like : $terms = wp_get_post_terms( $post_id, ...


2

The do_shortcode() function is currently in the foreach loop. I don't know what are the parameters of this shortcode , but if it accepts comma separated values of term slugs: $terms = get_the_terms( $post->ID , 'shoptype' ); $i=1; $commaSeparatedvalues=""; foreach ( $terms as $term ) { $term_link = get_term_link( $term, 'shoptype' ); if( ...


0

Same issue as the OP. As @sviriden noted in his answer, the problem is that the main query is not including your custom post type in the wp_posts.post_type IN clause. I tracked down the issue in class-wp-query.php to these lines: if ( 'any' == $post_type ) { $in_search_post_types = get_post_types( array( 'exclude_from_search' => false ) ); ...


0

This is an idea But I did it thinking of ordering a listing on the front end You need to change the table "{prefix}term_taxonomy", creating the "term_order" field. See the function O_term_update_db(): In your function.php <?php function O_term_update_db(){ global $wpdb; global $term_db_version; $term_db_version = "1"; $...


Top 50 recent answers are included