• Resolved Rhand

    (@rhand)


    I would like to have the home page to show two widgets and the latest post out of one category and on the blog page all posts.
    Initially I made a home.php that did what I wanted as the front page and a blog page with a template that showed all posts.
    But when I went to blog, my home page link in the menu would be highlighted. AND I would see the two widgets that are called for with if (is_front_page()) from the header. Widgets should only show on the homepage and home should not light up when I am on the blog page.
    When I chose newly created home as home page and blog as posts page I got two home links in the menu. I don’t want that either…?!#$%$
    Is there another conditional I could use to show the widgets on the home page and not the blog page? Or is there another way I can do this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Rhand

    (@rhand)

    Well maybe I need to adjust the template for the blog page. Here is the current code:

    <?php
    /*
    Template Name: Blog
    */
    // Which page of the blog are we on?
    $paged = get_query_var('paged');
    query_posts('cat=-0&amp;paged='.$paged);
    
    // make posts print only the first part with a link to rest of the post.
    global $more;
    $more = 0;
    
    //load index to show blog
    load_template(TEMPLATEPATH . '/index.php');
    ?>

    As it loads the index, blog becomes home and home is highlighted when people to to the blog AND the two widgets are shown as well. Any ideas how to remedy this?

    Thread Starter Rhand

    (@rhand)

    I will work on a query_posts into the blog’s template like home.php has:

    <?php
        query_posts("cat=44&amp;showpost=1");
       if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>

    Just need to call the last 10 posts and style it like the index.

    Thread Starter Rhand

    (@rhand)

    Well, I could use the blog template format for the blog page, use the index for the front page (remove home.php) and this:
    You're done. The one last thing you will want to do is to update your permalinks structure to begin with "/blog/", i.e., "/blog/%year%/%monthnum%/%postname%/". Now you have a WordPress-managed CMS with a unique front page and logically-structured blog content.

    But I am not sure that I want to change my permalink structure..

    Thread Starter Rhand

    (@rhand)

    I am trying my own query now:

    <?php
    /*
    Template Name: Blog
    */
    ?>
    <?php get_header(); ?>
    <div id="page">
    	<div id="content">
    <?php $recent = new WP_Query("cat=all&amp;showposts=5");
    while($recent->have_posts()) : $recent->the_post();?>
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    			<p class="postmetadata"><?php the_time('l, j F, Y') ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">	
    
    				<div class="entry">
    					<?php the_content('Lees de rest van dit bericht &raquo;'); ?>
    				</div>
    
    				<p class="postmetadata"><?php the_tags('Tags:', ', ', ' <strong>|</strong> '); ?> Categorie?n: <?php the_category(', '); ?> <strong>|</strong> Geschreven door: <span style=" color:#000066;"><?php the_author() ?></span> <strong>|</strong> <?php edit_post_link('Bewerk ','','<strong>|</strong>'); ?>  <?php comments_popup_link('Reageer! »', '1 Reactie »', '% Reacties »'); ?>
    
    			</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Vorige Artikelen') ?></div>
    			<div class="alignright"><?php previous_posts_link('Volgende Artikelen &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2>Niet gevonden</h2>
    		Onze excuses. We hebben wat u zocht niet gevonden. Probeer het nogmaals.
    
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>
    
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    There are mistakes in the code though. I only get a blank page. Must be missing something.

    Thread Starter Rhand

    (@rhand)

    Any ideas?

    Thread Starter Rhand

    (@rhand)

    Thread Starter Rhand

    (@rhand)

    Yes! That worked! I needed:

    <?php
    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=' . $limit . '&amp;paged=' . $paged .'&amp;cat=-44');
    $wp_query->is_archive = true; $wp_query->is_home = false;
    ?>
      <?php if (have_posts()) : ?>
    
        <?php while (have_posts()) : the_post(); ?>

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Home page with 1 cat posts and blog page with all posts’ is closed to new replies.