How to populate blog with posts
-
I’ve successfully styled the blog the way I want it to look but posts aren’t showing up. Here it is: https://bit.ly/9Y59ZL
Any suggestions?
Thanks
-
The template code for the template it has now is:
<?php /* Template Name: Blog */ ?> <?php get_header(); ?> <?php if (get_option('ebusiness_categories') == 'on') : ?> <div id="categories"> <img src="<?php bloginfo('template_directory'); ?>/images/categories-left-<?php echo $ebusiness_color_scheme; ?>.gif" alt="line" style="float: left;" /> <?php $menuClass = 'nav superfish'; $menuID = 'nav2'; $secondaryNav = ''; if (function_exists('wp_nav_menu')) { $secondaryNav = wp_nav_menu( array( 'theme_location' => 'secondary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) ); }; if ($secondaryNav == '') { ?> <ul id="<?php echo $menuID; ?>" class="<?php echo $menuClass; ?>"> <?php show_categories_menu($menuClass,false); ?> </ul> <!-- end ul#nav --> <?php } else echo($secondaryNav); ?> <img src="<?php bloginfo('template_directory'); ?>/images/categories-right-<?php echo $ebusiness_color_scheme; ?>.gif" alt="line" style="float: left;" /> </div> <?php endif; ?> <div id="container"> <div id="left-div"> <?php if (get_option('ebusiness_full_post') == 'on') { ?> <?php include(TEMPLATEPATH . '/includes/blogstyle.php'); ?> <?php } else { include(TEMPLATEPATH . '/includes/defaultindex.php'); } ?> </div> <?php get_sidebar(); ?> <img src="<?php bloginfo('template_directory'); ?>/images/content-bg-<?php echo $ebusiness_color_scheme; ?>.gif" alt="line" style="float: left; margin-top: 15px;" /> </div> <?php get_footer(); ?> </body></html> <?php if (is_archive()) $post_number = get_option('ebusiness_archivenum_posts'); if (is_search()) $post_number = get_option('ebusiness_searchnum_posts'); if (is_tag()) $post_number = get_option('ebusiness_tagnum_posts'); if (is_category()) $post_number = get_option('ebusiness_catnum_posts'); if (is_home()) $post_number = get_option('ebusiness_blogstyle_homeposts'); global $query_string; query_posts($query_string . "&showposts=$post_number&paged=$paged"); ?>
Am I missing something to have the posts populate it?
Thanks in advance!
Your missing the posts loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!-- do stuff ... --> <?php endwhile; ?> <?php endif; ?>
Where would I insert this between from the code I pasted?
It honestly all depends…what do you want as part of your loop? You want the title? excerpt? thumbnail? what?
I tried pasting them into several areas but can’t seem to get it work =/
I just want the entire post.. Title and date would be perfect
what do you want inside your loop is what i mean?
the title, author, thumbnail would be ideal.. i really don’t need an excerpt or anything like that
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!-- Thumbnail --> <?php if( get_post_meta($post->ID, "thumbnail", true) ): ?> <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="<?php the_title(); ?>" width="85" border="1" style="float:left;margin:0px 10px 0px 0px;" /></a> <?php else: ?> <a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php bloginfo('template_url'); ?>/images/thumbnail.png" alt="<?php the_title(); ?>" /></a> <?php endif; ?> <!-- End Thumbnail --> <!-- Title --> <b><a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_title(); ?></b></a> <!-- End Title --> <!-- Date --> <?php the_time('F jS, Y') ? <!-- End Date --> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?>
Thats not the author, just thumbnail, title, date.
Try pasting after the get_header
Wait a second, I saw your parse error…..where are you pasting this code???
The blog looks like this after pasting the header code: https://bit.ly/9Y59ZL
Some progress, no? =)
hmmm….one sec
Where did you get this theme from?
This is the simple loop I use, it doesn’t include font sizes or any div classes. It has the thumbnail, category, title, excerpt, edit link, and the date.
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if( get_post_meta($post->ID, "thumbnail", true) ): ?> <a href="<?php the_permalink() ?>" rel="bookmark"></a> <?php endif; ?> <td width="154"><a href="<?php the_permalink(); ?>"><img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" width="150" /></a></td> <?php the_category(', ') ?> <?php the_time('F jS, Y') ?> <a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_title(); ?></a> <?php the_excerpt();?> <?php edit_post_link('Edit','',''); ?> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?> <?php endif; ?>
your blog content should be came from this section
<div id="left-div"> <?php if (get_option('ebusiness_full_post') == 'on') { ?> <?php include(TEMPLATEPATH . '/includes/blogstyle.php'); ?> <?php } else { include(TEMPLATEPATH . '/includes/defaultindex.php'); } ?> </div>
Check two files(blogstyle.php, defaultindex.php) throughly. Also check theme setting option from admin.
- The topic ‘How to populate blog with posts’ is closed to new replies.