Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter AGray410

    (@agray410)

    I just migrated my site from local host to the web. Here is the link

    https://richproducer.com

    I decided to simply link to the category pages instead of trying to do what I was doing before. I hope I’ve used the loops correctly this time.

    I was over complicating it before, trying to have only certain posts show on certain pages, when instead I could just link to category pages in the first place.

    It’s not perfect or exactly how I want it, but this is as close and as far as I’ve ever gotten so I’m pretty happy!

    Thread Starter AGray410

    (@agray410)

    Ok I have found the solution (sort of)

    What I had to do was create a single.php file, and here is the code I added there.

    <?php
    /**
     * The template for displaying all single posts and attachments
     *
     */
    
    get_header(); ?>
    
     <!-- Start the Loop. -->
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
     	<!-- Test if the current post is in category 3. -->
     	<!-- If it is, the div box is given the CSS class "post-cat-three". -->
     	<!-- Otherwise, the div box is given the CSS class "post". -->
    
     	<?php if ( in_category( '3' ) ) : ?>
     		<div class="post-cat-three">
     	<?php else : ?>
     		<div class="post">
     	<?php endif; ?>
    
     	<!-- Display the Title as a link to the Post's permalink. -->
    
     	<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
     	<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
    
     	<small><?php the_time('F jS, Y'); ?> by <?php the_author_posts_link(); ?></small>
    
     	<!-- Display the Post's content in a div box. -->
    
     	<div class="entry">
     		<?php the_content(); ?>
     	</div>
    
     	<!-- Display a comma separated list of the Post's Categories. -->
    
     	<p class="postmetadata"><?php _e( 'Posted in' ); ?> <?php the_category( ', ' ); ?></p>
     	</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. -->
     	<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    
     	<!-- REALLY stop The Loop. -->
     <?php endif; ?>

    At first I had something different, and it was working but not displaying the post content. It did have some other things that this code doesnt have such as next/previous post. So I’ll just have to study the code and figure out where to add those functions or whatever.

    Now it seems as though I just have to style it. My thing is I keep searching and finding fixes but once I get something how i want it I kind of just forget about it. I guess studying the fundamentals will help with that.

Viewing 2 replies - 1 through 2 (of 2 total)