WordPress.org

Support

Support » Plugins and Hacks » Archives.

Archives.

  • Mark (podz)

    @podz

    Support Maven

    I’ve just followed the instructions here – http://mtdewvirus.com/wp-hacks/archives.txt
    yet when I click my archives link, I get this url, but a 404
    http://www.tamba2.org.uk/T2/archives/2004/01/
    I copied the permalinks structure from the page above.
    The other effect is that my page is now displaying every post I’ve made this month.
    I have a .htaccess covering the entire html directory, and it has the following code in it;
    Options FollowSymLinks
    Rewriteengine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.tamba2.org.uk/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://tamba2.org.uk/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://tamba2.org.uk.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.tamba2.org.uk.*$ [NC]
    RewriteRule .*.(gif|GIF|jpg|JPG)$ – [F]
    That shouldn’t interfere with the htaccess as detailed on mtdewvirus’ page should it ?
    I’ve gone wrong somewhere …

Viewing 12 replies - 1 through 12 (of 12 total)
  • podz,
    Did you modifty the rewrite code I have in the instructions to allow for your WP installed in a T2 directory? If you haven’t, you’ll need to make the necessary changes.
    Also, when I try to access your arch.php, I get a parse error on line 83 of that file.

    Mark (podz)

    @podz

    Support Maven

    Wow can I be stupid at times …..
    When I entered the permalink structure, and clicked Update, it never occurred to me that the code I needed for my site would appear below that in the box that is there …..
    It works now – so I can fine tune in later
    Thanks !

    Not stupid…just an oversight! 😉

    Mark (podz)

    @podz

    Support Maven

    Right …….. I’ve another query.
    With everything (I think) in place, when I click ‘January 2004’, I actually see all the posts, not just the titles alone.
    Is this the way it is meant to be ?
    I *thought* I would just see post titles. It’s no biggie, I’m just wondering.
    Permalink is set to
    /archives/%year%/%monthnum%/%day%/%postname%/
    (Oh, and if you go look, I know I’ve broken the header link to the main page by using just an image – I’m working on it 😉 )

    podz,
    It doesn’t look like you have the mod_rewrite rules setup. arch.php is never being called from what I can see, because you try to access the file directly, http://www.tamba2.org.uk/T2/arch.php there is an error. Could you post your rewrite rules somewhere?

    Mark (podz)

    @podz

    Support Maven

    Okay ….
    RewriteEngine On
    RewriteBase /T2/
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([0-9a-z-]+)?/?([0-9]+)?/?$ /T2/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    RewriteRule ^archives/category/?([0-9a-z-]+)?/? /T2/index.php?category_name=$1 [QSA]
    These were generated when I clicked the Update button after entering a permalink of
    /archives/%year%/%monthnum%/%day%/%postname%/
    I’ve checked yours again, and they are certainly very different…..and I’ve not a clue why 🙂

    Mark (podz)

    @podz

    Support Maven

    These are lines 80 -86 from arch.php
    <?php include(ABSPATH . ‘wp-comments.php’); ?>
    </div>
    <?php } } else { // end foreach, end if any posts ?>
    Sorry, no posts matched your criteria.
    <?php } ?>
    </div>

    The rules are different in the instructions because you need to point some of those archives to the arch.php instead of index.php or the file will never be opened. If you are still using the rules generated by WP, it won’t work…they need to be modified.
    Try these:
    RewriteEngine On
    RewriteBase /T2/
    RewriteRule ^archives/?([0-9]{4})?/?([0-9]{1,2})?/?$ /T2/arch.php?year=$1&monthnum=$2 [QSA]
    RewriteRule ^archives/category?/?(.*) /T2/arch.php?category_name=$1 [QSA]
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([0-9a-z-]+)?/?([0-9]+)?/?$ /T2/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    That code shouldn’t even be in arch.php, unless of course you’ve modified it and want to show comments and other things. Have you followed the instructions correctly for creating arch.php?

    Mark (podz)

    @podz

    Support Maven

    Right….
    arch.php corrected (I’d mistaken one end of a div for the correct one.
    mod_rewrite done
    and it’s going a bit further …
    Archives view now gives this :
    Fatal error: Call to undefined function: get_year_link() in /home/—–path—–/html/T2/my-hacks.php on line 15

    Did you paste the function get_year_link into your my-hacks file?

    Mark (podz)

    @podz

    Support Maven

    Many apologies ………I’d missed that.
    Would doing an MT install be suitable penance ?
    It works perfectly 🙂
    Thank you

    🙂

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Archives.’ is closed to new replies.