Most recent post is missing from Author page

The mistake is in your first block of code: <?php if (have_posts()): the_post(); ?> <h3> <?php _e(‘All posts by’); ?> <?php echo get_the_author(); ?> <span class=”arrows”>&raquo;</span> </h3> <?php while (have_posts()) : the_post();?> You call the_post() to populate the regular template tags (i.e. get_the_author()) but don’t use the rest of the post. Then, inside your while … Read more

link to single most recent post, regardless of category

This code uses snippet from @Milo to suit your requirement. Replace the code you’ve provided in question with this – <li> <h2><a href=”http://growingedgecoaching.com/blog”>Growing Edge Blog</a></h2> <?php $latest = new WP_Query( array( ‘posts_per_page’ => 1 ) ); while( $latest->have_posts() ) : $latest->the_post(); ?> <h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <div class=”forward-link”> <a href=”<?php … Read more

Recent posts on homepage

First, ensure that your template file is named home.php. Second, there’s no need to use a custom query loop in this context. If you only want to display 3 posts on the blog posts index (i.e. the “homepage”), then filter the main loop query via pre_get_posts: function wpse83660_filter_pre_get_posts( $query ) { if ( is_home() && … Read more

How to get excerpt of the recent posts

You can use the wp_trim_excerpt() to get the excerpt of the content. You can use it inside your loop to get the excerpt of each post the string provided to a maximum of 55 words if it is more then a […] will be added to the end of the string. <?php $recent_posts = wp_get_recent_posts(array(‘post_type’=>’jokes’)); … Read more

Author list based on recently active

I would take a different approach to this using a direct database query to get a list of author IDs ordered by recent posts. global $wpdb; $user_ids = $wpdb->get_results( ” SELECT DISTINCT post_author FROM $wpdb->posts ORDER BY post_date DESC ” ); if ( $user_ids ) { foreach ( $user_ids as $user_id ) { $user = … Read more

Proper way to display latest 5 posts grouped by post type?

<?php $post_types = array( ‘bmw’ => ‘BMW’, // post type to use in query => post type to show in <h2> ‘audi’ => ‘Audi’ ); foreach( $post_types as $post_type => $post_type_name ): ?> <h2>Latest <?php echo $post_type_name; ?> Posts:</h2> <ul> <?php $args = array( ‘numberposts’ => 5, ‘post_type’ => $post_type ); $recent_posts = wp_get_recent_posts( $args … Read more

How to get date of post when using wp_get_recent_posts()?

You can see everything returned via php’s var_dump or print_r: $recent_posts = wp_get_recent_posts(); echo ‘<pre>’; print_r( $recent_posts ); echo ‘</pre>’; This will reveal that the date is stored in post_date: foreach( $recent_posts as $recent ): echo $recent[‘post_date’]; endforeach; Or to format the date, use php’s date and strtotime: echo date( ‘l F jS’, strtotime( $recent[‘post_date’] … Read more

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