Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Recently I had someone customize a WP blog for me. This person didn't do a very will job so I decided to do it myself. I customized my own blog page and it all works, except for when I click on the posts I get a "Not Found Error" page. I looked through the old blog that some person made and I can't tell where that person linked my posts to. The only clue I have is this bit of code after the <?php the_content(); ?>:

<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>

I left this bit of code out when I customized my own page. Now I Get a "Not Found Error" when I click on the Post, here is my blog page:

    <?php
/*
Template Name: Blog
*/
?>

<?php get_header(); ?>

<br/>

<br/>

<section id="content">

  <div class="main">

    <div class="inner">

      <h3 class="h3 bg-3">Web   Design   inspiration,  all   resources  you   could   need !</h3>

    </div>

  </div>

  <?php if (have_posts()) : ?>

  <?php query_posts('posts_per_page=3'); ?>

  <?php while (have_posts()) : the_post(); ?>

  <div class="main">

    <div class="cycle">

      <div id="slider3" class="pics">

        <div class="box">

          <article>

            <figure class="box-img img-indent"><a class="lightbox-image box-image" data-gal="prettyPhoto" href="<?php echo catch_that_image() ?>"><img src="<?php echo catch_that_image() ?>" alt="" /></a></figure>

            <div class="inner"><a class="link-1" href="<?php the_permalink() ?>" title="Go to <?php the_title(); ?>"><?php the_title(); ?></a><br>

              <div class="txt-3"><strong>Posted on:</strong> <span><?php the_time('m/d/y') ?></span></div>

              <p class="p3"><?php the_content() ?>
              </p>

            </div>

            <div class="clear"></div>
        <?php endwhile; ?>
          </article>



        </div>

      </div>

    </div>

    <br/>
    <br/>

    <div class="navigate2">

      <div id="nav"></div>

      <?php next_posts_link('<span id="next_slide2"> </span>') ?></div>

  </div>

  <?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>

</section>

<?php get_footer(); ?>

Thanks in advance! (P.S. I'm working in my local host so I don't have a webpage that you can go to.)

share|improve this question
    
Could you please show us the url that one of the broken links' sends you to, and what the url should be for the post you expected to be sent to? Also, is it this line of code that is generating the link you are clicking on? <div class="inner"><a class="link-1" href="<?php the_permalink() ?>" title="Go to <?php the_title(); ?>"><?php the_title(); ?></a><br> –  Ben Sep 2 '12 at 20:22
add comment

1 Answer 1

up vote 0 down vote accepted

The file you included in your question is a custom page template, and would never be used by WordPress to render the single-post view of a blog post.

If you don't have a single.php, then the template hierarchy will fall back to index.php to render the single-post view for blog posts.

Edit

From your comment below:

I'm sorry. I need my Posts to link to an individual [page]. I do not know how to do that. I thought WP automatically linked my posts to a page called single.php. I would like to know how to do that.

Please have a read through the Template Hierarchy Codex entry, which explains everything for you. I repeat my answer above: If your Theme doesn't have a single.php, then the template hierarchy will fall back to index.php to render the single-post view for blog posts.

Those are the only two possible template files for WordPress to use to render the single-post view of a blog post.

Regarding this comment:

I don't know how to make my Permalinks link to a single.php page, I don't want them linked back to the index.php page.

I don't think you fully grasp how WordPress uses its template files. The index.php file isn't a "page", but rather a template, used to output a given query. Your Theme could consist of no other template file than index.php, and the site will render perfectly fine, and as intended/expected. WordPress will simply use the template to define the markup used to render the data in the given query.

If that query is the blog posts index, then WordPress will use it to render all of the posts for the blog posts index. If that query is an archive index, then WordPress will use it to render all of the posts in the specified archive. If that query is a single blog post, then WordPress will use that template to render a single blog post.

So: is there any particular reason you don't want your Theme to fall back to the index.php template file to render single blog posts?

share|improve this answer
    
Yes '<a class="link-1" href="<?php the_permalink() ?>" title="Go to <?php the_title(); ?>"><?php the_title(); ?></a>' Is what I want linking. I don't know how to make my Permalinks link to a single.php page, I don't want them linked back to the index.php page. How can I go about linking all my blog posts to a single.php page? I just want to customize my single.php page so that the posts show up on that page when people click on the permalinks. –  Caleb Hallahan Sep 3 '12 at 17:35
    
Forget the template files for a moment. Just describe in human terms what you want to do? Because your comment above doesn't really make sense to me. –  Chip Bennett Sep 3 '12 at 17:43
    
I'm sorry. I need my Posts to link to an individual. I do not know how to do that. I thought WP automatically linked my posts to a page called single.php. I would like to know how to do that. –  Caleb Hallahan Sep 4 '12 at 1:19
    
individual *page –  Caleb Hallahan Sep 4 '12 at 1:19
    
Thank you for helping me Chip. How can I change the way the rendered single blog posts look? And how can I make the links work? When I click the links I get an Error that states: Not Found The requested URL /ChristianInternetDesign/blog/2012/08/what-in-the-world/ was not found on this server. –  Caleb Hallahan Sep 4 '12 at 17:17
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.