WordPress.org

Ready to get started?Download WordPress

Forums

category page (4 posts)

  1. sirthaddeus
    Member
    Posted 4 years ago #

    I created a category page and named it category-3.php

    The pages code is below:

    <?php get_header(); ?> <!-- header include -->
    
    	<div id="left">
    		<div id="left-top">
    			<h2>Product Catalog</h2>
    		</div><!-- end left-top -->	
    
    		<div class="blog-content">
    			<?php query_posts('cat=3&showposts=3'); ?>
    			<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    			<h2><?php the_title(); ?></h2>
    			<p>
    				<?php the_content(); ?>
    			</p>
    
    			<?php endwhile; ?>
    		</div><!-- end blog-content -->		
    
    		<div id="catalog-pages">
    			<p>
    				<?php posts_nav_link('<span style="padding-left: 50px"></span>','Previous','Next'); ?>
    			</p>
    		</div><!-- end catalog-page numbers -->
    
    	</div><!-- end left -->
    
    <?php get_sidebar(); ?> <!-- sidebar include -->
    
    <?php get_footer(); ?> <!-- footer include -->
    
    </div> <!-- wrap end -->
    </body>
    </html>

    I uploaded this into my theme folder and when i direct my browser to the page, it get "Nothing Here" and the content doesn't show.

    What am I doing wrong?

    Thanks in advance!

  2. wphelpcenter
    Member
    Posted 4 years ago #

    You don't call template files directly in your browser. Category-3.php will be used by WordPress whenever WordPress is trying to provide a category listing for whichever of your categories has the ID of 3.

    Sorry, that's a little convoluted but it is the best way I can think of to explain it. Does it make sense to you?

  3. sirthaddeus
    Member
    Posted 4 years ago #

    I think I found how to directly call to the page in my browser.

    I use this link:

    http://www.my-domain.com/blog/?cat=3

    When I do I get this error now:

    Parse error: syntax error, unexpected $end in /public_html/blog/wp-content/themes/mytheme/category-3.php on line 33

    The bit of code on line 33 is </html>

    Why would this be causing an error now?

  4. wphelpcenter
    Member
    Posted 4 years ago #

    I believe you're missing an endif after your endwhile. The problem isn't actually on line 33.

Topic Closed

This topic has been closed to new replies.

About this Topic