Welcome To Snipplr
Everyone's Recent 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
878
posted 15 years ago by cyberhobo
Function to add custom body class in th Thesis theme for WordPress...Thanks to @girliegeek!
1
956
posted 15 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
664
posted 15 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
792
posted 15 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
700
posted 15 years ago by paulgrenwood
For use in conjunction with the get_work function in the theme functions template, functions.php.
0
660
posted 15 years ago by tylersticka
For use within The Loop, in your portfolio item page template.
0
775
posted 15 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
794
posted 15 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
1093
posted 15 years ago by cyberhobo
Select the first and last item in an unordered list. As an example, I add a CSS class to each.
In WordPress, it's not so easy to get wp\_list\_pages() to generate these classes. jQuery provides an easy out for javascript-enabled clients.
0
1021
posted 15 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
814
posted 15 years ago by cyberhobo
In addition to the recommendations on the Wordpress Website.
Limit the amount of PHP files that a writable by Apache. The directory's and files that need to be writable, do not always need to be executed by PHP directly.
This makes it a bit har...
1
713
posted 15 years ago by occam
Create a custom 404 handler page which redirects you to the correct page.
1
719
posted 15 years ago by Meander365
Using this loop variation you can style differently the first and the last post of a loop, or whatever post you like, as lond as you add a new elseif with the number of the post you desire.
5
985
posted 15 years ago by crs
The following will cause the "comments closed" line to not display on both posts and pages.
2
2683
posted 15 years ago by fabi
Adds two "sidebars" to the header. You can drag and drop widgets into them just like any other sidebar from your WP dashboard. You can change the Hook to move the "sidebars" somewhere else on the page. For example, change 'thesis_hook_header' to '...
4
1966
posted 15 years ago by fouroclockproject
Completely changed original function, which stopped working around WP2.8.
1
823
posted 15 years ago by kristarella