• Resolved photeck

    (@photeck)


    I’ve searched the forums and google, but couldn’t find a solution to my problem. So ill try and explain it as best i can, im using wordpress as my backend, while my frontend is a custom template, my problem is im only displaying a certain category for each page. I have my archived posts below each page, whenever an archive link is clicked, instead of it actually going to the archived post. it returns the category (as if it were looping.)

    here is a snippet of my setup, to display my posts by category im using
    <?php query_posts("cat=4"); ?>
    <?php wp_reset_query(); ?>

    to grab and display my archives im using
    <?php get_archives('postbypost', 5); ?>

    For some reason, these two snippets dont work well together, is there some sort of work-around i can try, or any help from someone with the same problem as I?

    you can see the problem i am talking about here>> http://enflicted.net

Viewing 10 replies - 1 through 10 (of 10 total)
  • The <?php wp_reset_query(); ?> reset the last query!
    so either put it at starting or ending of your query..

    Thread Starter photeck

    (@photeck)

    Alrighty, i dont quite understand, but perhaps i didnt post enough code for anyone to understand, here is my full code at pastebin

    http://pastebin.com/6GCHtax5

    I thought i put my reset_query in the correct place..

    the code you’re using is deprecated…

    Please use this code: http://codex.wordpress.org/Template_Tags/wp_get_archives

    Thread Starter photeck

    (@photeck)

    Sigh, ok..i replaced the deprecated code with
    <?php wp_get_archives('type=postbypost&limit=5'); ?>

    But this still doesnt solve the issue, each link still displays all posts in category 4, instead of the archived post

    I see,

    There’s another way to get it work!

    store the result into a STRING before the query_post.. don’t forget to use echo=0 into the archive function.. 🙂

    Thread Starter photeck

    (@photeck)

    haha, ok you stepped over my knowledge limit, i have no clue how to do any of that, this is my first attempt at creating a custom theme using wordpress as my backend. I do appreciate the help though, had no idea the code i was using was deprecated!

    that’s this issue resolved?

    Thread Starter photeck

    (@photeck)

    Not entirely no, i cannot figure out how to store anything in a string, nor do i really understand where i would insert echo=0

    Use this code at the top of the query_post code:

    <?php $wp_my_archives=wp_get_archives(‘type=postbypost&limit=5&echo=0’); ?>

    so with the above code the archives post are stored into the string: $wp_my_archives

    you can place this string where you used the wp_get_archives();
    <?php echo $wp_my_archives;?>

    Thanks

    Thread Starter photeck

    (@photeck)

    Thank you very much, that should work perfectly, if not i shall find another work around myself, it’ll give me a chance to dive deeper into the codex, so i will not take up any more of your time, appreciate the help!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Problem with Category and Archiving’ is closed to new replies.