Author Archive

Adding Scripts Properly to WordPress Part 3 – Page Detection

12
responses
by
on
May 8th, 2010
in
HOW-TO, WordPress FAQs

You might find yourself in the situation where you only want a script to run on a certain page. In fact, it’s good practice to only load your JavaScript files when absolutely necessary; loading the files on every single page is a big no-no (I’ve been chastised before for this). While on the blog’s front-end, WordPress makes it super-easy with its conditional tags. I’m not going to go over the conditional tags here, but here are a few you can take advantage of: is_home() is_front_page() is_single() is_page() And much more. While being selective on the front-end is relatively straightforward, the admin-panel is another monster. Sure, there’s the is_admin() conditional, but what if you only want to run a script in a certain section within the admin panel? One technique is to use the PHP reserved variable called $_GET. Say you have a plugin options page with a URL of: http://www.mydomain.com/wp-admin/options-general.php?page=my-plugin-file.php […]

[Continue Reading...]

Adding Scripts Properly to WordPress Part 2 – JavaScript Localization

9
responses
by
on
May 7th, 2010
in
HOW-TO, WordPress FAQs

When adding scripts to WordPress, you will inevitably run into a small, but painful, issue of localization. Localizing a plugin or theme is relatively straightforward, but JavaScript presents its own difficulties since we can’t easily call the PHP functions necessary (which is one reason authors embed JavaScript in PHP files). Since embedding JavaScript in PHP files is never a good technique, we use localization to save the day. With JavaScript localization, you can use PHP magic to build your localized strings, and then use JavaScript to read/parse those strings. What you do with them is only limited to your imagination. Furthermore, if you display anything with JavaScript, chances are your users will want the strings to be localized. Fortunately, WordPress provides the ultra-handy wp_localize_script function. wp_localize_script The wp_localize_script takes three arguments: handle object_name l10n Handle The handle argument will be the same handle you use for your script name. For […]

[Continue Reading...]

Adding Scripts Properly to WordPress Part 1 – wp_enqueue_script

16
responses
by
on
May 6th, 2010
in
HOW-TO, WordPress FAQs

Starting in WordPress 2.1 (if I remember correctly), the awesome folks at Automattic gave us the even awesomer function of wp_enqueue_script. Before that, it was every plugin or theme author for himself. If you wanted to add in a script, it was hard-coded in. As you might imagine, this presented a ton of problems. Scripts were loaded twice, out of order, or even when they weren’t needed at all. Furthermore, some themes and plugins had the JavaScript embedded within the plugin’s or theme’s PHP file just to capture a few PHP variables. Not good! In order to add scripts properly to JavaScript, you must always keep your PHP and JavaScript separate. And by separate, I mean separate files. There’s just no excuse anymore (I’ll get into this in Part 2 of this series). The wp_enqueue_script function is the first step in loading your scripts properly. Not only can you add […]

[Continue Reading...]

VideoPress Review

34
responses
by
on
April 16th, 2010
in
General, WordPress, WordPress Plugins

Within this review, I will provide an objective view on the video-hosting service called VideoPress (owned by Automattic). Now I will be one of the first to admit that I am somewhat of an Automattic fanboi. I love WordPress, and use several of Automattic’s other services. However, even I was skeptical of what I considered a too-good-to-be-true video-hosting service. A Little Background I have been hosting my videos on YouTube for quite a while now. I especially liked their new HD feature and the ability for my screencast software to export directly to the service. I didn’t (and still, really don’t) care that the YouTube player is branded and shows ads. It worked, and worked well, and that’s really all I cared about it. And best of all, it was free. However, I ran into a roadblock with some of my videos. The ten-minute time-limit was really started to kill […]

[Continue Reading...]

How to Do ‘XYZ’ Without a WordPress Plugin

30
responses
by
on
February 13th, 2010
in
General, WordPress, WordPress Plugins

If you do a quick Google search for, “without a plugin”, you’ll find a gazillion results for how to accomplish simple to complex tasks for WordPress without the need of a plugin. With so many articles about not using WordPress plugins, it just begs the question: “What’s wrong with WordPress plugins in the first place?” I personally love my installed plugins. I have 25 installed on my personal blog, and I couldn’t live without a single one of them. If you venture off to Jeff Chandler’s site, he has 31 installed. Are we freakin’ nuts, or what? So what’s the deal with all these “without a plugin” posts? I mean, you don’t see plugin authors posting, “How to accomplish ‘xyz’ without a WordPress theme” do you? Okay, I’m slightly kidding, but this question needs to be asked: “What benefit is there to integrating a plugin into a theme?” Does the […]

[Continue Reading...]

My Thoughts on Premium Plugins

80
responses
by
on
February 4th, 2010
in
WordPress Plugins

Most of you have heard by now of the departure of Lester Chan from WordPress plugin development. While he will continue to update his plugins as needed, all support will be terminated. As a plugin author myself, I’m not surprised by this news. With the world economy still in the pits, more plugin authors are feeling the crunch. While they would like to release free plugins for all, at the end of the day, there are bills to pay and mouths to feed. Within this article (rant?), I will go over the types of plugins I would pay for, an argument for paying for plugins, and go over several business models I see popping up. Plugins I Would Pay For Here are several categories that make a plugin something I would pay for (yours will undoubtedly be different). The plugin is a timesaver – Plugins such as Akismet and WP […]

[Continue Reading...]

Preventing WordPress Plugins From Loading

21
responses

There may be times in WordPress where you would like to load the WordPress environment manually, and prevent plugins from loading. Two instances where this is ideal are: When loading an inline frame with Thickbox or Colorbox. When parsing AJAX requests in an external PHP file. To further give justification for this technique, I had a major plugin conflict with another plugin. My Ajax Edit Comments plugin had failed to work for one of my clients. After doing some troubleshooting, I determined it was a plugin conflict with “xyz” plugin. When I looked at the conflicting plugin’s code, I was able to pinpoint the problem to one patch of code, but failed to determine a fix. The conflicting plugin was causing my nonces to fail, as well as my AJAX processor to fail (since that uses nonces as well). Since my plugin’s editing options are all in a Colorbox inline […]

[Continue Reading...]

How to: Offsets and Paging

31
responses
by
on
June 19th, 2008
in
HOW-TO, WordPress FAQs, WordPress Hack

Reader John writes in: How does one use paging with an offset? Doing so breaks the navigation controls. The problem with using an offset in a query is that WordPress ignores any reference to paging. In other words, you can use an offset and paging, but not both together. This can be solved by tapping into the post_limits filter. Step 1: Add the ‘my_post_limit’ Function The my_post_limit function is what the post_limits filter will use to update the standard loop query. We’ll use the function to use paging and offsets together. This function should be placed in your theme’s functions.php file. function my_post_limit($limit) { global $paged, $myOffset; if (empty($paged)) { $paged = 1; } $postperpage = intval(get_option('posts_per_page')); $pgstrt = ((intval($paged) -1) * $postperpage) + $myOffset . ', '; $limit = 'LIMIT '.$pgstrt.$postperpage; return $limit; } //end function my_post_limit Step 2: Add the Filter Reference <?php add_filter('post_limits', 'my_post_limit'); ?> <div id="recent"> […]

[Continue Reading...]

Comment Remix – Video Plugin Review

8
responses
by
on
June 8th, 2008
in
WordPress Plugins

If you cannot see, the video, please visit this link: Comment Remix – Video Plugin Review Today’s WordPress Plugin video review is of Comment Remix. Video Summary: Comment Remix adds numerous admin panel options, as well as reply, quote, and tag capabilities on a post. The star feature for admins (in my opinion) is the “In Need of Reply” option, as well as the various actions added to comments. Pros: Reply/Quote options are useful for admin and end-users. “In Need of Reply” is great for blog admins and unreplied comments. A lot of admin panel options make this plugin highly configurable. Cons: Pop-up boxes could use the built-in WP 2.5 thickbox.js script. The “In Need of Reply” badly needs an “ignore all” option. Not sure of the usefulness of tags for comments unless there are global options. Styling could also be better for the comment actions. The Comment Remix plugin […]

[Continue Reading...]



Obviously Powered by WordPress. © 2003-2013

page counter
css.php