• Resolved devotee

    (@devotee)


    Hi. Im working on a site with a theme I´m building at the time. I think this problem arose when I wanted to use two different single.php templates depending on which category they where displaying. I duplicated my single.php and renamed it into single-portfolio and singel-news, then I replaced the content of single.php with a simply php code to load the right template depending on category.

    That worked. But now, my single-news.php is repeating its content twice for some reason. Its not doing so on the single-portfolio however.

    Any ideas why this is the case and what I can do about it? I´m thinking maybe some querys arent reset or something.

    On both single-news and single-portfolio I am using two querys, one regular for the content with this style:
    http://wordpress.pastebin.ca/2053962

    and one costum query below this which looks like this:
    http://wordpress.pastebin.ca/2053963

    Someone please help me with this because I´m so lost here!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Can you post a link to a page where this is happening and the entire single-news.php file?

    Thread Starter devotee

    (@devotee)

    No. I abandoned the idea about specific single templates, some posts will be in several categories so it was a bad idea probably.

    I didnt do it for styling purposes anyway, but because I wanted to loop in thumbnails of posts from the same category that the single.php is currently displaying. Im guessing now that it might be better to do that through specific query. If you know how to do that I´ll be happy to be helped with that instead, if not thanks for wanting to help me with my initial problem 🙂

    How about something like this?

    Thread Starter devotee

    (@devotee)

    Uhm. Should I just put the php tags before and after that whole code? Im unsure about where to put them, if there are many…sry 🙂 Could you past it again with php tags perhaps?

    It’s all php code so place <?php at the start of the first line and ?> at the end of the last line.

    Thread Starter devotee

    (@devotee)

    Thank you! That worked well! I had to stop and start php tags on some places in the code to get my divs and markup in, you do need to do that right? Or can I mix html and php?

    It looks like this now: http://pastebin.com/ytFZtexU

    Im very grateful for your help, couldnt have done this by myself! 🙂

    Glad to hear it’s working.

    I had to stop and start php tags on some places in the code to get my divs
    and markup in, you do need to do that right? Or can I mix html and php?

    – You can do either, I took a quick look at your pastebin and it looks good to me.

    Please mark this issue as resolved

    Thread Starter devotee

    (@devotee)

    Of course, thanks again.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Content duplicates itself – Something wrong with my query? Need reset? How?’ is closed to new replies.