The MU forums have moved to WordPress.org

Can I block 1 sidebar within a template from being altered with widgets? (12 posts)

  1. dutchy4c
    Member
    Posted 18 years ago #

    On my site I am using a 4 column template, and that is the only one available for people with sub sites. Within this, I want to allow them to change 2 side-bars, but have 1 side bar, with a search function and my Google-ads, permanently fixed. Is that possible to set somewhere?

  2. demonicume
    Member
    Posted 18 years ago #

    yes, remove the dynamic sidebar code. remove this:

    '<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>'

    this will de-widgetize that sidebar. then code it however you want.

  3. andrea_r
    Moderator
    Posted 18 years ago #

    Or put the code you don't want them to change outside of that code above or the php end if at the end of the sidebar.

    I do this with a counter plugin we have.

    Like this:
    '<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>'
    widgetized sidebar stuf
    < end if soemwhere>

    Then add your code.

  4. dutchy4c
    Member
    Posted 18 years ago #

    Thank you demonicume. I have tried that, but it removes the whole side bar and gives an error: "Parse error: syntax error, unexpected T_ENDIF in"

    The code is: <div id="r_sidebar"> <ul id="l_sidebarwidgeted"> <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?> <?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php endif; ?> </div>

    Which part do I remove to keep the search in that column?

  5. andrea_r
    Moderator
    Posted 18 years ago #

    You don't remove it - you just MOVE it. demonicume was incorrect. To keep the search but still have things widgetized, do this:

    <div id="r_sidebar">
     <ul id="l_sidebarwidgeted">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
    <?php endif; ?>
    
    <?php include (TEMPLATEPATH . '/searchform.php'); ?> 
    
     </div>
  6. dutchy4c
    Member
    Posted 18 years ago #

    Thanks Andrea.. Gain... You're a life saver. Did you ever manage to talk to Ron..?

  7. dutchy4c
    Member
    Posted 18 years ago #

    Still.. I have it working, but that side bar is still dynamic, i.e. they can still add widgets. I don't want them to be able to add widgets to that one side bar. I have the search and the Google ads running there, and that should be all.

    Which part do I alter then?

    Thanks.

  8. lunabyte
    Member
    Posted 18 years ago #

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
    <?php endif; ?>

    Or whatever it is in that particular sidebar, just take it out.

  9. dutchy4c
    Member
    Posted 18 years ago #

    Perfect.. That is it..! Thanks.

  10. andrea_r
    Moderator
    Posted 18 years ago #

    Doh, yeah luna's correct as usual. ;) I was speedreading thru the original post.

  11. mark-k
    Member
    Posted 18 years ago #

    I wonder, don't you need to change the admin functions of the theme as well and remove the sidebar registration code, in order to not confuse the users with a mysterious side bar which can be configured but is never being displayed?

  12. demonicume
    Member
    Posted 18 years ago #

    so am i still incorrect?. i thought i said the same thing he did. my bad, i forgot to mention deleting the '<?php endif; ?>'. thats what the whole 'unexpected' line was about

About this Topic

  • Started 18 years ago by dutchy4c
  • Latest reply from demonicume