I used this snippet of code to set a different css class or id based on the page template. It could be modified to be conditional based on being the the home page as well. Also note that is had to be put in the code/document as a single line for it to work…..don’t know Full Article…
Delete Posts Revisions from Your Database
WordPress has a lot of good features and one of them is Post Revisions. This was included in WordPress 2.6, even though this is a good feature, it can cause some problems. One of them is increase the size of your database. Depending on how long it takes you to write a post, you might Full Article…
Horizontal Two-Tiered Conditional Navigation
We’ll need code to help us: 1) query the page, 2) determine if there are child pages, and 3) properly highlight both the .current_page_parent and .current_page_item links. If you’re wondering why the CSS seems overly verbose, it’s to make sure the :active and :hover states display correctly whether or not subpages exist — if they Full Article…
Display A Greeting Message On A Specific Date, Season or Occasion
The following code will dispaly a greeting message only on Christmas day.
Get Posts With A Specific Custom Field & Value
Add the query_posts() function just before the Loop. Change the meta_key and meta_value accordingly. The example shown below will get posts with custom field “review_type” with value “movie”.
Get the root page ID
Get the ID of the root (oldest ancestor, parent without parents) page relative to the current page in a WordPress page template. Can be helpful for use with wp_list_pages() to create navigation markup.
Page Redirect Template
A handy little page template for making a page redirect to any url. To use save the code as redirect.php, upload to your theme directory, and then when making a page select “redirect” as your page template. Then just enter ONLY the url you want to redirect to in the body copy for that page.
Navigation Menu for sections based on parent and grandparent 02
This code inserts the the sub pages of a parent page, and also the parent page as a link.