Monday, January 31, 2011

Set An Expiration Time For Wordpress Posts

Set An Expiration Time For Wordpress Posts:

Sometimes (like, when we are running a contest), We want to be able to publish a post and then automatically stop displaying it after a certain date. This may seem quite hard to do but using the custom field we can do this easyly.

To do this Edit the WP theme and replace the current WordPress loop with this "modified" code:


if (have_posts()) :
while (have_posts()) : the_post(); ?>
$expirationtime = get_post_custom_values('expiration');
if (is_array($expirationtime)) {
$expirestring = implode($expirationtime);
}

$secondsbetween = strtotime($expirestring)-time();
if ( $secondsbetween > 0 ) {
// For example...
the_title();
the_excerpt();
}
endwhile;
endif;



To create a post set to expire at a certain date and time, Like create a custom field. Specify expiration as a key and your date and time as a value (with the format mm/dd/yyyy 00:00:00). The post will not show up after the time on that stamp


**This code does not remove or unpublish post, It just prevents it from being displayed in the loop.

Thursday, January 6, 2011

How to make capital letters with CSS style

You can capitalize words and letters with this css.

.classname{
text-transform: capitalize;
}

This is make Abcde to Abcde

.classname{
text-transform: uppercase;
}

This is make abcde to ABCDE

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off