• Resolved cpkid2

    (@cpkid2)


    Please check out my code. Basically, I want another
    < li > added when it’s on the “how-tos” page.

    <div id="sidebar">
    	<ul>
    		<li>
    		<?php login_with_ajax(); ?>
    		</li>
    
    		<li>
    		<h2>Connect</h2>
    		<center>
    		<a title="Follow Us On Twitter!" href="https://www.twitter.com/socialmediate" style="margin-right: 10px;" target="_blank"><img alt="Follow Us On Twitter!" src="https://www.socialmediate.com/wp-content/themes/socialmediate/images/twitter.png"/></a>
    		<a title="Add Us On Facebook!" href="https://www.facebook.com/pages/Social-Mediate/127797375765" target="_blank"><img alt="Add Us On Facebook!" src="https://www.socialmediate.com/wp-content/themes/socialmediate/images/facebook.png"/></a>
    		</center>
    		</li>
    
    		<?php
    		if (is_page('how-tos')) { ?>
    		<li><h2>Previous How To's</h2>
    		<?php query_posts('cat=4'); ?>
    		</li>
    		<?php } ?>
    	</ul>
    </div>
Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter cpkid2

    (@cpkid2)

    @t31os_

    I tried changing the name of the page in the code since I did realize the ‘features’ page was indeed capitalized. I thought I was supposed to enter the slug id. However, that still didn’t work. So I changed <?php if(is_page('features')) : ?> to <?php if(is_page('features')); ?> and got rid of the <?php endif; ?> at the end. Now everything is working fine.

    Would I be ok with this altered code as well or does it go against better coding practices? I’m still dumbfounded as to why the previous code worked for you and not me.

    Thread Starter cpkid2

    (@cpkid2)

    Err…scratch that. I just realized the ‘featured’ li is showing up for all pages and not just the ‘featured’ page. For the time being, I think I will just create separate sidebars for each page (e.g. sidebar-features.php)

    It’s yours to do with as you choose.. ??

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Variable Sidebar…why isn’t my code working?’ is closed to new replies.