• Greetings and happy new year 2006,

    I would like to somehow redefine “home()” — the reason is that I would like the default page to be a category view.

    Namely, if you go to https://blog.swiatek.name (a useless blog with information nobody reads :)) you will see that there is a horizontal menu which is an ennumeration of the categories.
    What I would like to have is to directly jump into the “paplanie” category (first menu item) when accessing https://blog.swiatek.name
    (in other words so that https://blog.swiatek.name in fact opens https://blog.swiatek.name/?cat=1). I know how to do redirections in Apache but I would prefer to use a clean and native wordpress mechanism.

    I understand that this will effectively break my blog into a few blogs accessible via the horizontal manu and that I will not have a page listing all posts — and this is exactly what I am looking for ??

    I would be grateful for a pointer (or solution).

    Thank you,
    Wojtek

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try adding something like this to a file named functions.php in your theme’s directory. It adds a rewrite rule that should do what you want. (functions.php needs to begin with <?php and end with ?>).

    function home_redirect($rules) {
    $newrules['$'] = 'index.php?cat=1';
    $rules = array_merge($newrules,$rules);
    return $rules;
    }
    add_filter('rewrite_rules_array', 'home_redirect');

    It works for me.

    Thread Starter wsw70

    (@wsw70)

    Thanks for the hint but it did not work.
    Now – I wonder whether the finctions.php file is read in at all. I have a similar problem with the style.css file — if I update it the changes do not appear (for instance for my horizontal menu). If I add the CSS entries directly in header.php then it works.
    I use WordPress 2.0 — the latter used to work in 1.5.

    Just a though — I would appreciate someone more knowledgable to comment.

    Thank you,
    Wojtek

    Thread Starter wsw70

    (@wsw70)

    I decided to go for mod_rewrite in Apache to handle this and it works. I added lines like
    RewriteRule /paplanie /index.php/?cat=1
    in the definition of my virtual host (together with a RewiteEngine on).

    The question of style.css not being parsed is still there, though ??

    Thanks,
    Wojtek

    Now – I wonder whether the finctions.php file is read in at all.

    It should be functions.php not finctions.php.

    Thread Starter wsw70

    (@wsw70)

    Sorry for the delay – I had some issues with the blog and reverted back to pure standards ??

    The summary is that the trick above definitely does not work (sorry for the typo in the name – I was of course looking at functions.php).

    I really wonder whether this file is parsed at all as it was empty before I added the lines suggested by filosofo

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘redefining home()’ is closed to new replies.