post-page

Useful WordPress Tricks (for the Theme Designer)

4
responses

Useful WordPress Tricks: StylizedWeb has an interesting article on simple but useful WordPress functions and code tricks that can make your theme succint, short and keep it optimized. Examples are simple to understand an include code to copy and paste to try on your own.

heading
4
Responses

 

Comments

  1. Dejan (3 comments.) says:

    thanks for mentioning me!

  2. ChaosKaizer (62 comments.) says:

    just wanna touch the include specific files tips for sidebar
    if you have additional sidebar like for single or archive you can do it like the following (WP2.5.x)


    get_sidebar($name); // arg $name is sidebar-"name".php

    the function will look for sidebar-single.php (inside theme dir) and load it if exists otherwise it will load the default sidebar.php.

    you can include section base sidebar base on wordpress hierarchical order. below is just a simple example (need to tweak it base on which section came first thought)

    if (is_single()){
    get_sidebar('single'); // include /theme/sidebar-single.php
    } elseif (is_archive()){
    get_sidebar('archive'); // include /theme/sidebar-archive.php
    } else {
    get_sidebar();
    }

  3. Dejan Cancarevic (3 comments.) says:

    thanks for the tip ChaosKaizer

  4. Roni (9 comments.) says:

    Pretty simple but got the point. Thx



Obviously Powered by WordPress. © 2003-2013

page counter
css.php