No, I haven’t been slacking with my photography. I’ve been taking pictures, I just haven’t had time to add them to Flickr. Check out my new pictures! http://www.flickr.com/photos/dwieeb/
Author Archives: dwieeb
Pass Foreach Variables by Reference (PHP)
A recent trick I discovered while working on a Drupal module is the ability to pass the array element into a foreach loop by reference. Like so:
$array = array(1, 2, 3, 4, 5);
foreach ($array as &$element) {
if ($element == 3)
$element = 6;
}
print_r($array);
Your output would be:
Array
(
[0] => 1
[1] => 2
[2] => 6
[3] => 4
[4] => 5
)
Not only does this save on memory, it also allows you to change the actual items in the array. Quite useful.
Another example:
$array = array(
'cow' => 'moo',
'pig' => 'oink',
'cat' => 'meow',
);
foreach ($array as $key => &$element) {
if ($key == 'cat')
$element = 'bark!';
}
print_r($array);
Output:
Array
(
[cow] => moo
[pig] => oink
[cat] => bark!
)
Florida Photography
View the photostream.
New Year Photography
New WordPress Plugin: ScrollTo Top
Today I squeezed out a little plugin that will show a go-to-top icon in the corner of the page. When clicked, it will smoothly scroll the user’s browser to the top of the page using Ariel Flesler‘s ScrollTo jQuery plugin. The plugin comes with a few options to tweak it, like choosing or uploading your own icon, where the icon appears, etc.
I have yet to write a showcase page for it on this website, but you check out the plugin page on WordPress.org and download now: http://wordpress.org/extend/plugins/scrollto-top/
Specific Files 1.3 Released
The major change in this new version is the ability to apply Specific Files to all post types (including custom post types) or just apply it to posts and pages like it was originally made to do.
I have also relocated the Specific Files file directory to /wp-content/specific-files, where it should be easier to maintain (rather than copying the file directory into a temporary location while the plugin updates and when it finishes updating to copy it all back again). Because of this change, I have removed the available downloads of previous versions. I’m still rather new to how to handle plugin upgrades and I’m sure a few of you have gotten errors while trying to upgrade this plugin. For that I am sorry. I’ll get better at this stuff.
So – that’s my announcement. Download now! http://wordpress.org/extend/plugins/specific-files-for-posts-and-pages/
Specific Files 1.2 Released
Quite a few things have changed since the original 1.1 release. I’m going to focus on the changes between 1.1.3 and 1.2:
- I have added the ability to include inline CSS and JavaScript. This nifty feature
lets you write inline code in the header of certain pages and posts. Handy for people who can’t stand using the WordPress page editor to get that darned jQuery plugin working! - I have added the ability to hide these new advanced options. Simple folk may not need such high-tech gear. Plus, the WordPress page editor is busy enough, why add a few lines if you’re not going to use them?
- I have improved security. Just a few permission and nonce checks before executing some code ought’a do!

- I have improved the filename scrubber. In 1.1.3, it didn’t even scrub out commas! Can you imagine a comma separated list of files with commas in the filenames? It would be a disaster! 1.2 fixes this, among other filename sanitation techniques.
- I have upgraded the screenshots for people to preview before they download. You can find them here: http://wordpress.org/extend/plugins/specific-files-for-posts-and-pages/screenshots/
Download now! http://wordpress.org/extend/plugins/specific-files-for-posts-and-pages/
Donation Page is Up!
I’ve put up a donation page just like every other WordPress plugin author. If you like my first WordPress plugin, please consider donating
New WordPress Plugin: Specific Files
I’ve created a new WordPress plugin that makes it easy for users to include specific CSS or JS files in certain posts or pages by using an easy-select meta box in the WordPress editor.
There are similar plugins out there, but my plugin was written ground-up for ease of use. Take a look at the showcase page I made for it and check it out for yourself!
I’ve submitted it to the WordPress plugin public repository but I’m still awaiting an approval. I heard it could take several days or even a week before they approve new plugins…which doesn’t really make sense to me because they aren’t approving the plugin at all…they’re approving the title and description that I wrote for them.
I’ll keep you all updating when/if it gets added.
December 11th Edit: Woot! They added it: http://wordpress.org/extend/plugins/specific-files-for-posts-and-pages/
I love twentyten!
The default theme for WordPress 3.0.* has been like a big cavern full of gold. And I’m the miner that gets to mine it. I’ve made a few themes from it and I’m still finding amazing new things to do with it. I just love it so much. That’s why I chose it as the theme for my website here. Perhaps I’ll make a custom theme for danielimhoff.com in the future, but for now I’m gonna use the wonderful twentyten.
I just wanted to say that the WordPress team has done a wonderful job on this theme. It has been a wonderful mentor to me and every other WordPress theme creator out there who learns by example.












