StylizedWeb is a blog about web trends and tutorials, KnowHow community forum now maintained by Ross Johnson who also runs a web design company and design blog.

Categories Archive

Popular Posts
Advertisement
Premium WordPress Themes, Theme Galaxy Basecamp
Najbolje ponuda IT poslova u Srbiji na itposlovi.info Advertise on Stylized Web

Amazing WordPress hacks part 2

add to Save to Delicious Save to Stumble Save to Digg

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!

Wordpress post expiration code (option two)
 
*** 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; ?>
 
Secure your wp-includes folder
 
Order Allow,Deny
Deny from all
<Files ~ ".(css|jpe?g|png|gif|js|swf)$">
Allow from all
 
Wordpress Static HTML Template
 
<?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();
 
?>
 

What do you think?





20 Responses so far

By chat
on December 3, 2008

wery cool

By Premium Wordpress Theme
on November 12, 2008

Great Article. Been trying to integrate more static pages in my design.

By Dejan Cancarevic
on July 22, 2008

Rooney,
damn, yea it way a mistake, it’s corrected now, thanks

By Rooney
on July 19, 2008

Is the “Amaizing” spelling mistake intentional ?

By Davidc
on July 14, 2008

very cool!

By Omar
on July 14, 2008

i have to agree with Kyle, this is usefull but first part was better :O

By hotels
on July 13, 2008

Awesome! thanks a lot

By Kyle
on July 13, 2008

very nice, but i liked the frist part more heh

By Majda
on July 13, 2008

Amazing, thanks a lot! :-)

  1. Sep 10, 2008: Websites you Shouldn´t have missed in JULY 2008 | POLPDESIGN
  2. Sep 1, 2008: S A N D E E P [ I N D I A N I C ] » Blog Archive » Websites you Shouldn´t have missed in JULY 2008
  3. Aug 4, 2008: Websites you Shouldn´t have missed in JULY 2008
  4. Jul 30, 2008: The Giant List of Wordpress Hacks
  5. Jul 30, 2008: Best of July, 2008: This Month in Web Design | Vandelay Website Design
  6. Jul 17, 2008:   Table Of Contents Of Wordpress Tutorials, Helps, Tips and Tricks by aComment.net
  7. Jul 16, 2008: links for 2008-07-16 | הבלוג של אח"י דקר
  8. Jul 15, 2008: Rss VURSAKnoktacom » Blog Arşivi » Links for 2008-07-14 [del.icio.us]
  9. Jul 14, 2008: Amaizing WordPress hacks part 2
  10. Jul 13, 2008: Amaizing WordPress hacks part 1 | StylizedWeb.com