Author Archive

Plugin Deactivation Issues Solved With Actions and Filters

12
responses

When Jeff wrote about plugin deactivation breaking your blog, Aaron and I wrote in the comments of a few solutions to prevent plugin issues with themes. Within this post I will present several techniques plugin and theme authors can take in order to prevent deactivation issues. Method 1: function_exists In this example, let’s assume we have a function named related_posts. When in a theme, we could use this code to call the function if only it exists. <?php if (function_exists("related_posts")) { related_posts(); } ?> The PHP function_exists checks for the existence of the function, and if it does exist, it calls the function. Method 2: function_exists and Actions Using the same function name, the theme author could add some code into their functions.php file and use an action and function_exists combination. if (function_exists('related_posts')) { add_action('my_related_posts', 'related_posts'); } In the above example, we create a new action called my_related_posts. The end […]

[Continue Reading...]

Removing Width/Height from the Image Uploader

33
responses

Reader Vivien writes in: Is there a way to prevent WordPress from inserting the width and the height for images in the new 2.5 media manager? In short, yes, but it requires you to insert some code into your theme’s functions.php file. Fortunately, there is a WordPress filter we can use called image_downsize, which takes in three arguments (a boolean, an attachment ID, and a size string). add_filter('image_downsize', 'my_image_downsize',1,3); All I’m doing in the above filter is setting the filter name, the function to call (my_image_downsize), what priority I want the filter, and how many arguments the function takes. From there, I mimic the function image_downsize in the ‘wp-includes/media.php’ file, but do not return a width or a height. As a result, when the image is sent to the editor, no width or height is present. function my_image_downsize($value = false,$id = 0, $size = "medium") { if ( !wp_attachment_is_image($id) ) […]

[Continue Reading...]

Dashboard Widget Manager – Video Review

7
responses
by
on
May 24th, 2008
in
WordPress Plugins

If you cannot see, the video, please visit this link: Dashboard Widget Manager – Video Plugin Review Today’s WordPress Plugin video review is of Dashboard Widget Manager by Viper007. Video Summary: Dashboard Widget Manager is a great way to customize the WordPress 2.5 dashboard. The plugin is great for multi-author blogs where each author would like a customizable dashboard. Admin can also set a default dashboard setup. The ability to re-order and customize certain dashboard widgets is a very nice feature. If possible, I’d like to see some extra widgets in the future. Pros: Customizing the dashboard is very easy if you are familiar with widgets. Cons: Minor style issues. If you think your WordPress plugin will merit itself to a video review, please get in contact with me via e-mail (ronalfy+wltc @ gmail dot com). Please keep in mind I will not review premium plugins. For more videos, please […]

[Continue Reading...]

How To: Avoid Duplicate Posts

28
responses

A reader writes in: I’m developing a new theme and I’m having trouble getting duplicate posts from showing when running two loops (one standard loop and one from a specific category). Even when I copied the specific code from directly from the codex, it was not working. The Codex article the reader mentioned was regarding the Loop. Although the example shows how to avoid a single duplicate post, it doesn’t show how to avoid duplicating multiple posts. Here’s how to show two individual loops without duplicating posts in either loop. Step 1: Add a ‘posts_where’ Function A WordPress filter is needed to accomplish this, and we’re going to be tapping into the ‘posts_where‘ filter. The reason being is we need to modify the query used for the loop and exclude some posts. Here’s the function we’ll be using called post_strip: function post_strip($where) { global $myPosts, $wpdb; $where .= " AND […]

[Continue Reading...]

Error Management for WordPress Plugins

10
responses
by
on
May 4th, 2008
in
HOW-TO, WordPress, WordPress FAQs

For the past few weeks I’ve been working on a WordPress plugin. One of my goals was to have fancy and relevant error messages. I contemplated writing my own error manager, and even began a very basic one. I experienced hurdle after hurdle, and finally I thought to myself, “Wouldn’t WordPress have its own error manager also?” So I did a quick source-code search and came across the WP_Error class. One of the hurdles I ran into in creating my own error manager was error localization. The WP_Error class makes localizing error messages extremely simple. Adding Error Messages To add an error message, the first thing you’ll want to do is instantiate your own instance of WP_Error. $myErrors = new WP_Error(); The next step is to add in your error messages. $myErrors->add('access_denied', __('You do not have permission to do that.',$myLocalizationName)); There are a few things to notice here. There is […]

[Continue Reading...]

Organize Series – Plugin Video Review

6
responses
by
on
April 21st, 2008
in
WordPress Plugins

If you cannot see the video, please visit this link: Organize Series – Video Plugin Review Today’s WordPress Plugin video review is of Organize Series by Unfolding Neurons. Video Summary: Organize Series is an extremely powerful plugin that makes organizing series rather simple. There are many options to customize the look. The show clincher for me is the ability to have series archives. I highly recommend this plugin for people who do post series. Pros: It’s easy to add series and to organize them. Many options to customize the look and feel. The series permalinks are a nice feature. Cons: Perhaps too many options, but power-users will love them. I only tested this plugin on 2.5, so I’m not sure how well this plugin fares on other versions. If you think your WordPress plugin will merit itself to a video review, please get in contact with me via e-mail (ronalfy+wltc […]

[Continue Reading...]

Baltic Amber Admin Themes for WordPress 2.5

17
responses
by
on
April 20th, 2008
in
WordPress Plugins

Kaspars from Konstruktors has released a WordPress 2.5 plugin called Baltic Amber Themes that allows you to change your default colour schemeadmin theme. Update: This plugin does modify your admin layout as well as your color schemes, so please keep this in mind if trying the plugin out. Kaspars has mentioned that there is now an option to disable the layout changes. What’s even cooler about this plugin is that the plugin provides a nice refresh to the Write Panel and several areas of the overall administration panel. After activating the plugin, you can change the default colour schemetheme by viewing your profile options. From there, you have an option of 8 colour schemes, or an option for a custom or random colour. This is a rather welcome addition to the WordPress 2.5 admin area. Baltic Amber Themes Baltic Amber Write Panel Baltic Amber Settings Download your own copy of […]

[Continue Reading...]

Paging and Custom WordPress Loops

94
responses
by
on
April 19th, 2008
in
HOW-TO, WordPress FAQs, WordPress Hack

Last week I published two articles using custom loops. The first was about how to create a custom loop. The second was how to retrieve posts based on custom fields. In both articles, several readers commented that they would like to see paging and have it explained. I’d like to thank Aaron Harun from Anthology of Ideas for supplying the code used in this post. Paging, and why it doesn’t work with WP_Query The paging magic happens in a file called ‘link-template.php‘ in the ‘wp-includes‘ folder. Most themes have basic paging built in, with the help of two functions: next_posts_link and previous_posts_link. These functions, as well as several others, make use of a global variable called $wp_query. This variable is actually an instance of the WP_Query object. However, when we create our own instantiation of WP_Query, we don’t have this global variable $wp_query, which is why paging will not work. […]

[Continue Reading...]

Absolute Comments – Plugin Video Review

13
responses
by
on
April 14th, 2008
in
WordPress, WordPress Plugins

If you cannot see, the video, please visit this link: Absolute Comments – Video Plugin Review Today’s WordPress Plugin video review is of Absolute Comments by PlanetOzh. Video Summary: Absolute Comments is a major improvement over the WordPress 2.5 Comments Panel. The plugin allows you to reply to comments easily without having to visit a post. The plugin also allows you to view all comments for a particular post. An immense timesaver. Pros: Major improvement over the existing WordPress 2.5 comments panel. The plugin makes it easy to reply to comments. Cons: None, although it would be nice if there was a way to change the default reply text (or have several options) in the admin-panel without having to edit the plugin’s code. If you think your WordPress plugin will merit itself to a video review, please get in contact with me via e-mail (ronalfy+wltc @ gmail dot com). Please […]

[Continue Reading...]



Obviously Powered by WordPress. © 2003-2013

css.php