Forums

How edit the location of sidebar widgets? (9 posts)

  1. digitalmonkey
    Member
    Posted 2 years ago #

    Hi I'm having this problem where I want to a div as separator/ title for my widgets only I don't know where to find the code for position of the widgets. This is what mean:

    ie:

    <h2>Search<h2> (have the title of the widget that is formed by the CSS instaed of the standard title font)

    next the widget; (search widget)

    followed by a div tag that's a separator.

    and then a new title for the next widget

    <h2>New posts<h2>
    New post widgets
    separator div tag

    and so on.. :D

    Is there a way of doing this within the sidebar php? Or anyway of doing it at all?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Best achieved using the before_widget and after_widget parameters for register_sidebar in your theme's functions.php.

    http://codex.wordpress.org/WordPress_Widgets_Api/register_sidebar

  3. digitalmonkey
    Member
    Posted 2 years ago #

    thanks Esmi! however most of that in the link went right over my head. I tried to add the div tag in the after_widget part but it just went crazy and returning a syntax error. I hope it's not too much to ask for a step by step guide.

    also I want to do some editting to title font size but so that it has different font styles. here's what I mean.

    I want the font to be formatted like this:
    <h3><'strong'>Search</'strong'> all posts</h3> splitting up the first and second words with the first being in bold. this is the code but I don't know how to automate it.

    'before_title'  => '<h2 class=\"widgettitle\">',
    'after_title'   => '</h2>' ); ?>
    'before_widget' => '<li id=\"%1$s\" class=\"widget %2$s\">',
        'after_widget'  => '</li>',

    also after ''should I add the div tag?

    thx

  4. digitalmonkey
    Member
    Posted 2 years ago #

    Is there a way just to edit the order of the widgets like a html where the ones you add are actually in the code. That seems the easiest way of me to edit them individually.

  5. digitalmonkey
    Member
    Posted 2 years ago #

    okay I screwed up the file after put the div in.

    <?php
    if ( function_exists('register_sidebar') ) {
       register_sidebar(array(
           'before_widget' => '<li id="%1$s" class="widget %2$s">',
           'after_widget' => '</li>''<div class="hr"></div>',
           'before_title' => '<strong><h3 class="widgettitle">',
           'after_title' => '</h3></strong>',
       ));
    }
    ?>

    I keep getting this error where ever I put it: Parse error:

    syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /functions.php on line 5

    and unable to access the dashboard after. I know I can easily fix the error by rewriting it with the original and ftping it up but I don't know where to put the div for inclusion.

  6. digitalmonkey
    Member
    Posted 2 years ago #

    bump :0

  7. alchymyth
    The Sweeper
    Posted 2 years ago #

    the last komma seems to be too much:

    </h3></strong>',
  8. digitalmonkey
    Member
    Posted 2 years ago #

    I'm not sure what you mean alchymyth, do you mean I have to remove the last comma? Or something else.

  9. alchymyth
    The Sweeper
    Posted 2 years ago #

    yes, take it away, it seems to indicate that enother array element is following, which is not.
    so it should look like this:

    </h3></strong>'

Topic Closed

This topic has been closed to new replies.

About this Topic