WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Widgetizing my theme (13 posts)

  1. cinco312
    Member
    Posted 6 years ago #

    I'm using the sodelicious-black-10 theme and it's not "widgetized" I read this thread http://automattic.com/code/widgets/themes/ and still don't get it. What do I need to do to get this widgetized.

    Thanks.

  2. Joni
    Member
    Posted 6 years ago #

    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?

  3. cinco312
    Member
    Posted 6 years ago #

    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.

  4. Joni
    Member
    Posted 6 years ago #

    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. :-)

  5. cinco312
    Member
    Posted 6 years ago #

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

  6. Joni
    Member
    Posted 6 years ago #

    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?

  7. Joni
    Member
    Posted 6 years ago #

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

  8. cinco312
    Member
    Posted 6 years ago #

    <?php
    function getWords($text, $limit)
    {
    $array = explode(" ", $text, $limit+1);
    
    if (count($array) > $limit)
    {
    unset($array[$limit]);
    }
    return implode(" ", $array);
    }
    ?>
  9. cinco312
    Member
    Posted 6 years ago #

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

  10. Joni
    Member
    Posted 6 years ago #

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

    add this:

    if ( function_exists('register_sidebar') )
        register_sidebar();
  11. Joni
    Member
    Posted 6 years ago #

    You're just adding another function. :)

  12. cinco312
    Member
    Posted 6 years ago #

    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. :)

  13. Joni
    Member
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags