Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

logicstar on "Replace some Post with custom Image when the post expired"

$
0
0

Hello Friends,
first of all sorry for my bad english, and i am newbie here

I am totally desperate here :(

I am developing theme for events, and it is using auto expiration method, when the post is expired it will be auto hide, i am following the tutorial from this site
http://j3webworks.com/blog/wordpress-make-posts-expire-or-auto-delete
and it is working like a charm.
but I want to set, when some post is expired it will be replaced with some custom image/ link.

This is what i want;
- first it shows 3 posts, when 1 posts is expired, it will be replaced with custom image no 1
- when 2 posts expired it will be replaced with custom image no 2
-when all 3 posts is expired/ not displayed at all, it will be show custom image no 3

like this;

1st posts expired -> show custom image no 1 at the bottom
2nd posts expired -> show custom image no 2 at the bottom
3rd posts expired / 0 post -> show custom image no 3

tried using post count ($count++) but it is not working

below is my code

<?php
$args = array(
'showposts' => 3,
'category_name' => 'events');

query_posts($args);
 while (have_posts()) : the_post(); $data = get_post_meta( $post->ID, 'events', true );
include (TEMPLATEPATH . '/includes/global-metabox-hook.php');
$expirationtime = get_post_custom_values('expiration');
if (is_array($expirationtime)) {
$expirestring = implode($expirationtime);
}
$secondsbetween = strtotime($expirestring)-time() - 10800;
if ( $secondsbetween <= 0 && $data[ 'autodelp'] == 'yes') {
wp_delete_post($post->ID, false);
} elseif ( $secondsbetween <= 0 && $data[ 'autodelp'] == 'no') {
} elseif ( $secondsbetween > 0) { ?>			

<div class="small-post">
<div class="date-event-circle">
<p class="date"><?php the_time('j'); ?></p>
<p class="month"><?php the_time('M'); ?> </p>
</div>
<div class="small-post-detail">
<?php if($meta_gallery){ ?>
<?php foreach ( $meta_gallery['docs'] as $img ) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
<?php $thumb_img = $img['imgurl'];?>
<img  class="home-event-thumb" src="<?php bloginfo( 'template_url' ); ?>/timthumb.php?src=<?php echo $thumb_img; ?>&w=728&h=340&zc=1" alt="" />
</a>
<?php } ?>
<?php } ?>

<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" ><?php the_title(); ?></a></h3>
</div>
</div>
<?php } else { ?>
<?php } ?>
<?php endwhile; ?>

hope my explanation is clear
help me please :)


Viewing all articles
Browse latest Browse all 8245

Trending Articles