WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] I want to edit my sidebar.php by fail (Help me) (5 posts)

  1. thearslan
    Member
    Posted 2 years ago #

    Hi, I want to edit my sidebar and want to insert this code to show specific category posts in sidebar

    [Code moderated as per the Forum Rules. Please use the pastebin]

    This is code is working fine in my theme. And I want to add this to my sidebar.php but when I opened sidebar it shows like this

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    I looked in to function.php but nothing helped me but i found this code there

    [Code moderated.]

    Any help to insert that code in my sidebar so it will be show on all pages in sidebar.
    waiting for your kind response
    Thanks

  2. David A. Kennedy
    Member
    Posted 2 years ago #

    Hi thearslan,

    What theme are you using?

    You don't need to edit your functions.php file. You'll want to find a template file in your theme called sidebar.php. It should have code kind of like this:

    <?php if ( is_sidebar_active('primary-widget-area') ) : ?>
    		<div id="primary" class="widget-area">
    			<ul class="xoxo">
    				<?php dynamic_sidebar('primary-widget-area'); ?>
    			</ul>
    		</div><!-- #primary .widget-area -->
    <?php endif; ?>

    Then you'll want to add your code above or below the part that pulls in the sidebar widget. Like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Hope this works for you.

  3. thearslan
    Member
    Posted 2 years ago #

    Hi David, Thanks for your reply, As I told you that I have only below code in sidebar.php

    <div id="sidebar" class="grid4">
    			<?php dynamic_sidebar( 'sidebar' ) ?>
    		</div>

    Its nothing else there in sidebar.php.
    And when I put some new code in sidebar.php its showing nothing, Now tell me how can I add something there.

    Waiting for your kind reply

  4. thearslan
    Member
    Posted 2 years ago #

    here is the sidebar code in function.php

    [Code moderated as per the Forum Rules. Please use the pastebin]

  5. David A. Kennedy
    Member
    Posted 2 years ago #

    Hi therslan,

    So you'll want to try this then:

    http://pastebin.com/UFNRemMH

    Let me know if that works.

Topic Closed

This topic has been closed to new replies.

About this Topic