cpkid2
Forum Replies Created
-
Thanks t31os!
The code works fine but I can’t get it to work with post excerpts. Any ideas? I’d like it so a message pops up in the post excerpt.
Forum: Fixing WordPress
In reply to: Variable Sidebar…why isn’t my code working?@t310s_ I just tried your code. However, the “Previous Features” li didn’t show up on the ‘features’ page.
Forum: Fixing WordPress
In reply to: Variable Sidebar…why isn’t my code working?I realized the code above doesn’t include the endif. I must have taken it out at the last second. Anyway, this is the code.
<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 $prev = new WP_Query('cat=3'); $prev->query('showposts=10'); print_r($prev); if (is_page('features')){ echo('<li><h2>Previous Features</h2></li>'); while ($prev->have_posts()) : $prev->the_post(); ?> <div class="spost"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div> <?php endwhile; endif; ?> } </ul> </div>
Forum: Fixing WordPress
In reply to: Variable Sidebar…why isn’t my code working?Thanks, I tried your code. However, I get an unexpected endif syntax error on line 23…
<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 $prev = new WP_Query('cat=3'); $prev->query('showposts=10'); print_r($prev); if (is_page('features')){ echo('<li><h2>Previous Features</h2></li>'); while ($prev->have_posts()) : $prev->the_post(); ?> <div class="spost"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div> <?php endwhile; ?> } </ul> </div>
thank you t31os! when i get back home i will attempt to dissect the code you posted. i really appreciate you taking the time to help me out!!
Forum: Fixing WordPress
In reply to: Variable Sidebar…why isn’t my code working?Thanks for the replies.
@apljdi I tried following the instructions in the tutorial and came up w/ the following. It’s not working but I’m hoping you can give me some guidance.
<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 $prev = new WP_Query('cat=3'); $prev->query('showposts=10'); if ('is_page('features')'); echo('<li><h2>Previous Features</h2></li>'); while ($prev->have_posts()) : $prev->the_post(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li> <?php endwhile; endif; ?> </ul> </div>
Forum: Fixing WordPress
In reply to: Variable Sidebar…why isn’t my code working?That got the h2 element to show up but not the posts in category 4. Any ideas? Thanks for your help!
t31os_, if you can write up an example, it would help me tremendously. ??
I’m familiar with xhtml and css but am still a newbie when it comes to php.
Still can’t get more than one post to show up. Here is the code I have. If anyone can help me figure out what’s wrong with it, I’d appreciate it.
https://wordpress.pastebin.com/m408cbe3f
The lines highlighted in yellow is the box I’m having trouble with.
I tested it with the two posts I have now by changing numberposts=2 and it didn’t work. I’m assuming it would be the same if I created 3 more posts in that category and changed the number back to 5.
I’m an idiot. I entered the wrong category number. However, I have a new problem now. Only one post is showing up although numberposts=5.
Is there something else I overlooked?
Erm…still no luck. =/ I’m still getting nothing in the “carousel” div.
I’m placing this code in index.php in a separate section above my blog posts. Here is my code for index.php:
https://wordpress.pastebin.com/m721b0f92
Thanks for helping!
Thanks esmi but that’s not pulling in the posts either. I still get a blank box. Any other ideas?
Thanks, esmi. I read over the link you posted and tried to implement it into my site. However, I screwed something up because nothing is showing up inside my div. Here is what I have.
<div id="carousel" style="border: 2px solid rgb(241, 241, 241); height: 184px; margin-bottom: 20px;"> <ul> <?php global $post; $myposts = get_posts('numberposts=5&offset=1&category=2'); foreach($myposts as $post) : ?> <li> <div class="entry"> <?php the_excerpt(); ?> </div> </li> <?php endforeach; ?> </ul> </div>
Can you let me know what I’m doing wrong?