the_time() cannot be placed correctly

<p> <?php the_time() ?> </p> It helps with separation of concerns and increases readability of code as well as being consistent with WordPress coding standards and the default coding style. The first method you attempted is completely invalid, the_time() only accepts 1 parameter, the date format. The second method has roots in validity, but the_time() … Read more

Hide the contents for specific post

Your code doesn’t seem to be trying to hide the content, but you can use the_content filter to return an empty content if you are on a specific post page. For example: add_filter(‘the_content’, ‘hide_post_contents’); function hide_post_contents( $content ) { if( is_single(3) ) { return ”; } return $content; } Also, there is a mistype in … Read more

How do I show the post title if an advanced custom field hasn’t been used?

If in doubt, check the documentation first: https://www.advancedcustomfields.com/resources/get_field/ Check if value exists This example shows how to check if a value exists for a field. $value = get_field( ‘text_field’ ); if ( $value ) { echo $value; } else { echo ’empty’; } So, in for your case you would need to use: <?php $short_testimonial … Read more

How to get child category list post in one template?

get the child categories, using get_categories(); then loop through them with a foreach loop, using WP_Query() : <?php $cats = get_categories(‘child_of=”.get_query_var(“cat’)); foreach ($cats as $cat) : $args = array( ‘posts_per_page’ => 3, // max number of post per category ‘category__in’ => array($cat->term_id) ); $my_query = new WP_Query($args); if ($my_query->have_posts()) : echo ‘<h3>’.$cat->name.'</h3>’; while ($my_query->have_posts()) : … Read more