• Resolved chase453

    (@chase453)


    I know this should be an easy question, but I’ve been searching for over an hour and can’t seem to find a solution to this simple issue. How can I insert a break or separator between widgets in a dynamic sidebar? For example, in my side, I have a dynamic sidebar (col2) and a static sidebar (col3). I can edit the static sidebar with whatever html I want to include breaks, but I can’t find where I can insert a break into the dynamic sidebar anywhere.

    If you look at my site, https://www.chasecheviron.com, you’ll see the 3rd column is how I want it..with a line break in between the “search” and “recent photos” headings, but the 2nd column has “archives” and the calendar smashed together w/ no break between them.

    Ideas??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Give the following page a read:
    https://automattic.com/code/widgets/themes/

    What you’ll want to do is edit your functions.php file to say something like this:

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
            'before_widget' => '',
            'after_widget' => '<br />',
            'before_title' => '',
            'after_title' => '',
        ));
    ?>

    Thread Starter chase453

    (@chase453)

    Excellent!! Thank you for the help — I ended up using the above code (minus this part below):

    ‘before_title’ => ”,
    ‘after_title’ =>”,

    I found that if I included this part, the headings appeared incorrectly. So, just got rid of that, and it works like a charm. Thanks again.

    Yep! Glad I could be of help!

    Can you tell me please how can i insert php code into
    ‘before_title’ => ‘here i need php’,

    Here is the code that is in my functions.php – when I try to edit it to add the breaks it trashes the entire WP install and I have to revert to a fresh functions.php file.

    Does anyone have any idea how to help me get some breaks between these damn widgets? This is the code at the top of functions.php right now… what should it be changed to?

    `<?php
    if ( function_exists(‘register_sidebar’) )
    register_sidebars(2);’

    this might work:

    <?php
    if ( function_exists('register_sidebar') )
    {
        register_sidebar
        (   array
            (
              'name' => 'name-one',
              'before_widget' => '',
              'after_widget' => '<br />',
              'before_title' => '',
              'after_title' => '',
            )
        );
        register_sidebar
        (   array
            (
              'name' => 'name-two',
              'before_widget' => '',
              'after_widget' => '<br />',
              'before_title' => '',
              'after_title' => '',
            )
        );
    }
    ?>

    you will want to replace the names (name-one/name-two) with whatever you named your sidebars in the theme.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Insert break in dynamic sidebar’ is closed to new replies.