WordPress.org

Ready to get started?Download WordPress

Forums

Need Help with Hacks (10 posts)

  1. oriecat
    Member
    Posted 10 years ago #

    Hi, I tried to use the show one category on the index page hack. I copied the data directly from the wiki page, but I'm getting an error. This is my first attempted hack. Help?
    http://www.moltenwords.net
    Here's the error i got:
    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/moltenwo/public_html/my-hacks.php on line 3
    Parse error: parse error in /home/moltenwo/public_html/my-hacks.php on line 3

  2. Mark (podz)
    Support Maven
    Posted 10 years ago #

    if ('/' == $_SERVER['REQUEST_URI'])
    is the hack.
    Is yours the wrong way round ?

  3. oriecat
    Member
    Posted 10 years ago #

    No, I copied and pasted it directly from the wiki.

  4. Mark (podz)
    Support Maven
    Posted 10 years ago #

    I don't use this hack, but I'd try using a / instead ? Just to see what happens ?
    (I know it sounds daft, but comparing error messages sometimes helps ?)

  5. Mark (podz)
    Support Maven
    Posted 10 years ago #

    oops. I meant \

  6. oriecat
    Member
    Posted 10 years ago #

    Thanks, I'll try that as soon as my server starts working again. grr...

  7. oriecat
    Member
    Posted 10 years ago #

    Well I don't know what the deal was, but I erased the '/' and retyped it and now it works. Frickin' computers!

  8. Mark (podz)
    Support Maven
    Posted 10 years ago #

    Excellent :)

  9. skippy
    Member
    Posted 10 years ago #

    I tried creating a my-hacks.php with the code as listed in the Wiki. After enabling hacks in my WP options, my blog disappears -- a totally blank page. If I disable hacks in WP options, the blog comes back.
    I also tried several permutations on this, as found here:
    http://wordpress.org/support/3/2954
    When I try this, I _only_ get the category I define in my-hacks.php. Worse still is that index.php?c=7 (a non-front-page category) shows the latest post in the general category!
    I tried putting the if clause into my index.php instead of in my-hacks.php, but that doesn't work _either_.
    Pointers are greatly appreciated.

  10. redneck
    Member
    Posted 10 years ago #

    I tried the code in the Wiki, but it didn't do anything for me.
    So I replaced it with this:
    // This bit forces the default category to be category 1
    if (!isset($cat) && !isset($p))
    $cat = 1;
    if (isset($s))
    $cat = ''; // so searches work on all categories

    This works, except the archive is screwed up (only archive that is visible is the current category). I haven't started working on that bug yet...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.