• Resolved thearslan

    (@thearslan)


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    Thread Starter thearslan

    (@thearslan)

    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

    Thread Starter thearslan

    (@thearslan)

    here is the sidebar code in function.php

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

    Hi therslan,

    So you’ll want to try this then:

    https://pastebin.com/UFNRemMH

    Let me know if that works.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I want to edit my sidebar.php by fail (Help me)’ is closed to new replies.