Forums

Page 1 is the same as Page 2 (loop problem in theme) (13 posts)

  1. gotmoney
    Member
    Posted 10 months ago #

    Hi there,

    I have a problem with some of my theme's code. I know it's my theme because I tried another theme out and the problem went away. The thing is I bought a custom theme and do not wish to change it and have the coding problem sorted out.

    http://snipt.org/xlUi - is my index.php

    I also have an included file featured.php that has a similar code in it.

    This is an adult site so I will not post the URL to it (you can find it in the index.php file I've shared).

    If you could help, it would really make my day. I have looked everywhere and anything I try I can't replace said code and have it work.

    Thanks.

  2. alchymyth
    The Sweeper
    Posted 10 months ago #

    line 16 of your code:

    query_posts('cat=-20');

    try to change it ot:

    global $query_string; query_posts($query_string . '&cat=-20');

    http://codex.wordpress.org/Function_Reference/query_posts#Usage_Note

  3. gotmoney
    Member
    Posted 10 months ago #

    Hey thanks for the reply however that didn't seem to work :(.

    Hmmm... this one is a noodle scratcher!

  4. jomsky
    Member
    Posted 10 months ago #

    Try explicitly adding the 'paged' variable like this:

    global $query_string;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($query_string . '&cat=-20' . '&paged=$paged');
  5. alchymyth
    The Sweeper
    Posted 10 months ago #

    alternative:

    line 16 of your code:

    query_posts('cat=-20');

    try to change it to:

    query_posts('cat=-20&paged='.get_query_var('cat'));

  6. gotmoney
    Member
    Posted 10 months ago #

    Jomsky: Tried this and didn't do the trick :(

    alchymyth: Tried this and the result was a broken listing (no posts found).

    I appreciate you guys trying to help.. wonder what it could be?

  7. alchymyth
    The Sweeper
    Posted 10 months ago #

    my bad - what i really meant was:

    query_posts('cat=-20&paged='.get_query_var('paged'));

    @jomsky
    your idea is right - just the syntax (single quotes and strings in php) needs to be adapted:
    query_posts($query_string . '&cat=-20' . '&paged='.$paged);

    or
    query_posts($query_string . "&cat=-20&paged=$paged");

  8. gotmoney
    Member
    Posted 10 months ago #

    Hey still isn't working. What a bugger eh?

    Hey, so the index.php that I pasted earlier also includes featured.php which has similar lines of code:

    http://codepad.org/6teg10Xl

  9. alchymyth
    The Sweeper
    Posted 10 months ago #

    keep the index.php with the latest changes; and try to add wp_reset_query(); after the endif; of featured.php

  10. gotmoney
    Member
    Posted 10 months ago #

    Added modified codes but still gives me the same return :(

  11. gotmoney
    Member
    Posted 10 months ago #

    Anyone else want to take a stab at it? It would really make my day :)

  12. gotmoney
    Member
    Posted 10 months ago #

    http://wordpress.org/support/topic/custom-theme-problem?replies=9

    This is the same problem I'm having, anyone know how I can change it properly to make it work?

    Thanks.

  13. gotmoney
    Member
    Posted 10 months ago #

    bump

Reply

You must log in to post.

About this Topic