Query Multiple Custom Post Types & Exclude a Taxonomy Term

You should have a look at the arguments of WP_Query. The following arguments should be what you need. Note that tax_query takes an array of arrays. $args = array( ‘post_type’ => array( ‘post’, ‘videos’, ‘music’ ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘content’, ‘field’ => ‘slug’, ‘terms’ => ‘indy’, ‘operator’ => ‘NOT IN’ ) ) … Read more

Excerpt length: get first paragraph

Assuming your paragraphs are marked with <p> tags, which can be set in the ACF field options, the following should work: function custom_field_excerpt() { global $post; $text = get_field(‘news’); if ( ” != $text ) { $start = strpos($text, ‘<p>’); // Locate the first paragraph tag $end = strpos($text, ‘</p>’, $start); // Locate the first … Read more

How can I add in post’s the text “No content”

add_filter( ‘the_content’, ‘check_empty_postcontent’, 0, 99 ); // filter post content add_filter( ‘the_excerpt’, ‘check_empty_postcontent’, 0, 99 ); // filter excerpt content function check_empty_postcontent( $content ) { global $post; $post_type = get_post_type( $post->ID ); return ( empty( $content ) && ‘seriale’ === strtolower( $post_type ) ) ? ‘No content available’ : $content; } There are a lot … Read more

Query custom posts from custom taxonomy

You should access global variables in php using global keyword.It makes variable( or object, array) visible inside current function we are dealing with. In function wms_output_home_slides you are using $post global variable directly instead access it using global keyword as following. function wms_output_home_slides($cat) { // $cat=”homeslide” global $post; // You Code Goes here } Find … Read more