sweet, thanks.
Ok, here it is! The second part of Amazing WordPress hacks article, hope you'll enjoy this one as you did the part one where we have learned how to forward section pages, Grab the textual content of a Post, Load a stylesheet with dynamic values dependent on the Page view, set Post Expiration time and date etc.
And now we will see how to set Post Expiration time and date in another way, Secure your wp-includes folder and how to make Wordpress Static HTML Template. There's going to be some more interesting WordPress articles so stay tuned!
*** enter a custom field with the key "expiration" and set the value in the format "2007/01/01" *** ***PUT THIS INSIDE THE LOOP, FIRST THING*** <?php //to check against expiration date; $currentdate = date("Ymd"); $expirationdate = get_post_custom_values('expiration'); if (is_null($expirationdate)) { $expirestring = '30005050'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP; } else { if (is_array($expirationdate)) { $expirestringarray = implode($expirationdate); } $expirestring = str_replace("/","",$expirestringarray); } //else if ( $expirestring > $currentdate ) { ?> ***THEN PUT THE FOLLOWING LINE AT THE VERY END OF THE LOOP*** <?php } //end if for expiration; ?>
Order Allow,Deny
Deny from all
<Files ~ ".(css|jpe?g|png|gif|js|swf)$">
Allow from all
<?php unset($_SERVER['PATH_INFO']); //Include current WordPress Theme Header etc. // Change the path if wordpress isn't in the webserver root directory require($_SERVER['DOCUMENT_ROOT'] . '/wp-blog-header.php'); //Check if we're wrapping the WP Theme //Get Theme settings. $themes = get_themes(); $current_theme = get_current_theme(); $current_template_dir = $themes[$current_theme]['Template Dir']; $current_stylesheet_dir = $themes[$current_theme]['Stylesheet Dir']; //Include the WP Header get_header(); /* Your static HTML goes after here */ ?> <?php get_sidebar(); get_footer(); ?>
Have some feedback? Leave a commentsweet, thanks.
wery cool
Great Article. Been trying to integrate more static pages in my design.
Rooney,
damn, yea it way a mistake, it’s corrected now, thanks
Is the “Amaizing” spelling mistake intentional ?
Greate, I’ve added it to here
http://acomment.net/table-of-contents-of-wordpress-tutorials-helps-tips-and-tricks/4
very cool!
i have to agree with Kyle, this is usefull but first part was better :O
Awesome! thanks a lot
very nice, but i liked the frist part more heh
Amazing, thanks a lot!
on February 5, 2010
Enjoyed the first article of this series, like this one just as much, thanks for the research.