Hot answers tagged

2

'the_post_navigation'. It seems to work for Custom Post Types (CPTs) but I cannot figure out how it does this. the_post_navigation() uses get_the_post_navigation() which uses get_previous_post_link() and get_next_post_link() which both uses get_adjacent_post_link() which uses get_adjacent_post() to get the next and previous post from the same post type. ...


1

Try this: <?php $object = 'post'; $output = 'objects'; $taxonomies = get_object_taxonomies( $object, $output ); $exclude = array( 'post_tag', 'post_format' ); if ( $taxonomies ) { foreach ( $taxonomies as $taxonomy ) { if( in_array( $taxonomy->name, $exclude ) ) { continue; } $terms = get_terms( array( ...


1

First, I'd extract all the slugs of the recommended colour terms with something like this: $recommended_colours = wp_get_post_terms($post->ID, 'recommended_colours'); $recommended_colour_slugs = array_map(function($colour) { return $colour->slug; }, $recommended_colours); ... which leaves you with a $recommended_colour_slugs array that looks ...



Only top voted, non community-wiki answers of a minimum length are eligible