I have just created a custom wordpress layout and added a 'most popular posts' section in. website: www.thomassinfield.com but the thing is the links are not being created with the correct link structure. It is linking to this: http://www.thomassinfield.com/2007/11/15/5-reasons-why-you-will-fail-at-blogging when it should be linking to this: http://www.thomassinfield.com/blogging/5-reasons-why-you-will-fail-at-blogging and the section of code they give you to input doesnt seem to have a way to change it: Does anyone know how to fix this? thanks tom
Try this: <?php $sql = "SELECT post_date, post_title, post_name, comment_count from wp_posts ORDER BY comment_count DESC LIMIT 7"; $searches = $wpdb->get_results($sql); echo ''; foreach ( $searches as $searchz ){ $dtp = explode(" ", $searchz->post_date); echo '<li> <a href="http://www.thomassinfield.com/' . $searchz->post_name . '" title="' . $searchz->post_title . '">' . $searchz->post_title . '</a></li>'; } ?> Code (markup):
hi, thanks that is close... i just need to add category infront of post title... do you know how i do this?