get_posts displaying wrong permalink for “continue reading” link

You need to reset the post data after your get_posts loop since your calling setup_postdata. It would be better to remove the setup_postdata all together. global $post; $recent_posts = get_posts( $yourargshere ); foreach($recent_posts as $post) : $return = ‘<h4 class=”recent-post-title c0″>’ . $post->post_title . ‘</h4>’; $return .= ‘<p class=”recent-content c0″>’ . apply_filters( ‘the_excerpt’, $post->post_excerpt ) … Read more

Displaying posts on Homepage

Try the following using WP_Query: <div class=”news-column”> <h3>Latest News</h3> <ul> <?php //get news $args->posts_per_page = 5; //query $query = new WP_Query($args); while($query->have_posts()):$query->the_post(); ?> <li class=”news-item”> <h4><?php the_title(); ?></h4> <p><?php the_date(‘F jS, Y’); ?></p> <?php the_excerpt(); ?> <p class=”footnotes”><a href=”https://wordpress.stackexchange.com/questions/69725/<?php the_permalink(); ?>”>Continue reading</a></p> </li> <?php endwhile; wp_reset_postdata(); ?> </ul> </div> You can read more about other … Read more

Show last post from multiple categories using wp_list_categories

Get all children categories using get_terms(). Loop through each term and run a new query using tax_query. Example: <?php if ( get_queried_object()->parent == 0 ) : // parent cat ?> <h2>Showing all children</h2> <?php $args = array( ‘hide_empty’ => false, ‘parent’ => get_queried_object()->term_id ); $terms = get_terms( ‘category’, $args ); if ( $terms ) echo … Read more