Subscribe to our updates:

A Design, WordPress and Tutorials Blog.

Dedicated to helping you learn the art and science of the web.

Amazing WordPress hacks part 2

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)
  2. *** enter a custom field with the key "expiration" and set the value in the format "2007/01/01" ***
  4. <?php //to check against expiration date;
  7. $currentdate = date("Ymd");
  8. $expirationdate = get_post_custom_values('expiration');
  9. if (is_null($expirationdate)) {
  10. $expirestring = '30005050'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP;
  11. } else {
  13. if (is_array($expirationdate)) {
  14. $expirestringarray = implode($expirationdate);
  15. }
  16. $expirestring = str_replace("/","",$expirestringarray);
  17. } //else
  18. if ( $expirestring > $currentdate ) { ?>
  23. <?php } //end if for expiration; ?>
Secure your wp-includes folder
  2. Order Allow,Deny
  3. Deny from all
  4. <Files ~ ".(css|jpe?g|png|gif|js|swf)$">
  5. Allow from all
WordPress Static HTML Template
  2. <?php
  4. unset($_SERVER['PATH_INFO']);
  6. //Include current WordPress Theme Header etc.
  7. // Change the path if wordpress isn't in the webserver root directory
  9. require($_SERVER['DOCUMENT_ROOT'] . '/wp-blog-header.php');
  13. //Check if we're wrapping the WP Theme
  14. //Get Theme settings.
  15. $themes = get_themes();
  16. $current_theme = get_current_theme();
  17. $current_template_dir = $themes[$current_theme]['Template Dir'];
  18. $current_stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
  20. //Include the WP Header
  21. get_header();
  23. /* Your static HTML goes after here */ ?>
  26. <?php
  28. get_sidebar();
  29. get_footer();
  31. ?>

Leave a comment on Stylized Web Have some feedback? Leave a comment

36 Comments So Far

  1. Amazing, thanks a lot! :-)

  2. By Kyle posted on July 13, 2008 at 11:36 pm

    very nice, but i liked the frist part more heh

  3. Pingback: Amaizing WordPress hacks part 1 |

  4. By hotels posted on July 13, 2008 at 11:39 pm

    Awesome! thanks a lot

  5. Pingback: Amaizing WordPress hacks part 2

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

  7. very cool!

  8. Pingback: Rss VURSAKnoktacom » Blog Arşivi » Links for 2008-07-14 []

  9. Pingback: links for 2008-07-16 | הבלוג של אח"י דקר

  10. Pingback:   Table Of Contents Of Wordpress Tutorials, Helps, Tips and Tricks by

  11. By Rooney posted on July 19, 2008 at 1:45 pm

    Is the “Amaizing” spelling mistake intentional ?

  12. By Dejan Cancarevic posted on July 22, 2008 at 12:22 pm

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

  13. Pingback: Best of July, 2008: This Month in Web Design | Vandelay Website Design

  14. Pingback: The Giant List of Wordpress Hacks

  15. Pingback: Websites you Shouldn´t have missed in JULY 2008

  16. Pingback: 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

  17. Pingback: Websites you Shouldn´t have missed in JULY 2008 | POLPDESIGN

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

  19. wery cool

  20. Pingback: Package of the most cool and useful websites of this month | Design it

  21. Pingback: links for 2008-07-14 | the markfr ditherings

  22. sweet, thanks.

  23. Pingback: Table Of Contents Of Wordpress Tutorials, Helps, Tips and Tricks | DevWebPro

  24. Enjoyed the first article of this series, like this one just as much, thanks for the research.

  25. I think they really went beyond on this article. Keep up the great work!

  26. Thanks for another great post. Keep it up!

  27. haha i hate so many of the originals of songs you mix, but all the one’s you do are just soo tight

  28. First-class story indeed. My boss has been seeking for this tips.

  29. Most of whatever you claim is astonishingly accurate and that makes me wonder why I hadn’t looked at this with this light previously. This piece truly did turn the light on for me personally as far as this specific issue goes. Nonetheless at this time there is one position I am not too cozy with and while I make an effort to reconcile that with the main theme of the issue, allow me observe what the rest of the subscribers have to point out.Well done.

  30. hack? not good

  31. Enjoyed the first article of this series, like this one just as much, thanks for the research.

  32. That it is actually a nice useful bit of details. Therefore i’m thankful that you just shared this very helpful info with us. Make sure you keep informed this way. Thanks for sharing.

  33. Let me amend my above stetemant to read, “Notes on Looking supports culture and people who make things happen. Without dogged pursuit by lovers and hard working souls, culture eludes us. Notes is dedicated to those people who kick butt for high culture.

  34. yeuFmC fvwtcncfkgbw

  35. I prefer your website! Do you have a fb or twitter page? I’d really love to meet up and discuss a couple of things. Thank you for all your work.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>