Support » Fixing WordPress » redefining home()

  • 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 (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
    (in other words so that in fact opens 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,

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.

    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,

    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 🙂


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

    It should be functions.php not finctions.php.

    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.