WordPress.org

Support

Support » Themes and Templates » [Resolved] Widgetizing my theme

[Resolved] Widgetizing my theme

Viewing 12 replies - 1 through 12 (of 12 total)
  • Well it’s pretty straightforward. You just add the code that Matt clearly provided inside the sidebar, where indicated. He also advises using h2 instead of h3 or some other class to style sidebar headings.

    And he provides the code that should go into a new file called functions.php.

    What is so difficult about this?

    So, basically I have to add everything he posted? I just didn’t wanna screw anything up. I know, I got to backup, I always backup first.

    The only file you will be editing is sidebar.php. And you’ll be creating a new file, functions.php. That’s it. Just rename the original file sidebar.php.orig or something before you go performing surgery on it. 🙂

    See, that’s the thing that confused me, I already have a functions.php. Erase that one and make the new one?

    Can you cut and paste the contents of that file here?

    Be sure to use a backtick (to the left of the 1/! key) before and after the code.

    How much text is in that file?

    Or email me off list (check my profile) and I can help you with it. 🙂

    <?php
    function getWords($text, $limit)
    {
    $array = explode(" ", $text, $limit+1);
    
    if (count($array) > $limit)
    {
    unset($array[$limit]);
    }
    return implode(" ", $array);
    }
    ?>

    Not much in it, I’m sure It’ll screw something up if I delete it.

    Leave what’s there alone. Just at the top, AFTER the top <?php

    add this:

    if ( function_exists('register_sidebar') )
        register_sidebar();

    You’re just adding another function. 🙂

    Thank you so much for your time and patience. BTW, I like your site, you do some nice work. I was going to gmail you for help, again, thanks. 🙂

    No problem. And if you get stuck, just holler! 🙂

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] Widgetizing my theme’ is closed to new replies.