[WordPress plugin] Flickr foto info at SANIsoft – PHP for E Biz. If you embed Flickr photos on your site you can always link them to the original page where visitors to your site can get all the details but that is not really a good user experience as it sends the visitor away from your blog.
However to solve the problem there is WordPress Extend, a place where plugin developers can add their plugins, making it easier for others to find them. It would be really good if more and more developers started using WordPress Extend to distribute their plugins, I would like to discuss a few benefits developers get when they add their plugins to WordPress extend to make that decision easier. Hint: If you are unaware of how to add your plugin to WordPress Extend, read our earlier tutorials. Here are the benefits of adding your plugin to WordPress Extend. Free Hosting Space. Introduction to PHP’s Serialize Function.
I was tinkering with a WordPress database the other day and was nosing around through some tables, looking for some statistical data which I never found, and noticed that a few of the tables were storing data in an unusual format (to me at least).
Specifically one record I found looked like this: Whoa. Looked like some sort of delimited data (it is) but not in a form I recognized. Now over the years I thought I had seen my share of input that is stored in a database. Like most PHP developers I didn’t learn PHP through a class, I learned it by reading and trial and error, but I don’t remember seeing something like this before. Cache a large array: JSON, serialize or var_export? - TechBlog. Monday 06 July 2009 10:30 While developing software like our framework you will need to cache a large data array to a file at some point sooner or later.
At such a point you need to choose what caching method you will be using. In this article I will compare three methods: JSON, serialization and var_export() combined with include(). By Taco van den Broek Too curious? The JSON method uses the json_encode and json_decode functions. Code example. Add New Headers to WordPress Plugins or Themes – Nerdaphernalia. I’ve had a few patches committed to WordPress core in the last few versions, and have sadly neglected to do writeups about them so that others could take advantage of the new features.
I hope to remedy that in the next few posts. Use Classes in your WordPress plugins to increase code portability and reduce name conflicts – Nerdaphernalia. One of the most powerful features of WordPress is the huge community of developers making plugins that extend the software far beyond what the core application provides. It also allows people to add just what they want to use, rather than having a single bloated homogeneous download. There are drawbacks as well, of course. Any time a software package opens itself up to third-party additions, there is a potential for mischief. With WordPress, different plugins can end up stumbling over each other, as each is coded for the core but doesn’t anticipate other plugins. You can also have naming conflicts — when functions or variables in different plugins are given the same name. These problems can be avoided by using classes If you have multiple plugins, you probably have a good bit of code that you reuse in all of them.
Consolidate Options with Arrays in your WordPress Plugins – Nerdaphernalia. If you’ve ever written a plugin for WordPress you’ve probably dealt with giving the end user options. Unless you’ve taken the low road and forced the user to directly edit the plugin file, “options” means a Settings screen in the WordPress admin, and most likely you are storing those options in the blog’s wp-options table. Over time, bloggers using various plugins can end up with hundreds of extraneous records in their options table * . If they ever stop using a plugin, or if they ever want to manually clear out options, this job can be made difficult by all the clutter, and the problem is made far worse when plugin authors add a new record for each separate setting in a plugin. Beyond the mess, plugins written this way generally make many more calls to the database than they need to, which adds unnecessary burden on the server.
WordPress Plugin Creation "Saving Options" Most WordPress plugins, if not all, have options (also known as settings) that are stored in the blog’s MySQL database, ready to be called upon when needed.
In this tutorial we will explore three different PHP methods to store options. The first and most commonly used method is to save each option with separate variables. To save the option: We use the $_POST variable to save form data in a variable. The variable is then used to update an option. $variable = $_POST['option01']; update_option('my-plugin-options', $variable); To call the option: To call an option we simply use the get_option function and set the chosen option to a variable. $variable = get_option('my-plugin-options'); Post Formats. Post Formats Languages: English • Español • 日本語 • Português do Brasil • Русский • 한국어 • 中文(简体) • 中文(繁體) • (Add your language) Intro Post Formats is a theme feature introduced with Version 3.1.
A Post Format is a piece of meta information that can be used by a theme to customize its presentation of a post. The Post Formats feature provides a standardized list of formats that are available to all themes that support the feature. Trunk. Template Tags. Pluggable Functions ? WordPress Codex. Pluggable Functions Pluggable functions were introduced in WordPress 1.5.1 These functions let you override certain core functions via plugins.
The most up-to-date list of core functions that WordPress allows plugins to override is available at wp-includes/pluggable.php. WordPress loads the built-in functions only if they are undefined after all plugins have been loaded. Pluggable functions are no longer being added to WordPress core. All new functions instead use filters on their output to allow for similar overriding of their functionality. Note: A function can only be reassigned this way once, so you can’t install two plugins that plug the same function for different reasons. Full list of Pluggable Functions: Reference get_currentuserinfo() New Plugin – “I Make Plugins” « Mark on WordPress. I have several WordPress plugins.
They’re hosted on the WordPress.org plugin repository, but I also have a page for each plugin on my own site. I’ve found it tedious to have to update both places separately. Things get out of sync, or worse, I put off plugin updates because I loathe updating two places (with two different formats) with the same information. The WordPress plugin repository has an API.
Let’s use it! Adding a plugin is as simple as creating a new subpage of your plugin listing page, and giving it the name of your plugin in the repository. Here is a nine and a half minute. boring-as-hell screencast with a full tour of the plugin. Excluding your plugin or theme from update checks « Mark on WordPress. There has been a vigorous discussion going on regarding what data WordPress installs send to WordPress.org when doing update checks.
Because WordPress (the software) doesn’t know whether a theme or plugin is listed in the WordPress.org repositories, it has to check them all, and let the repository sort it out. Some have expressed concern that private plugins developed for a single client could contain sensitive information in their headers, like contact information for the developer, etc.
If you, as a plugin or theme developer, would like to exclude one of your plugins or themes from the update array, the following code will do the trick. Block-level comments trick « Mark on WordPress. Block-level comments are useful for commenting out an entire block of code in PHP, CSS, and other code contexts.
The only problem with this is that when you go to re-activate this code, you have to change both the opening and closing comment markers. That’s a pain. While I was at WordCamp NYC last week, I saw Daisy Olsen using a very clever trick in her lightning round talk. See what she did there? The closing comment marker is preceded by another opening marker. Brilliant! By adding a slash in front of the opening comment marker, I comment out the comment marker. Using PHP5 object constructors in WP Widget API « Mark on WordPress. TextMate WordPress Widget Snippet « Mark on WordPress.
I love WordPress’ sidebar widgets. I also despise coding them. I love how they let me offload menial management tasks directly to clients, avoiding all the “Change this word to another word!” E-mails. But every time I code them, it seems to involve 15 minutes of Googling, copy-pasting from a previous widget, and looking at documentation. 8 steps to get started as a freelance WordPress developer « Mark on WordPress. I’ve had a bunch of people ask me how they could get started as a WordPress developer or consultant.
Rather than answer them all individually and privately, I’m putting it up for all to see. Become involved with the development community Join the wp-hackers mailing list. Participate when you have something useful to say, or an interesting question/problem to pose to other WP developers. Dive in at the WP support forums. Escaping API updates for WordPress 2.8 « Mark on WordPress. The WordPress escaping API functions have been updated. Why WordPress Themes are Derivative of WordPress « Mark on WordPress.
2.0.3: Nonces « Mark on WordPress. WordPress 2.0.3 has some security enhancements that a lot of people are wondering about, so here’s my attempt at explaining them. Custom Queries. Custom Queries. AJAX in Plugins. Modifying Options Pages. Function Reference/add meta box. Function Reference/add meta box Languages: English • 日本語 • Português do Brasil • (Add your language) Description The add_meta_box() function was introduced in Version 2.5. Creating Options Pages. Creating Options Pages Languages: English • 日本語 • Русский • (Add your language) This article is in transition to meet Settings API, which was introduced in Version 2.7. Creating Tables with Plugins ? WordPress Codex. Creating Admin Themes ? WordPress Codex. Creating Admin Themes Languages: English • 日本語 • (Add your language) TinyMCE Custom Buttons. Introduction TinyMCE is the name of the visual editor that comes with WordPress, which can be used to edit post and page content. It comes with a variety of buttons, but it is also possible to add your own buttons to the editor toolbar, and otherwise change the editor's behavior.