I’m working with a lot of WordPress based sites and there are some code snippets which I frequently use. I want to share them with you. 1. Prevent Direct File Access # No direct file load if (!empty($_SERVER['SCRIPT_FILENAME']) && 'functions.php' == basename($_SERVER['SCRIPT_FILENAME'])) { die ('He's dead, Jim!'); } Put this code on the top of …
All Posts Tagged
Tag: ‘code’
Re-numbering With jQuery
I needed this to do a quick re-numbering of featured items in a slider on the homepage because I was always changing the PHP code and the numbering got messed up. Code to do a quick re-numbering of ‘a span’ items in a unordered list: jQuery(document).ready(function() { renumber_featured_nav(); }); function renumber_featured_nav() { var ftabscount = …
Tip: Exclude Categories From Archive In WordPress
While working on a recent project, I came across a task: exclude certain categories from the archive page. I went the usual way to the WordPress codex -> query_posts and thought the following would do it: # Exclude categories | archive.php if ( is_home() || is_category('one') || is_category('two') ) { $current_cat = get_query_var( 'cat' ); …
Guest Posts And the_author() In Your WordPress Blog
This post is outdated: I have converted this into a plugin → more info & download As you may have seen I have a guest post on this blog written by Matt from phuketvogue.com. Since I am the only registered writer/author on this site, all posts are marked as ‘written by Toxane’ or something similar. …
PayPal donation form with CSS and jQuery for WordPress
Learn how to create a PayPal donation form, beautify it with a little bit CSS and validate the input with jQuery. You can also integrate the form into WordPress as a page template or use it on any other static HTML page.
WordPress Themes and the functions.php file
Loads of good free WordPress Themes are out there. And the most of them don’t make use (or at least no good use) of the ‘functions.php‘ file. This is how the WordPress Codex describes the file: A theme can optionally use a functions file, which resides in the theme subdirectory and is named functions.php. This …