0

EDIT: I am still having this issue which is driving me mad - can any help me please?

Thanks!

I have a custom single-blog.php that has a custom yet basic feed.

Here is the code:

    <div class="container">

            <div class="sixteen columns header">

                <div class="six columns alpha">

                    <h4 class="latestTitle">Blog</h4>

                </div>

                <div class="three columns omega offset-by-seven">

                    <div id="rightLinks"><a href="#" class="latestTitle2">Home</a> / <a href="#" class="latestTitle3">Blog</a></div>

                </div>

            </div>

    </div>


<div id="whiteBG">

<div class="container">

    <div class="ten columns">   

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

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

        <h2><?php the_title(); ?></h2>

        <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>

        <div class="entry">

            <?php the_content(); ?>

            <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>

            <?php the_tags( 'Tags: ', ', ', ''); ?>

        </div>

        <?php edit_post_link('Edit this entry','','.'); ?>

    </div>

<?php endwhile; endif; ?>

</div><!-- end ten -->

<div class="six columns">

<?php get_sidebar(); ?>

</div>

</div><!-- end container -->

</div><!-- end whiteBG -->

<?php get_footer(); ?>

For some odd reason it shows the same single post twice? Anyone run into this issue before?

Thanks,

Ben.

This is the meta code:

<div class="meta">
        <em>Posted on:</em> <?php the_time('F jS, Y') ?>
    <em>by</em> <?php the_author() ?>
     <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments-link', ''); ?>
</div>
3
  • I don't see anything in your code that would cause that. What is in /inc/meta.php?
    – s_ha_dum
    Commented Apr 26, 2014 at 19:40
  • Hey! That is just meta data! Which is in the above!
    – Tired_Man
    Commented Apr 26, 2014 at 20:35
  • That code isn't the problem, as far as I can tell. There is something going on elsewhere.
    – s_ha_dum
    Commented Apr 26, 2014 at 20:41

2 Answers 2

0

Thanks for the help again :) Love this place!

The issues was on the single.php page. I have this if statement:

<?php

$post = $wp_query->post;

if ( in_category('latest-news') ) {

include(TEMPLATEPATH . '/single-latest-news.php'); } 

elseif ( in_category('latest-sermons') ) {

include(TEMPLATEPATH . '/single-latest-sermons.php'); } 

elseif ( in_category('sunday-service') ) {

include(TEMPLATEPATH . '/single-sunday-service.php'); } 

elseif ( in_category('events') ) {

include(TEMPLATEPATH . '/events.php'); } 

elseif ( in_category('blog') ) {

include(TEMPLATEPATH . '/single-blog.php'); } 

else {

include(TEMPLATEPATH . '/single.php');

}

?>

but it should be like this without the slash!

<?php

$post = $wp_query->post;

if ( in_category('latest-news') ) {

include(TEMPLATEPATH . 'single-latest-news.php'); } 

elseif ( in_category('latest-sermons') ) {

include(TEMPLATEPATH . 'single-latest-sermons.php'); } 

elseif ( in_category('sunday-service') ) {

include(TEMPLATEPATH . 'single-sunday-service.php'); } 

elseif ( in_category('events') ) {

include(TEMPLATEPATH . 'events.php'); } 

elseif ( in_category('blog') ) {

include(TEMPLATEPATH . 'single-blog.php'); } 

else {

include(TEMPLATEPATH . 'single.php');

}

?>

Now it does not duplicate the post after the footer and now I can stop sweating in panic! I have used this method before but not come across this issue. Hope this answer can help someone else out in the future!

Cheers,

Ben.

0
0

So the issue was that after this if statement on the single.php was the WordPress loop. Once I removed this it removed the duplicate post underneath the footer - what a fool I feel :(

Hope this helps someone else!

1
  • Someone left a comment stating that this is an very inefficient way of coding. Would you like to show me how you would code it?
    – Tired_Man
    Commented Apr 28, 2014 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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