4/1/2008 ↓

FAQ on WordPress 2.5 90comments

Thanks for visiting! If you're new here, you may want to subscribe to our RSS feed. This blog posts regular Wordpress news, updates of themes, plugins, ideas, hacks, quick fixes and everything about blogging, especially about Wordpress. Go ahead, subscribe to our feed! You can also receive updates from this blog via email.

[I did not write this post. It was written with great care and in great detail by MichaelH on the news section and is reproduced verbatim here. For those of you that do not know Michael's work, his work on the Codex and his help with WordPress and its documentation makes him a legend in my books. Thank you Michael!]

These questions and answers were gleaned from the wp-hackers and wp-testers e-mail lists over that last several weeks.

Q. How can I find the Post ID or Page ID?
A. If your browser shows the URL in the status bar, when you mouse over a link, you can see the ID in the as part of the URL displayed in the browser status bar. In FireFox you can show the status bar by checking the Status bar choice under View. A more complicated method to finding the ID is to use something like phpMyAdmin to look at the database table wp_posts–look down the column of post_title to find your Post or Page Title. The ID field on that row will be your Post (or Page) ID.

Q. How do I find the Category ID?
A. In Manage->Categories, place your mouse over the Category Name you are trying to find the ID for and the ‘cat_ID’ will show as part of the URL displayed in the browser status bar. In FireFox you can show the status bar by checking the Status bar choice under View. A more complicated method to finding the Category ID is to use something like phpMyAdmin to look at the database table wp_terms and find the row where name column is your Category Description. The term_id on that row will be your Category ID.

Q. How can I edit my Post slug or my Page slug?
A. The Post (or Page) slug is now displayed as the Permalink under the Title field in writing or editing a Post or Page. If you are using the “Default” Peramlink Settings you will not see and can’t edit the Permalink. Only if you are using a ‘pretty Permalink’ (e.g. Month and name) in Settings->Permalinks will the Permalink be available for edit. When creating a new Post or Page, the Permalink field won’t show up until you complete the Title.

Q. Where are my Post Categories and Tags when writing a Post?
A. Scroll down below the Post content box.

Q. How do I rearrange the order Advanced Options boxes like Custom Fields and Excerpt?
A. This is no longer possible.

Q. I don’t see a link to edit a user’s name.
A. In the table of Users, click on the name (represented as a link), to edit that user’s information.

Q. What happened to my Import Links ability?
A. Export Links is displayed under the Related section on the Write->Link screen

Q. Where’s the menu tab to access the Dashboard?
A. The link to the Dashboard is in the dark border at the top left of the screen.

Q. What happened to my child categories? I had the Category Ford both as a Child of New Cars, and as a Child of Old Car, but I can’t do that any longer?
A. Duplicate Category (and Tag) names are not longer allowed.

Q. I can’t upload certain file types and get message “File type does not meet security guidelines. Try another”
A. Unknown file extensions are ‘blocked from uploading’. New extensions and their icons can be added via changes to the functions wp_check_filetype and wp_ext2type in wp-includes/functions.php.

Q. How can I change that red banner in the Dashboard?
A. Change to the ‘Classic’ Admin Color Schemes in Users->Your Profile.

Q. What happened to my Options choices?
A. Options are now called Settings and that menu tab is to the right on your menu next to Plugins and Users.

Q. How do I edit a Category Description?
A. Under Manage->Categories, click on the Category Name you wish to edit.

Q. How do I edit a Comment?
A. Under Comments, click on the name of the comment author and then you will be placed in ‘Edit Comment’ mode.

Q. Where is the WordPress Bookmarklet?
A. It’s gone for now but will likely be available in Version 2.6 but see Dion Hulce’s suggestion in the Forums.

Q. When in the Media Library, what is this error — Fatal error: Call to undefined function: wp_get_attachment_image() in /home/public_html/wp-includes/post-template.php on line 384
A. This is usually caused by a PHP file not being correctly uploaded. Make sure wp-includes/media.php and wp-settings.php are intact (reupload them).

Q. When trying to upload media files I get the message “Are you sure you want to do that?” with a link telling me to try again. Clicking “Please try again” simply reloads the dashboard into the frame.
A. You may need to disable your plugins one-by-one to find the ‘problem’ plugin. Some older plugins, such as Ryan Duff’s old WP-Contact plugin, have been reported to cause this problem, so check under the Plugins tab to see if your Plugins need updating.

Q. Has the option to enable/disable Gzip compression been removed from 2.5?
A Yes, the option is gone. WordPress now leaves compression as a decision for the server.

Q. Why can’t I add media in Manage->Media Library?
A. This was planned for 2.5 but didn’t make it into code so this will be included in a future release.

Q. How do I add links to my Blogroll?
A. A new menu choice, Write->Link, allows creation of new Links. In Manage->Links, there is an “add new” link to the right of the Manage Links heading. Also remember the new Manage->Link Categories to add and maintain Link Categories.

Q. What happened to the Post Timestamp box? How do I change the Post Timestamp?
A. In Write->Post, in the Publish Status area, click on the Edit button to the right of Publish immediately. When editing a Post, there is a similar edit button in the Publish Status area next to the Published on date and time.

Q. My screen is using 1280×960 pixels and I notice that admin screens are left aligned, not centered or stretched 100%.
A. This is the intended design. Viper007bond has Remove Max Width Plugin to change this.

Q. The collation set in “wp-config.php” (DB_COLLATE) is not being used in searches.
A. This will be likely be fixed in 2.5.1 but see this thread at wp-testers for a suggested fix.

Q. I get a “403 Forbidden” error when uploading files. I am also using the Bad Behavior plugin.
A. May need to delete the “Shockwave Flash” from the Bad Behavior blacklist file. See Rick Beckman’s post for a detailed description.

Q. I just tried to upload several media file and my browser crashed when it got to the “Crunching” part.
A. It is possible your system doesn’t support the Flash uploader or needs an upgrade to your Flash Player. Dion Hulse also wrote the the No Flash Uploader plugin to disable the Flash uploader.

Q. I can’t edit the Post slug/permalink and I’m sure I’m using pretty permalinks
A. To help debug the problem, answer these questions. What is your permalink structure? Can you provide the permalink for a post that does not show the Permalink field in the editor? Do you get any JS errors in the console? If you have plugins activated, does the problem persist if they are deactivated?

Q. The Change button (beside the Remove button) in Design->Widgets isn’t working. When I click change (beside remove button) it doesn’t save the changes to the widget.
A. Clicking Change doesn’t actually do a save and reload. You have to click “Save Changes” at the bottom to make the changes stick.

Q. In older versions, below widgets we had the option to select how many ‘Text’ widgets we want to use, but I don’t see that in 2.5.
A. The option is no longer needed. Widgets that allow multiple instances (e.g. Text widget) can be added as many times as you like by just clicking on the Add button. Remember to “Save Changes” when done adding the widgets.

Q. Can I revert from Version 2.5 to Version 2.3.3?
A. The best way is to restore your 2.3.3 database and files. If that is not possible, then any user that accessed the 2.5 blog or was added in 2.5 would need the MD5 password reset in the user table.

Q. I have several production blogs using Version 2.3.3 and I just upgraded to Version 2.5 on one of those blog. All the blogs share a common user table for the user names and passwords, but when I login to the Version 2.5 blog with a user, why can’t I use that same user to login to the 2.3.3 blogs.
A. Version 2.5 has enhance the password authentication so the passwords created/used for a 2.5 blog will not work on a 2.3.3 blog. Ryan wrote MD5 Password Hashes plugin to use the old password hashing (like what is used in Version 2.3.3) in a Version 2.5 blog.

Q. How do I add a youtube video to a 2.5 Post?
A. In the HTML mode, paste the youtube URL (youtube tells you this) into the post. In the Visual mode, paste the youtube URL into the popup activated when you click on the “Insert/edit embedded media” icon on the 2nd toolbar row.

In addition to these questions and the provided answers, if you have any new ones that you would like to add, please leave us a comment and we will add them to the list.

3/4/2008 ↓

Add WP Search Engines To FF 8comments

Author: Jeff Chandler Category: HOW-TO, Wordpress Tips

Jeremy Clarke mentioned to me about a way to search the Codex, WordPress support area and the plugin repository all from within FireFox. If you support users as I do in the WordPress IRC chat room, there are a lot of times where I do a search on the Codex to look up the page for a certain function that someone is inquiring about. Thanks to Jeremy’s tip, I no longer have to visit the actual page to perform a search.

If you visit the MyCroft page on Mozdev.org you’ll notice a number of links that you can click on. Each one of these links are a search engine plugin that was coded for FireFox. What this means is that, you can add WordPress specific search engines to the search engine tool bar within FireFox which is usually occupied by Google by default.

In order to install a SE plugin, simply click on the link that represents the search engine you want to have installed. For example, if you want the WordPress Codex to be one of the search engines within FireFox, click on the WordPress Codex plugin name. Upon clicking on the plugin name, FireFox will ask you if you would like to add the search engine to the list of search engines available in the search bar. Clicking the ADD button will add that specific SE to the list of choices within the search bar.

This tip has been an awesome time saver. Not only can I quickly answer questions in the chat room, but it is more convenient to search the plugin repository from within my browser than to actually search from the actual page.

3/2/2008 ↓

  • Two side-by-side columns in WordPress

    How to organize posts into two side-by-side columns in WordPress: A quick tutorial on setting up the front page of a WordPress blog to display two side by side columns with posts alternating between the two columns. The tutorial does require some simple PHP code that is not included (but should be, pseudo code is provided) but the concept is interesting, especially for theme developers looking for the next new thing. In my experience, side by side posts are more applicable for blogs that are heavy in embedded media and light on text. (10)

2/12/2008 ↓

ModSecurity, WordPress Admin and “Method Not Implemented” 6comments

I battled this one for a little bit and I hope the information here helps someone.

First and foremost, there are various version of this problem and they might have different causes stemming from the same source. I list them here in no particular order. I found all the topics starting with a search for the dreaded “Method Not Implemented” 501 error code from the admin panel of WordPress.

POST to /test/wp-admin/index-extra.php not supported: This error is also noticed on post.php and theme-editor.php. Now there are various WordPress Forum posts providing somewhat workable solutions to the problem. I tried some of the solutions but either they did not work for me (I had not looked that closely at the error before trying them) or they were too broad and I did not care for the results. There is some finger pointing in both the forums and the various other pages I found but I believe that the answer lies somewhere in the middle.

In my case, posting caused a “PHP Injection Attack. Matched signature” error that I found in my Apache error logs and the error generated on the browser said “Method Not Implemented 501 error code” with the name of the offending file. This error was caused by ModSecurity which is an Apache module that helps secure web applications on the fly. Now the errant bit of text was in ARGS:content that was bring posted to the server and it matched the regex in one of the ModSecurity rules. It could have been generated by WordPress itself or it could have come from one of the various plugins I have on my blog. I am not sure and I have not taken the time to investigate it further. (please provide more information if you have any). This was a false positive from my perspective and I needed to find an elegant and safe solution that would work.

On reading further about false positives, here is the solution that worked the best. Since I wanted to disable the rule that was catching the post, and not disable the whole mod security for either a file inside the admin folder or the whole admin folder, I found a way to do just that through the Apache configuration files for the virtual host. I found the rule number that was being triggered in the Apache error logs and though I will not disclose the rule number here for security reasons, it was relatively easy to spot. Then I added the following code to my httpd.include (or httpd-vhosts.conf depending on your hosts’ version of software) at the end of the file.

<LocationMatch "/wp-admin/post.php">
SecRuleRemoveById XXXXXX
</LocationMatch>

where XXXXXX was the rule number. Now an ever better solution would be to readd a new rule with the offending regex trimmed out or a !ARGS:content to the Secrule section to only apply to post.php inside the admin folder.

Some caveats: This case ONLY applies to a blog I was working on and the content that was being posted. Your case might be different. If you want to use this method to fix the problem and have no access to your server, just direct your administrator to this post. The secret is to find the offending rule in your error logs and use the rule number to isolate it from the file that it breaks by using LocationMatch and SecRuleRemoveById in your Apache vhosts config file.

Any insights or suggestions will be highly appreciated by me and I am sure by other readers.

2/11/2008 ↓

WordPress Lingo 16comments

Author: Jeff Chandler Category: WordPress, Wordpress Tips

Whether you’re brand new to WordPress or have been around the neighborhood for a few months chances are, you have heard at least one or more of the following terms without knowing their definition. As with any sub-culture, WordPress has developed its own lingo of sorts. This post will dive into some of the common words associated with WordPress and by the end of this article, you’ll be able to follow a conversation in the WordPress.org IRC channel with ease!

Codex - The WordPress.org Codex is like a portal containing all sorts of information related to the open source project. The Codex is maintained by volunteer document writers who are part of the WP.org community. When you have a problem or question with WordPress.org, the codex is the first place you should look for an answer.

Parameter - Parameters are often mentioned when discussing plugin or theme development topics. Think of parameters as hard coded options for particular WordPress template tags. For instance, if you saw the template tag bloginfo(); and it looked like this, <?php bloginfo('name'); ?> everything within those parenthesis would be considered parameters.

Template Tags - Template tags are used within your blog’s Templates to display information dynamically or otherwise customize your blog, providing the tools to make it as individual and interesting as you are. Once you dive in and figure out what Template Tags are and how they can be used, the sky becomes the limit as to what you can accomplish with WordPress.

Loop or The Loop - The Loop is used by WordPress to display each of your posts. Using The Loop, WordPress processes each of the posts to be displayed on the current page and formats them according to how they match specified criteria within The Loop tags. Any HTML or PHP code placed between where The Loop starts and where The Loop ends will be used for each post. When WordPress documentation states “This tag must be within The Loop”, such as for specific Template Tag or plugins, this is The Loop.

.htaccess - hypertext access is the default name of Apache’s directory-level configuration file. .htaccess is placed in a particular directory, and the directives in the .htaccess file apply to that directory, and all subdirectories thereof. It provides the ability to customize configuration for requests to the particular directory. The file name starts with a dot because dot-files are by convention hidden files on Unix-like operating systems. This .htaccess file is a main component of allowing WordPress.org to generate pretty permalink URLs.

Trac - Trac is the place to follow along with the development of WordPress. Bug reports are also kept on Trac. Trac is essentially the WordPress.org bug ticketing tracking system. It’s where all bug reports related to WordPress.org are filed and dealt with on a case by case basis.

SVN - SVN is the acronym for Subversion. The basic idea of Subversion is that the source code and revisions are kept in a repository on a server. Users connect to the repository by using a client program, which allows the user to check out, view, edit, patch, and commit changes to the source code files (depending on the client’s permission level; in the WordPress project, only a couple of people have permission to commit changes to the repository).

Trunk - Trunk is the “bleeding edge” version of WordPress that is being developed. This branch is likely to be broken and buggy, but can be useful for testing plugins and themes to see if they will work with the next release of WordPress.

These are only a few of the terms that are used on a day to day basis within the world of WordPress.org. If you have any other terms that you would like to share, please post them in the commenting section below. I’d be interested to see what sort of lingo the community has been able to pick up on.

1/29/2008 ↓

  • List of WordPress Tutorials

    List of WordPress tutorials: A bunch of WordPress tutorials on various topics in the form of screencasts. Topics include various tasks such as installation on a variety of platforms and tasks inside the WordPress admin. (3)

1/3/2008 ↓

  • Advanced WordPress Help Sheet

    The Advanced WordPress Help Sheet: Michael has put together another PDF Help sheet for WordPress, this time with advanced tips and tricks to use various WordPress functions within your theme. This includes various code snippets from Styling Different Categories to Dynamic Page Titles. He says that this is the first of a few others that he will be putting together and is up for suggestions and ideas. Also check out Michael’s other WordPress Help Sheet from the past. Via Email. (6)

10/23/2007 ↓

TAGStention for WordPress & Dreamweaver 7comments

TAGStention for WordPress: TAGStention is NOT a WordPress plugin nor is it a guide, its a Dreamweaver extension that has helpful features for theme developers such as

  • Wizards for tags with parameters
  • Help button redirects to codex
  • Support for 90% of the tags
  • Insert basic loops (wizard)
  • Insert headers (wizard)
  • Ultimate TagWarrior tags supported (NEW)
  • Help button (NEW)
  • PayPal button at help screen (NEW)

Is supports Dreamweaver 8 and MX2004 and the author says that it might support some older versions. It is based on a CC license. Thanks to WordPress Candy for the tip.

10/19/2007 ↓

  • WordPress Functions Implementation History Tool

    WordPress Functions Implementation History Tool: Ozh has come up with a fantastic WordPress Function Implementation History tool that is essentially a way to check when a function was implemented in WordPress and when and if it was removed in a trendy axajified manner, it will let you search across nearly 1900 functions through 31 WordPress releases, from 0.71 to 2.3. He also released a map of WordPress functions through all the versions. Very useful tool indeed. Thank you Ozh! (4)

8/30/2007 ↓

WP SEO Tips: One, More, Time! 22comments

Author: Jonathan Category: Wordpress Tips

This tip isn’t very specific to Wordpress, but something I realized only a few days ago.

If you have an article that is ranking well in the search engines, let’s say “wordpress skins” or “picasa web tips“, either of those searches may generate a decent amount of traffic for either Weblogtoolscollection.com or Ginside.com.

Well, let me back up a second here. I recently installed the Firestats plugin and it’s been amazing. It’s capable of providing me with the recent referrers, so I can see where my traffic is coming from, and also provide a list of my top posts.

So what I did was I took some of those top posts and analyzed them for what keyword they were ranking really well for. I then wrote another article with the similar theme and makeup with keywords to generate some fresh content. I noticed that I was in the top10 for a specific keyword, such as I mentioned above, so I wrote an additional article. Guess what? I now have two top10 ranking listings in the Google index. Users are going to be twice as likely to visit your site now because of the visibility.

You may come to the conclusion that this is an elementary practice, but it’s a practice that works and is great to help inform authors about.

Please note though, don’t just create duplicate content and write the same thing over with the same title, but be creative and some up with a new twist or do a follow-up article about that topic.

8/28/2007 ↓

Super Secret WordPress GangSign 13comments

Small Super Secret WordPress GangSign

So after an email conversation with Tony, I was reading the Sphere blog this morning and noticed Matt giving Cisco, IBM and indeed the rest of the world a glimpse at the Super Secret WordPress Gangsign. Word! Thanks to Tony for the picture.

8/27/2007 ↓

Localizing a WordPress Plugin Using poEdit 26comments

Localizing a WordPress plugin enables your plugin to reach widest possible audience. Fortunately, WordPress makes it rather simple for plugin authors (and theme authors) to ensure their work is available in many languages.

This post will go over the steps that are necessary from a plugin author’s end to make it easy for others to translate a plugin. For those then wishing to translate, I will go over a program called poEdit, which will allow you to translate the plugin for your use and for others.

The Benefits of Localizing a Plugin

The more languages your plugin is in, the more people that can download and understand it.

If a plugin is popular enough, you’ll have people volunteering to translate in order to adhere to a different part of the world. The hard way would be someone going through your code after each release and translating word for word. However, there is an easier and more portable way to translate: the .po file.

With the .po file, anybody can translate your plugin as long as they are familiar with the original language. And if you make any changes to the plugin’s source, a user doesn’t have to dig through your code to re-translate. The translations are preserved in the .po file and all the user has to do is update the .po file in their language.

Preparing a Plugin for Localization

WordPress makes use of GNU gettext for translations. WordPress has two functions that can be called by plugin authors: _e, and __. Every time you output text to the user, you should use one of the two functions.

  • __($message, $domain) and _e($message, $domain)
  • Both the above functions take in a $message as the first argument and an optional $domain as the second. For plugin and theme authors, the second argument is not optional and should be a name unique to your plugin or theme. For example, if you have a plugin named WordPress Automatic Upgrade, you could probably use WPAU.

According to the WordPress Codex, the __ function should be used if text is going to be used in a calculation.

Loading the Localization File

After ensuring the text outputted to the user is ready for localization, you must also setup your plugin for loading in the appropriate .mo file. The .mo file is a compiled .po file, which poEdit automatically generates upon a save.

The code inside your plugin would look something like this:

load_plugin_textdomain('your-plugin-domain', "/wp-content/plugins/your-plugin-directory/");

  • load_plugin_textdomain($domain, $path)
  • The $domain variable is the same $domain variable you used in the __ and _e functions. The $path is relative to the ABSPATH variable as defined in your wp-config.php file. If your plugin doesn’t have its own directory, you can leave the $path variable empty.

    One thing to note here is that any generated .mo files will have to have your domain as a prefix to the file. For example, if you plugin’s domain is WPAU, then the .mo file would be named WPAU-de_DE.mo (assuming the translation is in German).

Using poEdit to Translate

There’s already a good step-by-step tutorial on how to use poEdit to translate a plugin or theme, but I’m going to use a real-world plugin to show you the steps.

Step 1: Download poEdit

Head over the poEdit project page and download yourself a copy. The install is painless as well.

Step 2: Find a Plugin to Translate

Find your own (or another) plugin to translate. For this example, I’ll be using a plugin I wrote called Ajax Edit Comments.

Step 3: Open up poEdit and go to File -> New catalog…

After the ‘Settings’ dialog comes up, enter your project’s name. In my case, my project is named WPAjaxEditComments. I also went ahead and gave it a UTF-8 charset.

poEdit New Catalog Settings
You’ll be presented with a Settings dialog after selecting File -> New catalog…

Step 4: Enter Your Plugin Path

While still having the ‘Settings’ dialog open, go to the ‘Paths’ tab and click the icon for new item. Assuming that your plugin resides in its own sub-directory and that you will save the .po in this sub-directory, enter “.” (this tells poEdit to scan that directory and all sub-directories for your plugin).

poEdit Settings Paths

Step 5: Set up the Appropriate Keywords

Since WordPress uses the _e and __ functions for localization, you need to let poEdit know that is what it should look for. Click on the ‘Keywords’ tab and input both _e and __ as keywords. To enter a keyword, click on the ‘New Item’ icon.

poEdit Settings Keywords

Step 6: Click Okay and Let the Translating Begin

Click the “Okay” button and save the .po within your plugin’s directory. What you name the file right now is not important, but it will matter when it comes to translating.

After you have saved the .po file, a dialog will show showing all of the matches it has found.

poEdit Update Summary

If you do not plan on translating the plugin, you can go ahead and save the .po file and distribute along with your plugin to enable other translators.

Step 7: Translate the Plugin

Once all the matches are pulled in, it’s time to translate the plugin. Simply find the text you want to translate, and add in your own language.

poEdit - Translate
From this screen, you can translate the plugin

Step 8: Save the Catalog

Remember the $domain that was mentioned earlier in this post? What if, for example, I want to generate a Spanish translation file? I’ll want to save a file with the $domain as a prefix, and the locale as a suffix. In this case, my domain is WPAjaxEditComments and my locale is es_ES. I would save my file as: WPAjaxEditComments-es_ES.

By saving the new file, I would automatically be generating a .po file that others can use, and a .mo file that can be read in through WordPress to localize the plugin.

Now if users have defined the appropriate WPLANG in their wp-config.php, their plugin’s options and output text should be in their local language.

German Translated Ajax Edit Comments
A German translation of Ajax Edit Comments (Thank you David May).

Conclusion

Localizing a WordPress plugin is a great way to reach out to a foreign audience. Localizing involves many people, including the plugin author to take the initial steps to ensure that the plugin can indeed be localized. Translators are required too, and their efforts to localize WordPress and WordPress plugins are tremendous.

References:

Related Reading:

7/9/2007 ↓

The “More” Tag on a WordPress Page 16comments

Author: Ronald Huereca Category: HOW-TO, Wordpress Tips

Nathan Rice wrote about WordPress’s ability to make any page a homepage. One problem I ran into using the technique of pages was the inability to use the <!--more--> tag to display partial posts. Apparently this is default behavior (for good reason) on pages. However, when using Nathan’s technique, I found myself in a unique situation where I only wanted to show a partial post (on a page) if the post was making use of the <!--more--> tag (apparently, I’m not alone).

The technique is rather simple. Simply declare a variable named $more as a global and set it to false right before showing your content. If you wish to resume normal behavior after the content is shown, simply set the variable back to true.

<?php global $more; $more = false; ?>
<?php the_content('Continue Reading'); ?>
<?php $more = true; ?>

6/17/2007 ↓

Listing Your Plugin at the WordPress.org Plugin Directory 36comments

With the WordPress Plugin Competition 2.0 in full swing, some plugin authors may want to have their plugin listed at the official WordPress.org Plugin Directory.

Within this post I will go over the steps necessary to get your plugin hosted by WordPress. This tutorial is for Windows users, but I will link to other tutorials as they become available based on other operating systems. The WordPress directory uses Subversion, which won’t be covered in detail here (you don’t need to know Subversion to follow this tutorial). The tutorial covers adding a plugin I wrote called Feed Styler into the plugin directory. I apologize in advance for the plug, but I wanted to provide a real-world step-by-step example of adding a real plugin.

1. Get a WordPress.org Account

Get over to the WordPress support page and register as a user. You will need to be registered in order to list your plugin.

2. Add Your Plugin

The second step is to add your plugin. You will need to provide:

  • Your plugin’s name.
  • A one or two sentence plugin description.
  • A homepage URI for your plugin (optional).

I recommend always having a dedicated plugin homepage, but that is up to you. You also want to make sure your plugin is GPL Compatible.

3. Wait for Approval

The approval process isn’t overnight. The first plugin I added took about a week, and the second took almost two weeks.

When approved, you will receive an email that says that your plugin has been approved and that you will have access to your subversion repository shortly. In the case of my plugin, the repository was located at: http://svn.wp-plugins.org/feed-styler/

You are also instructed to use the same username and password for WordPress.org to access your repository.

4. Download and Install TortoiseSVN

Head over ot the TortoiseSVN download page and download the appropriate installer (sorry non-Windows users). The installation is relatively painless, but it does require a restart.

TortoiseSVN Installer Complete
TortoiseSVN Installer

5. Create a Directory

Create a directory somewhat out of the way (but easy to find again) that will hold your repository. For the purpose of making this tutorial, I just created a folder on my desktop called ‘feed styler’.

Empty Directory for Holding Subversion Files

6. Check Out the Repository

Navigate to your new folder and right+click to pull up a context menu with the TortoiseSVN options. What you’ll be wanting to select is SVN Checkout.

TortoiseSVN Context Menu
TortoiseSVN Context Menu - Checkout

After selecting SVN Checkout, a dialog box will pop up asking for the URL of the repository and the location to store it. The URL to the repository is the one that was e-mailed to you when your plugin was approved. The location to store the repository should already be filled out. After filling in those two pieces of information, simply hit OK.

Checkout Location
Subversion Checkout Dialog

If all goes well, you should now have three directories in your folder called branches, tags, and trunk.

7. Prepare Your Read Me File

Prepare your plugin files for being included in the repository. Usually the only thing you have to do for this step is to prepare a Read Me file that adheres to the WordPress.org guidelines. The Read Me creation is straight forward, but WordPress does have a readme validator for your convenience.

Here are some quick tips for preparing your readme file:

  • Use appropriate tags when labeling your plugin.
  • Store your readme file in your main plugin directory.
  • If including screenshots, make sure the screenshots are named screenshot-1, screenshot-2, screenshot-n, etc.
  • Use the readme validator to preview your readme file.
  • When providing a stable tag, don’t be creative. Use something along the lines of: Stable tag: 1.0.5.0

8. Copy the Plugin Files to the Trunk Directory

Once you have your plugin files in order and a readme file, copy the files to the trunk directory. The main plugin file and the readme should both be at the root of the trunk directory.

In the case of Feed Styler, here is a screenshot of what my trunk directory consisted of:

Feed Styler Trunk Directory
The Trunk Directory Contents

9. Commit the Files to the Repository

Right+click the trunk directory to bring up the TortoiseSVN context menu. Select SVN Commit.

Subversion Commit
Commit Context Menu

You will now be presented with a dialog box to enter a log message and to select which files to commit to the trunk. Type in a brief log message (such as “Adding my plugin version”) and select all the files you would like to commit.

Subversion Commit - Adding Log Message and Files
Subversion Commit - Log Messages and Files

After you are finished, click OK. You will now be prompted to enter a username and password. The username and password is the same that you use for the WordPress.org Support forums (see Step 1).

SVN Username and Password
Login Screen

If all goes well, your plugin files should be added.

SVN Trunk Added
Files Added to the Trunk

10. Tag Your Plugin Release

This is where the readme file really comes into play. In the readme file, there was a spot to add in a stable tag (in my case 1.0.5.0). You will want to provide a tag that matches the stable tag in the readme file.

Right+click the trunk directory and select TortoiseSVN » Branch/Tag.

Branch/Tag Context Menu
Adding a Tag Context Menu

Within the dialog that pops up, type in the path to your tag directory and the version. In my case, it was: http://svn.wp-plugins.org/feed-styler/tags/1.0.5.0

Also, type in a quick log message that more-or-less says, “Tagging this release.” Hit OK when you are finished.

Adding Plugin Tag
Tagging Dialog Box

If all goes well, the plugin should now be tagged and ready to go. You may want to update your tags directory (locally) by right+clicking the tags directory and clicking SVN Update.

11. Make Sure Everything is Accurate at the Repository and the WordPress Plugin Directory

There are a few ways to ensure everything went correctly. The best way is to head to your subversion URL (in my case, http://svn.wp-plugins.org/feed-styler/) and ensure the trunk and tags were uploaded successfully.

After committing the initial trunk or tags, the WordPress plugin repository takes about fifteen minutes to update. After that, head over to your plugin’s URL at the plugin directory (in my case, http://www.wordpress.org/extend/plugins/feed-styler) and see if everything in your readme file is appropriately displayed. If you need to make changes to the readme file, simply edit it locally and right+click the file and hit “SVN Commit.”

If all goes well, you should now see your plugin at the front page of the WordPress plugin page.

Plugin Page Added
WordPress Plugin Directory

Conclusion

Thank you for reading my tips on getting your plugin listed at the official WordPress plugin directory. If you have any questions/comments, please feel free to weigh in. I’d like to personally thank Bes Zain for assisting me in taking the screenshots and testing out this tutorial.

6/6/2007 ↓

Global Variables and the WordPress Loop 33comments

Author: Ronald Huereca Category: Wordpress Tips

My name is Ronald Huereca and am a new author here at WLTC. I come from a technical and business background with a degree in EET and a MS in Business Administration. I hope to share with the WTLC readers some of little intricacies of WordPress, whether it be theme or plugin related. I have written a few plugins, one called Feed Styler and the other Ajax Edit Comments. I currently write for my personal blog, the Reader Appreciation Project, and Devlounge. I am open to any and all feedback, so if there is something you’d like to see me write about, please let me know.

When coding a WordPress plugin, one thing that must be quickly mastered is that of the WordPress loop and global variables. Once mastered, a plugin author can tell which global variables are accessible, and which are not.

With certain WordPress Action and Filters, it’s easier to tell where within the loop certain code is executed. Sometimes, however, you don’t want to use an action or filter and want to simply have a template tag that is called from within the loop. When doing this, you want to make sure you know exactly what global variables you are trying to access and what result you’d like to achieve.

Within this post, I will dissect the WordPress loop so that you might have a better understanding of what variables are available to be called by template tags of functions called from within the WordPress loop.

The WordPress Loop

The WordPress loop is the loop that displays the posts on a particular page and also the comments if on a single post.

WordPress Loop Diagram

Within your default index.php theme file, the loop begins when you see this code:

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

The two functions have_posts() and the_post() are both property functions that access methods within the WP_Query class.

The have_posts function checks to see if the current post number is less than the number of posts you choose to display in the Admin panel. The loop will then continue until the current post number reachers the maximum number of posts you have decided to show.

If you were to dissect the_post function, you would find that it searches for the global variable $post. The the_post function gets the first post (and subsequent posts through each loop iteration), and sets up the post data (author, multi-page, etc). This data is assigned to the $post variable globally, so you may access it as well.

After the_post() has been called, you have access to a multitude of template tags and global variables. Below are some examples of template tags that are now available:

  • the_author: Retrieves the author’s name.
  • the_title: Displays the title of the current post.
  • the_content: Displays the contents of the post.
  • the_permalink: Displays the URL for the post in the form of a permalink.
  • the_ID:Displays the post ID.

Listed below are the global variable equivalents of each of those template tags:

  • Global variable authordata can be used. You could call it in a function using this code:

    global $authordata;
    echo $authordata->display_name;

    The authordata global can also access: nickname, last_name, first_name, ID, user_email, user_url, user_login, description, and several others.

  • Global variable post can be used. You could call it in a function using this code:

    global $post;
    echo $post->post_title;

    The post global can also access: ID, post_author, post_date, post_excerpt, comment_count, and several others.

  • Global variable post can be used. You could call it in a function using this code:

    global $post;
    echo $post->post_content;

    Keep in mind that accessing the content this way is accessing the unfiltered and untouched post content. This is useful if you wanted to manipulate the content to your liking instead of WordPress having a say in the content appearance.

  • There is no quick global access, but all the_permalink function does is echo out the results of the function get_permalink with the assumption that the $id variable is set.
  • Global variable id can be used. You could call it in a function using this code:

    global $id;
    echo $id;

A Template Tag Example

Say you made a custom template tag called get_my_trackback that was to do something everytime a trackback was detected within the comments loop. You would place the function call within the foreach comments loop in the comments.php template file. This example assumes that you are on a single post using the single.php template file.

<?php foreach ($comments as $comment) : ?>
get_my_trackback();
<?php endforeach; /* end for each comment */ ?>

Within this get_my_trackback function, you can do something like:

function get_my_trackback() {
global $comment;
if (empty($comment)) { return; }
if ($comment->comment_type != 'comment') {
//do trackback stuff
}
}

WordPress Comments Loop Diagram

The comment global allows you to access the comment database fields so you can do just about anything regarding the comment. Please notice that the global variable is not assumed to be set. You always want to make sure the variable has a value before proceeding so that errors are minimal.

Conclusion

Within this post the WordPress loop was dissected and global variables explained so that you may access them from a template tag in an include file or a WordPress plugin. If you have any questions, comments, or additions, please feel free to weigh in.

4/29/2007 ↓

  • Radio to WordPress Migration

    Radio to WordPress Migration: Scott writes out some instructions on how to migrate from Radio Userland to Wordpress in the process of finally migrating to Wordpress himself. I found some resources in the Wordpress wiki that needs serous TLC but Scott’s instructions might help some people. He uses a tool from Steve Hooker called backLogAllRSS but had to hack the code for things to work to his liking and he promises to share the code ;) . Welcome to the world of Wordpress, Scott! (4)

4/11/2007 ↓

  • Faster blogging through Markdown

    Faster blogging through Markdown takes you through writing posts using Markdown. Markdown is an easy to use plugin that lets you use simple text to automatically generate HTML for ordered lists, italics, bold, blockquotes etc. (8)

4/10/2007 ↓

WP SEO Tips: To Follow or Not to Follow 41comments

Author: Jonathan Category: Wordpress Tips

Geared specifically at Google, today we are talking about the NOFOLLOW tag.

There are dozens upon dozens of articles written on “should we use nofollow?” or “shouldn’t be we using nofollow?” among other questions as well. Today I am tackling the issue myself.

NOFOLLOW is a tag that Google created as a means to fight back against spam on blogs. As of today, Google is the only search engine actively using the tag as an integral part of their algorithm. The NOFOLLOW tag simply tells Googlebot to not follow — aka don’t give any link love — to the link you have on your site with that tag. Yahoo! and MSN do not care whether a link has nofollow or not, they will follow the link you provide them.

Wordpress has, by default — and for a long time now — nofollow’ed all links to authors in comments. I finally opted to install the plugin TOFOLLOW. I’m using this plugin to actually FOLLOW the links in my comments. As you can see on an article with comments that I am indeed following all the links pointing to the authors of the comments.

Since spam fighting tools are so abundant now for Wordpress, there’s really no reason that Wordpress should still be using the nofollow tag for comments.

Quick References

4/6/2007 ↓

  • Protected pages in WordPress

    User only/protected pages in WordPress provides a tutorial and code on creating pages that can be restricted to only logged in users of your blog. Works well if you have valuable content to read and want users to register on your blog before they do so. Remember, if your content is not valuable, you’ll find users just closing the browser window. (0)

4/2/2007 ↓

WP SEO Tips: How to actually build links - Part 3 39comments

Author: Jonathan Category: Wordpress Tips

This is part three of the Link Building series here on WeblogToolsCollection. I will be touching on some final thoughts of actually how to build links to your site. The initial first two posts were some background notes for everyone to learn about how linking works and how outbound linking works.

I will touch on two major areas. What you should be doing and what you shouldn’t be doing.

Link Building and what you should be doing

Link building takes finesse, creativity, and social engineering. Why do I say social engineering? I say that because it takes networking and talking with new people. Be a friend, be a co-worker, be an associate. These are some of my secrets of how I’ve built my network of websites.
Read the rest of this entry »

Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

Latest Videos

Latest WordPress Jobs

S2