Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged wordpress
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This makes template code that applies to children of a particular page much more readable, especially if you can use a page path instead of an ID: `if ( is_child_of( 'topic/subtopic' ) ) :`.
1
717
posted 14 years ago by cyberhobo
Function to add custom body class in th Thesis theme for WordPress...Thanks to @girliegeek!
1
781
posted 14 years ago by joelhaus
Search Engine Optimisation, or SEO is something that a lot of bloggers get obsessed about, whilst others think it’s a load of rubbish. I’m halfway between the two – whilst I believe that you can change certain things to better SEO your content,...
0
490
posted 14 years ago by paulgrenwood
Whilst there are a number of ways of displaying thumbnails, this is still my favourite (even if it does require the most work!). First, upload timthumb to /wp-content/themes/yourtheme/ and create an image 250px by 250px with your site’s logo and up...
0
638
posted 14 years ago by paulgrenwood
This is something that I wished I’d thought of a long time ago – show other posts in the same series using not a plugin but custom fields. All you’ve got to do for this trick to work is create a custom field ‘Series’ with a link to each oth...
1
542
posted 14 years ago by paulgrenwood
For use in conjunction with the get_work function in the theme functions template, functions.php.
0
505
posted 14 years ago by tylersticka
For use within The Loop, in your portfolio item page template.
0
624
posted 14 years ago by tylersticka
Usually use in a template with `in_category()`, like `if ( in_category( 3 ) || in_subcategory( 3 ) ) { ...`. Tested in WP 2.8.4.
1
633
posted 14 years ago by cyberhobo
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.
1
903
posted 14 years ago by cyberhobo
There's no has\_children() function in WP 2.8.4, but get\_children() returns false if the post/page has no children, so it can serve the same purpose in a page template.
Outside a page template you'd have to add a global declaration for the $post...
2
644
posted 14 years ago by cyberhobo
Create a custom 404 handler page which redirects you to the correct page.
1
584
posted 14 years ago by Meander365