Can’t blame him, it was in the mid 90’s.
This post is part of the Picture of the Day Series for 2009.
Can’t blame him, it was in the mid 90’s.
This post is part of the Picture of the Day Series for 2009.
While working on a site recently, a common problem was run into using WordPress as a full fledged CMS. The issue was needing to have multiple content areas within the same Page. For a developer (front end or back end) this typically isn’t an issue, even inside of WordPress. Since the content area allows you to insert custom HTML a developer can just flip to HTML view and position things on the screen how they see fit. However, that’s not always a viable option when handing over content management to your client. The client may not have the knowledge nor the desire to learn HTML on their own. This can leave the theme creator in a difficult position. Luckily WordPress provides Custom Fields as one way to help get around this predicament.
Custom Fields in WordPress can be used for many things:
One “gotcha” of using Custom Fields to solve this issue is that the size of the input area is limited. There are possible ways around this limitation, but they’re outside the scope of this Post so we’ll save that for another time. Putting that all aside though, they can definitely help get you to where you need to be.
Custom Fields have two components, “Name” and “Value.” If you’re of the developer mindset, think of it as a simple key-value pair. You can have multiple identical keys even on the same Page/Post. Once you have used a key once it then becomes available from the select box on future Posts/Pages, making it easier to reuse custom fields for similar operations on other pages. You can use get_post_meta() anytime the WordPress core has been loaded for the Page view and you have access to a Post or Page ID.
Let’s take the third example, providing multiple content areas for a Page, as an example in using Custom Fields in your theme. We’ll be using get_post_meta(). Here are some basic steps to move towards putting this all together:
$sidebar_content = get_post_meta($post->ID, 'sidebar', false);
Some explanation:
From here, adding the extra content to your Page template is fairly simple. Perhaps you have a sidebar container you would like to place it into. You could use this PHP code to do that:
foreach ($sidebar_content as $content) {
echo '<p>' . $content . '</p>';
}
The above example would loop through each Custom Field you had added with the name ’sidebar’ and would display its content wrapped in a paragraph tag.
Using this overall approach you can now add custom content areas to specific Pages or expand upon the idea to perform other customizations such as easily formatting a thumbnail for a Post/Page. By using a custom field for the thumbnail, you can then format the thumbnail differently based on the context it is being displayed in, as opposed to just inserting it into the copy area of the Post/Page. For instance, if you wanted to wrap the copy around the image when displaying it as a full Post or Page you could do so, but if you wanted to display recent Posts on your homepage with the copy blocked to the right of the image, that now becomes easy as well (it’s just a matter of html/css markup at that point).
Life is hard as a dog, what can I say?
This post is part of the Picture of the Day Series for 2009.
I’ve released an upgrade to WordPress File Monitor, my plugin for notifying you when files are added/changed/deleted from your site. A few small bugs have been fixed and there is now an option to choose between checking file timestamps or using hashes of the files. Anyhow, check it out, let me know if you have problems with it :)
Added comments to SnipIt.me using Intense Debate. So you can now comment on photo’s, code samples, and URL’s (via the preview method instead of the redirect method). They’re hidden by default to keep the interface minimal, they can be displayed by simply clicking the View Comments link near the bottom.
Little did I know when I adopted a dog from the SPCA that I would be getting a gargoyle as well!
This post is part of the Picture of the Day Series for 2009.
… the world has had to put up with me now. I declare that 30 is the new 21. ;) Woot.
Roughly 9-10 months ago, I switched from my iPhone to an enV2 with Verizon. AT&T’s coverage was just horrible, basically making my iPhone an iPod Touch with an expensive monthly subscription cost. Anyhow, the enV2 served me well, but I got to where I was needing to keep a closer eye on some things (WordPress Easily, some work stuff, etc) so moving back to a real “Smart Phone” was making sense. Enter the BlackBerry Curve.
I have previously used a BlackBerry. I always remembered the BlackBerry as being a consistent and reliable device, but using the Curve I’m starting to realize just how much I really enjoyed the style of phone. It really is a well thought out device, from push email to the tactile nature of the keyboard, from how stable the platform and applications are to the new store for BlackBerry apps. So far I’m really enjoying the device. I won’t go on and on with a long review, but here are the basics as I see it, in no particular order:
Pro’s:
Con’s:
Overall, I would say my feelings about the device are positive. I’m really liking the new applications that are available and I’m pretty sure I’m addicted to the CrackBerry once again ;) Not to keep comparing it to the iPhone, but that’s really the only device worth trying to compare it to … in my opinion, the BlackBerry is still the Gold Standard to be beat. The iPhone rocks, but they still need to work some things out if the BlackBerry userbase is a target audience (which it may not be and that’s cool, there’s enough room for both products).
I’ve released a new WordPress plugin called WordPress File Monitor. Essentially, it keeps track of what files are installed in your WordPress install (or site) and watches for files being added/deleted/changed. One catch is that it does rely on WordPress being able to load in order to do its work. So if the malicious individual totally brings your site down, or removes WordPress from loading somehow, it won’t work. However, a lot of the hackers out there have gotten to where they like inserting code into your WordPress pages, sometimes code that you can’t even see because they make it only show up to search engines. This plugin will help protect you against that by alerting you when the changes are made or a file of theirs is added to your system.
Currently for tracking changes to files, it is just comparing the modified date of the file. Eventually I hope to make this more robust. Another note is that there is an option to exclude paths from what is being monitored by the plugin. If you use a plugin like WP Super Cache, it is highly recommended that you exclude its cache directory from being scanned. Otherwise you will constantly be notified of changes made to the cache files. In a future release I hope to make it auto detect WP Super Cache and not monitor those files. I also would not set it to scan more then every 15 minutes or so. Otherwise you run the risk of the plugin scanning your entire site every time someone visits your site, and that’s unnecessary load on the server.
Additionally, keep in mind, this is currently a pre-release beta. So if you find bugs, please let me know on the plugin page.
One final note … you should always be aware of what is on your site. This plugin will not replace you doing periodic scans of your site to make sure files haven’t been added or changed. I make no promises whatsoever of its ability to catch all changes to your site. In the end that responsibility rests with you and you alone. So keep an eye on your site, and hopefully this plugin will help you with that job.