• Guys this is killing me!

    My problem is frontpage and it’s posts. I want latest post of all categories to be displayed here.

    After a month of breaking my head I decided to leave POSTLISTS plugin because it doesn’t work the way I want. see here.

    So I created a new page and set it as frontpage in wp options. I used PageOfPosts template for the page template. Than I created custom fields for all post categories but that just displayed 2 or 3 posts – just like that – no logic…

    Now I have to use the plugin again…but I still want to know how do I display posts of all categories(not using the plugin)…isn’t that basic stuff in wordpress???

    Note that frontpage has to be page, not just “my latest post” because I also need a side menu that is different on every page…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Not sure I or others understand as you kind of contradict yourself. You have to use a PAGE not POSTS but you want posts. hhhmmmm…
    Just take the archives.php and make it whatever you want including sidebar. There is tons of stuff on the web (Google is your friend) posted by great people how to do it.

    You can list the latest post of all categories like this:

    <?php
    $categories = get_categories();
    foreach ($categories as $cat) : ?>
    	<div class="wrap_cat">
    	<?php
    	// get most recent post in cat
    	query_posts('posts_per_page=1&cat='.$cat->cat_ID);
    	if (have_posts()) : while (have_posts()) : the_post();
    	?>
    	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    	<?php the_content('continue reading...'); ?>
    	<?php endwhile; endif; wp_reset_query();
    	// get 4 most recent posts in cat offset by 1
    	query_posts('posts_per_page=4&offset=1&cat='.$cat->cat_ID);
    	if (have_posts()) : ?>
    	<ul class="moreposts">
    	<?php while (have_posts()) : the_post(); ?>
    		<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    	<?php endwhile; ?>
    	</ul> <!-- .moreposts -->
    	<?php endif; wp_reset_query();?>
    	</div> <!-- .wrap_cat -->
    <?php endforeach; ?>

    Thread Starter jl2035

    (@jl2035)

    Yes it has to be page, because it has to have a unique sidebar menu – which is a widget whit widget logic like: is_page(‘XX’); Every few pages have other side menu. (widget logic is a plugin that lets me put different widgets on a different pages)

    And this code:

    <?php
    $categories = get_categories();
    foreach ($categories as $cat) : ?>
    	<div class="wrap_cat">
    	<?php
    	// get most recent post in cat
    	query_posts('posts_per_page=1&cat='.$cat->cat_ID);
    	if (have_posts()) : while (have_posts()) : the_post();
    	?>
    	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    	<?php the_content('continue reading...'); ?>
    	<?php endwhile; endif; wp_reset_query();
    	// get 4 most recent posts in cat offset by 1
    	query_posts('posts_per_page=4&offset=1&cat='.$cat->cat_ID);
    	if (have_posts()) : ?>
    	<ul class="moreposts">
    	<?php while (have_posts()) : the_post(); ?>
    		<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    	<?php endwhile; ?>
    	</ul> <!-- .moreposts -->
    	<?php endif; wp_reset_query();?>
    	</div> <!-- .wrap_cat -->
    <?php endforeach; ?>

    This code made a mess out of my page(in fact any code – any <?php mark)…

    It displays literally this:

    $categories = get_categories();
    foreach ($categories as $cat) : ?>
    // get most recent post in cat
    query_posts(‘posts_per_page=1&cat=’.$cat->cat_ID);
    if (have_posts()) : while (have_posts()) : the_post();
    ?>

    …and than it lists 4 latest pages i created – instead of posts…

    For me this is to hard to understand…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WORDPRESS DOESN'T OBEY ME!!!’ is closed to new replies.