Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter freecorvette

    (@freecorvette)

    @threadi thank you for following up on this. Totally agree on the no solution label, so I decided to give it another try. However, while I was able to define a rewrite rule for any given path, like so:

    // wp-content/themes/<theme_name>/functions.php

    function homepage_to_category_rewrite() {
            add_rewrite_rule('^some/path/?$', array('category_name' => 'corveta-libera'), 'top');
    }
    add_action('init', 'homepage_to_category_rewrite');

    I could not find any way to do it for the homepage. Any regex matching empty paths like ‘^$’, ‘^/?$’, ‘^’ simply don’t have any effect.

    So I ended up with a rewrite rule in .htaccess:

    RewriteRule ^/?$ wp/index.php?category_name=corveta-libera [L]

    Thread Starter freecorvette

    (@freecorvette)

    Thank you for your suggestions. Unfortunately, I needed a way to display the exact layout of the category page, as it is defined within my template, including the category description, and not to recreate its content by adding pieces of content (such as post excerpts).

    So, for now, although I know it’s a terrible hack, I’ve just added this line into my index.php:

    if ($_SERVER[‘REQUEST_URI’] == ‘/’) {
    $_SERVER[‘REQUEST_URI’] = ‘/category/corveta-libera/’;
    }

    I’m not at all proud of it, but it does 100% what I need.

Viewing 2 replies - 1 through 2 (of 2 total)