custom sort posts in archive/taxanomy page

Put something along these lines in your functions.php: add_filter( ‘pre_get_posts’, ‘custom_get_posts’ ); function custom_get_posts( $query ) { if( is_category() || is_archive() ) { $query->query_vars[‘orderby’] = ‘name’; $query->query_vars[‘order’] = ‘ASC’; } return $query; } reference here (see the second answer)

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

‘posts_per_page’ => ’10’ does not show any post

after days of research, I found that the fault was simply in the pagination. By changing the pagination code, I have made it work. <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $custom_args = array( ‘post_type’ => ‘veranstaltungen’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘paged’ => $paged, ‘posts_per_page’ => ’10’ ); $wp_query = new WP_Query($custom_args); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)