I have a "daily tip" custom post type and I use the following code to display the most recent post in my sidebar (below).
The pop up only shows up on the home page, and archive pages, not on posts.
I remove the code and everything works fine again.
Do I need to use different code for this purpose? or is there something I can change to make everything work?
thank you!
my site is: http://photoshoptrainingchannel.com
Code: Select all
<div class="sidebar_tip_day widget">
<div class="widget-wrap">
<div class="in_page_tip_day">
<?php
$args = array( 'post_type' => 'tip_of_the_day', 'posts_per_page' => 1 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="tip-content">';
echo '<div class="page_tip_date">';
echo '<a href="';
echo the_permalink();
echo '"/>';
echo the_date();
echo '</a> ';
echo '</div>';
echo '<h4>Tip Of The Day</h4>';
the_content();
echo '</div>';
echo '<div class="tip_facebook">';
echo '<div class="fb-like" data-href="';
echo the_permalink();
echo '" data-send="false" data-layout="button_count" data-width="95" data-show-faces="false"></div>';
echo '</div>';
echo '<div class="tip_google">';
echo '<g :p lusone href="';
echo get_permalink($postid);
echo '" size="medium"></g :p lusone></div>';
echo '<div class="tip_twitter"> <a href="http://twitter.com/share" class="twitter-share-button" data-url="';
echo the_permalink();
echo '" data-count="horizantal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>';
endwhile;
?>
</div>
<div class="tip_outro"><p>Click the social share buttons above ↑
if you liked today's <a href="http://photoshoptrainingchannel.com/tips/" title="Click Here To See Past Tips Of The Day">Tip of The Day!</a></p></div>
</div>
</div>