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

How to differentiate the homepage structure from the category page structure in WordPress template?

If I understand you… Your theme may only have an index.php and a single.php but WordPress supports a much more complicated templating system, and you can control the formatting of different types of content just by creating files with the right names. In your case, I think that at least one of the files you … Read more

Display Posts Query with IF function

If I understand you, you want to filter out faculty members who do not have any awards at the query stage. Replace your code: <?php query_posts( ‘post_type=mtt_page’); ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> with this (untested): <?php $args = array( ‘post_type’ => ‘mtt_page’, ‘posts_per_page’ => -1, ‘meta_query’ => … Read more

Using index.php as page template

You can use it as a page template, just as any file with such a header can be used. That doesn’t necessarily mean it’s a good idea. The template hierarchy already uses index.php as a last resort if it cannot find an appropriate template for a page/post/listing etc, so a specific page will already have … Read more