Help me with my wordpress sidebar php code

Discussion in 'Programming' started by irule272, Jul 18, 2009.

  1. #1
    Hello!

    I've downloaded a theme and it has already a pre-made widget on it. The problem is these widgets are not visible on the widget setting on my admin cp and everytime I will add a new widget these pre-made widgets will automatically be remove. I wonder if is it possible to add a widget without my pre-made widget remove from the side or make my pre-made widget visible on my widget setting on my admin cp.


    Here's the code...

    <!-- begin sidebar -->
    
    
    <div id="sidebar">
    
    	<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
    	
    	PRE MADE WIDGETS HERE
    
    <!-- end sidebar -->
    Code (markup):
    I hope someone will fix this for me thanks!
     
    irule272, Jul 18, 2009 IP
  2. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #2
    No it is not. The pre-made sidebar is a default setting for when you have not added any widgets. It gets replaced when you add widgets, making it dynamic. The simple solution is to add those widgets in your admin cp.
     
    qazu, Jul 18, 2009 IP
  3. irule272

    irule272 Well-Known Member

    Messages:
    1,153
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    155
    #3
    gazu sorry I'm new in WP. What do you mean add those in admin cp? What file and code exactly?

    Thanks!
     
    irule272, Jul 18, 2009 IP
  4. porntorch

    porntorch Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The admin cp is the dashboard. The administration section of wordpress (where you log in to).
     
    porntorch, Jul 19, 2009 IP
  5. adrevol

    adrevol Active Member

    Messages:
    124
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Hi,

    if i understand correctly,

    You want your pre made widgets always available on the side bars . If so

    Please follow as below


    
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Left Navigation') ) : else : ?>
    
    SOme  Already  exisiting widgets  will be here 
    
    <?php endif; ?>
    
    Code (markup):
    Now, instead of placing your pre made widget in the else condtion
    try to place the widget code after endif

    like


    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Left Navigation') ) : else : ?>
    
    SOme  Already  exisiting widgets  will be here 
    
    <?php endif; ?>
    <li><h2>Search</h2>
    
    line 1
    line 2
    line 3 
    
    </li>
    Code (markup):


    Your premade widget will be always visible on your website


    Good luck
     
    adrevol, Jul 20, 2009 IP