WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Custom Category Templates] WordPress supports this functionality natively

[Resolved] [Plugin: Custom Category Templates] WordPress supports this functionality natively

Viewing 12 replies - 1 through 12 (of 12 total)
  • And what if you want to use the same template on several categories?
    Say, 4 categories of 20 on the site? WP doesn’t support this.

    Sure it does 🙂

    Just setup something like this in category.php

    $currentCategory = get_query_var( 'cat' );
    $fruitCategories = array( 'apples', 'oranges', 'bananas' );
    $vegitableCategories = array( 'tomatoes', 'peppers', 'carrots' );
    
    if( in_array( $currentCategory, $fruitCategories ) )
        require_once( 'category-fruit.php' );
    elseif( in_array( $currentCategory, $vegitableCategories ) )
        require_once( 'category-vegitables.php' );
    Plugin Author shazdeh

    @shazdeh

    Same goes for custom page templates, so why WP supports that? 🙂
    I think the main point is that with this plugin you can ship custom templates for category views, and let the theme user choose one. That snippet above does not allow for that. Also, it’s a lot simpler with this plugin than to code it by hand which is really hard for some people 😉

    @ian, I have searched everywhere for this solution! Thank you for taking the time to post it.

    Please can I have more detail, step by step on how to customized a category page? For instance I want to have an image at the top of a category page before having the posts below. like Basile BOLI blog for instance at here: http://www.africatopsports.com/actu/basile-boli-2/

    @thomasgafo, I am using the Rich Tax Description Editor plugin to customize my category pages. It allows you to add images and formatted text to your category description. Make sure that you theme options are set to show category descriptions. (Some themes don’t display category descriptions, and in that case you would need to edit your theme, so that descriptions are displayed.)

    Please I am using arras theme. and this is the website. http://www.africatopsports.com

    Install and activate the plugin I mentioned. You will see that your category description area now has a rich text editor that looks similar to your post editor. You can add images to your category descriptions and format the text in the same manner that you with your posts. The description will be displayed at the top of your category page along with any images that you added.

    I believe that the Arras theme does support category descriptions, so if your descriptions are not shown at the top of your category pages after you add them using the plugin, ask in the Arras forum how to enable them.

    Unfortunely they can not be shown.

    Thank you very much KILAKIWI. This code: “<div class=”catdesc”><?php echo category_description( $category ); ?></div>” help me out.

    That’s great, Thomas! Glad to hear it.

    Hello, I hope you are fine
    Please I would like to have an idea about this and if possible the solution. Is it possible tomake a background image clickable?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] [Plugin: Custom Category Templates] WordPress supports this functionality natively’ is closed to new replies.