wordpressnoob
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Make posts from certain category display on page other than the mainHow did you get this to work?
Forum: Themes and Templates
In reply to: Page Template: Posts by categoryI can’t make the examples work. If you know how to do what I am trying to accomplish, why not post the solution or point me to an example that will work?
The reason I am going through a struggle, is because I am trying make something work based on the web examples. Maybe you can make them better, so people like me would understand them.
Forum: Themes and Templates
In reply to: Page Template: Posts by categoryWell I nearly have it working, the only problem I am no having is the formatting. It correctly pulls the posts that are of the category “Recipies” and displays them on the page “Recipies”
The only annoying thing is that they are below the sidebar. Thanks for the help, maybe this code will help someone else do this.
<?php /* Template Name: category-3.php */ ?> <?php get_header(); ?> <?php get_sidebar(); ?> <div id="content" class="widecolumn"> <!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="post"> <?php $myposts = get_posts('category=3'); foreach($myposts as $post) : ?> <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('l, F jS, Y') ?></small> <div class="entry"> <?php the_content() ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> </div> <?php endforeach; ?> <!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?> <!-- The very first "if" tested to see if there were any Posts to --> <!-- display. This "else" part tells what do if there weren't any. --> Sorry, no posts matched your criteria. <!-- REALLY stop The Loop. --> <?php endif; ?> <?php get_footer(); ?>Forum: Themes and Templates
In reply to: Page Template: Posts by categoryOk, this is getting closer and closer. I used some code from the website and changed a few things around. I’m still alittle confused though.
I went and renamed the file to “category-3.php” and put the following inside as well…
<?php /* Template Name: category-3.php */ ?> <?php get_header(); ?> <?php get_sidebar(); ?> <div id="content" class="widecolumn"> <ul> <?php $myposts = get_posts('category=3'); foreach($myposts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> --- <?php the_excerpt(); ?></li> <?php endforeach; ?> </ul>Do I need to query the database before I start this loop? Is that why this is working?
<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <!-- Display the Time. --> <small><?php the_time('F jS, Y'); ?></small> <!-- Display the Post's Content in a div box. --> <?php the_content(); ?> <!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?> </div> <!-- closes the first div box --> <!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?> <!-- The very first "if" tested to see if there were any Posts to --> <!-- display. This "else" part tells what do if there weren't any. --> Sorry, no posts matched your criteria. <!-- REALLY stop The Loop. --> <?php endif; ?> </div> <?php get_footer(); ?>It looks really close (sample output to follow):
* smelly chicken —
* Gross chicken —Recipies
May 3rd, 2007Posted in Uncategorized
I just want the smelly chicken and the gross chicken to come after the Recipies header.