virtual Posted December 30, 2011 Report Share Posted December 30, 2011 Hi Guys, As usual I am stuck with a WP problem. I am using a template, which looks great but has no support. I had to add in the template information on the Archive page because it was not showing so I'm guessing there must be an error in the code somewhere, but the php problem is something I do not understand. Now I have the Archive page showing but it is not pulling in the post information. I tried adding in php from another archive page but got myself into a never ending loop. Can anyone tell me what is wrong with the code - please Here is the code, and the site is http://bit.ly/tZQyBT <?php /** * Template Name: Archive * The main template file for display archive page. * * @package WordPress */ $add_sidebar = TRUE; $page_sidebar = 'Blog Sidebar'; $page_style = 'Right Sidebar'; get_header(); ?> <?php $pp_blog_bg = get_option('pp_blog_bg'); if(empty($pp_blog_bg)) { $pp_blog_bg = '/example/bg.jpg'; } else { $pp_blog_bg = '/data/'.$pp_blog_bg; } ?> <script type="text/javascript"> jQuery.backstretch( "<?php echo get_stylesheet_directory_uri().$pp_blog_bg; ?>", {speed: 'slow'} ); </script> <!-- Begin content --> <div id="page_content_wrapper"> <div class="inner"> <!-- Begin main content --> <div class="inner_wrapper"> <div class="sidebar_content"> <h1 class="cufon"><?php if ( is_day() ) : ?> <?php printf( __( '%s', '' ), get_the_date() ); ?> <?php elseif ( is_month() ) : ?> <?php printf( __( '%s', '' ), get_the_date('F Y') ); ?> <?php elseif ( is_year() ) : ?> <?php printf( __( '%s', '' ), get_the_date('Y') ); ?> <?php else : ?> <?php _e( 'Blog Archives', '' ); ?> <?php endif; ?></h1> <?php global $more; $more = false; # some wordpress wtf logic if (have_posts()) : while (have_posts()) : the_post(); $image_thumb = ''; if(has_post_thumbnail(get_the_ID(), 'large')) { $image_id = get_post_thumbnail_id(get_the_ID()); $image_thumb = wp_get_attachment_image_src($image_id, 'large', true); $pp_blog_image_width = 570; $pp_blog_image_height = 360; } ?> <!-- Begin each blog post --> <div class="post_wrapper"> <div class="post_header"> <h3 class="cufon"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_title(); ?> </a> </h3> </div> <?php if(!empty($image_thumb)) { ?> <br class="clear"/> <div class="post_img img_shadow_536" style="width:<?php echo $pp_blog_image_width+10; ?>px;height:<?php echo $pp_blog_image_height+30; ?>px"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <img src="<?php echo get_stylesheet_directory_uri(); ?>/timthumb.php?src=<?php echo $image_thumb[0]; ?>&h=<?php echo $pp_blog_image_height; ?>&w=<?php echo $pp_blog_image_width; ?>&zc=1" alt="" class="frame img_nofade" width="<?php echo $pp_blog_image_width; ?>" height="<?php echo $pp_blog_image_height; ?>"/> </a> </div> <?php } ?> <br class="clear"/> <?php echo get_the_content_with_formatting(); ?> </div> <!-- End each blog post --> <?php endwhile; endif; ?> <div class="pagination"><p><?php posts_nav_link(' '); ?></p></div> </div> <?php if($add_sidebar && $page_style == 'Right Sidebar') { ?> <div class="sidebar_wrapper <?php echo $sidebar_class; ?>"> <div class="sidebar_top <?php echo $sidebar_class; ?>"></div> <div class="sidebar <?php echo $sidebar_class; ?> <?php echo $sidebar_home; ?>"> <div class="content"> <ul class="sidebar_widget"> <?php dynamic_sidebar($page_sidebar); ?> </ul> </div> </div> <br class="clear"/> <div class="sidebar_bottom <?php echo $sidebar_class; ?>"></div> </div> <?php } ?> </div> <!-- End main content --> <br class="clear"/> </div> <br class="clear"/> </div> <!-- End content --> <?php get_footer(); ?> Thanks and Happy New Year Quote Link to comment Share on other sites More sharing options...
virtual Posted December 31, 2011 Author Report Share Posted December 31, 2011 OK, I managed to get it to work, by replacing the code but now it is displaying the home page as home and not as the index page to the site. I'm not quite sure what this means <?php wp_list_pages('title_li='); ?> Here's my new code <!-- Begin main content --> <div class="inner_wrapper"> <div class="sidebar_content"> <?php echo $page_class; ?> <h1><?php the_title(); ?></h1> <h4>Archives by Year:</h4> <ul><?php wp_get_archives('type=yearly'); ?></ul> <h4>Archives by Month:</h4> <ul><?php wp_get_archives('type=monthly'); ?></ul> <h4>Archives by Category:</h4> <ul><?php wp_list_categories('title_li='); ?></ul> <h4>All Pages:</h4> <ul><?php wp_list_pages('title_li='); ?></ul> <div class="pagination"><p><?php posts_nav_link(' '); ?></p></div> </div> 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.
Note: Your post will require moderator approval before it will be visible.