Traveleryvr Posted January 24, 2011 Share Posted January 24, 2011 Hey, I'm new at this and a friend came to me and said "You know web design". Which, YES, design not coding. Can someone help me with some PHP. I need to have my blogs archives only give me posts from the blog category, oh did I mention it's a Wordpress site... lol. Here's the code: <?php /** * @package Corporate Theme */ get_header(); ?> <?php $page_headline = get_post_meta($post->ID, 'page_headline', true); $page_description = get_post_meta($post->ID, 'page_description', true); if($page_headline || $page_description) { ?> <div class="wrap_wide slogan"> <div class="wrap"> <h1><?php echo $page_headline; ?></h1> <div class="clear"></div> <p><?php echo $page_description; ?></p> </div> </div> <?php } ?> <div class="clear"></div> <div class="wide_wrap content"> <div class="wrap padding-top-bottom"> <!--Content area--> <?php if (have_posts()) : ?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h1 class="search_archive">‘<?php single_cat_title(); ?>’ Archives</h1> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h1 class="search_archive">Posts Tagged ‘<?php single_tag_title(); ?>’</h1> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h1 class="search_archive">Archive for <?php the_time('F jS, Y'); ?></h1> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h1 class="search_archive">Archive for <?php the_time('F, Y'); ?></h1> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h1 class="search_archive">Archive for <?php the_time('Y'); ?></h1> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <h1 class="search_archive">Author Archive</h1> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h1 class="search_archive">Blog Archives</h1> <?php } ?> <ul class="archive_list"> <?php while (have_posts()) : the_post(); ?> <li> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <span class="date"><?php echo get_the_time('F j, Y'); ?></span> <span class="comments"><?php comments_number('no responses','one response','% responses'); ?></span> <?php the_title(); ?> </a> </li> <?php endwhile; ?> </ul> <!--Pagination --> <?php if(get_next_posts_link()|| get_previous_posts_link()) { ?> <div class="clear"></div> <div class="pagination_wide"> <ul> <li class="left"><?php next_posts_link('<span>« Previous</span>') ?></li> <li class="right"><?php previous_posts_link('<span>Next »</span>') ?></li> </ul> </div> <div class="clear"></div> <?php } ?> <!--End pagination --> <?php else : ?> <?php if ( is_category() ) { // If this is a category archive printf("<h1 class='center'>Sorry, but there aren't any posts in the %s category yet.</h1>", single_cat_title('',false)); } else if ( is_date() ) { // If this is a date archive echo("<h1>Sorry, but there aren't any posts with this date.</h1>"); } else if ( is_author() ) { // If this is a category archive $userdata = get_userdatabylogin(get_query_var('author_name')); printf("<h1 class='center'>Sorry, but there aren't any posts by %s yet.</h1>", $userdata->display_name); } else { echo("<h1 class='center'>No posts found.</h1>"); } ?> <?php endif; ?> </div> </div> <?php get_footer(); ?> Thanks, M [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.