• HI Folks , I’m having trouble in finding the source of of my rogue text, it’s appearing on all pages except the home page, here’s a link to about page(end of page you’ll see the text registration_sidebar etc) http://dunamaisebeekeepers.com/index.php/about-beekeeping-in-laois/

    and here’s my php sidebar function file.Any help in this regard would be greatly appreciated.

    <div id=”sidebar”>
    <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Sidebar’) ) : ?>
    <?php endif; ?>
    </div> <!– end #sidebar –>

    register_sidebars( 1,
    array(
    ‘name’ => ‘widgetized-page-top’,
    ‘before_widget’ => ‘
    <div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>
    ‘,
    ‘before_title’ => ‘
    <h2 class=”widgettitle”>’,
    ‘after_title’ => ‘</h2>

    )
    );

    register_sidebars( 1,
    array(
    ‘name’ => ‘widgetized-page-bottom’,
    ‘before_widget’ => ‘
    <div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>
    ‘,
    ‘before_title’ => ‘
    <h2 class=”widgettitle”>’,
    ‘after_title’ => ‘</h2>

    )
    );

Viewing 1 replies (of 1 total)
  • I can tell you exactly what’s wrong. You’re trying to mix PHP code in with your HTML, and doing it the wrong way, and in this case in the wrong place as well.

    This part is where you’ve started going wrong:

    ...
    </div> <!-- end #sidebar -->
    
    register_sidebars( 1,
    array(
    ...

    You can’t just start PHP code without an opening <?php tag, so if you were really going to do this, it would be like:

    ...
    </div> <!-- end #sidebar -->
    <?php
    register_sidebars( 1,
    array(
    ...

    BUT…

    The PHP code that you have there should not be in the sidebar.php file. It should be in the functions.php file of your theme, or the ‘main’ file of whatever plugin that you’re uisng it with. It also needs to be called by the correct action to work properly.

    Something like this…

    <?php
    add_action( 'init', 'register_my_sidebars') ;
    
    function register_my_sidebars() {
        // Your PHP code goes in here!!!
    }
Viewing 1 replies (of 1 total)

The topic ‘rogue html’ is closed to new replies.