PHP Tutorials Category Archive

Aug 10 Creating Custom Menus in WordPress 3 Written by: Curtiss | No Comments »

Wordpress Custom MenusIn my previous post, I outlined how you can add support for the new custom menus that were enabled in WordPress 3. Tonight, I will briefly review the process of creating and organizing those new menus from within your WordPress administration area.

To start with, make sure you’ve activated the theme into which you added the custom menu support. Once you’ve done that, you will see a “Menus” link in the “Appearance” menu on the left sidebar of your administration area. Click on that link and you will see a fresh new screen with a few options on it. (more…)

Aug 4 Adding Custom Menus to Your Wordpress 3 Theme Written by: Curtiss | 2 Comments »

One of the cool new features that was unveiled as part of Wordpress 3 is the ability to create custom menus with a drag-and-drop interface, similar to the way widgets are added to “sidebars.” However, documentation for this new feature is still extremely sparse. After reading a handful of tutorials explaining small bits of the new feature, and performing a lot of trial-and-error testing, I finally got these new custom menus working with a new theme I was building.

The first step is to enable the custom menus within your theme. That is what I’ll try to cover in this article. In an upcoming article, I’ll discuss how to actually create the menus within Wordpress and start using them. (more…)

Jul 28 Tips for Improving Wordpress Subscriber Options Written by: Curtiss | No Comments »

Earlier this evening, I was trying to figure out how to make “private” Wordpress pages available to all of the registered users on one of my particular blogs. Unfortunately, user capabilities is still one area where Wordpress is seriously lacking out-of-the-box, and there are very few plug-ins that actually seem to work properly for this purpose.

However, after a bit of Googling, I found a really helpful post on Steve Taylor’s blog. In addition to providing a very simple, two-line solution to my particular situation, Steve’s post offers a few other tips that could come in really handy for Wordpress administrators.

Jul 12 Order Wordpress Pages By Multiple Fields Written by: Curtiss | No Comments »

Using the standard query_posts() method with Wordpress, it’s extremely simple to dictate in what order you want your posts and/or pages displayed when they are being shown together; as long as you only want to sort them by a single criterion. However, if you want to sort them by more than one criterion, then you have to do a little more work. (more…)

Jul 8 Fill Your Wordpress Blog With Fake Content Written by: Curtiss | No Comments »

I realize the concept may seem kind of silly to most people, but I recently needed to fill one of my Wordpress sites with a bunch of fake content in order to do some testing. Rather than going through the tedious process of trying to create a bunch of fake posts and pages myself, constantly switching back and forth between lipsum.com and my test Wordpress site, formatting the content in different ways; I headed to Google to see what I could find. (more…)

Jun 13 Writing a WordpressMU Widget Written by: Curtiss | No Comments »

While working on a new website today, I found myself needing a widget that would show the archive list from one blog on another blog within my WordpressMU installation. Unfortunately, after a bit of Googling, I couldn’t find any that already existed. It was then that I decided to take matters into my own hands.

I started searching for tutorials on building Wordpress widgets. I found some decent tutorials, and was able to put the widget together pretty quickly. However, I then realized that I needed to be able to use multiple instances of the widget, as I have more than one sidebar set up (one or the other is shown, depending on which page the visitor is viewing). Then, it was basically back to the drawing board. (more…)

Jun 10 AES Encryption with PHP and MySQL Written by: Curtiss | No Comments »

Occasionally, you may find the need to encrypt information within a database. One of the standards for encryption is AES (Advanced Encryption Standard). In fact, in a lot of government institutions, AES is the required data encryption method.

At this point, I feel I need to make an important distinction. Encryption is a reversible method of masking data; not to be confused with hashing, which is supposed to be a one-way encoding method (though, many hash methods can be cracked through various types of attacks).

If you do need to encrypt your data, you have a few options when working with PHP and MySQL.

The first option is a pair of built-in MySQL functions. AES_ENCRYPT() and AES_DECRYPT() make it easy to encrypt and decrypt your data directly through a MySQL query. In order to use the AES_ENCRYPT() and AES_DECRYPT() functions, you will need to provide the data (original data should be provided to the encryption function, the encrypted data should be provided to the decryption function) as the first parameter and a 16-bit key as the second parameter. The same key will need to be used for both functions (otherwise, the decryption won’t work properly).
(more…)

Jun 6 Wordpress Password-Protected Posts Written by: Curtiss | No Comments »

Following are a few quick tips for working with the built-in functionality to password-protect pages and posts in Wordpress. Wordpress allows you to add a password to any post or page, and hides the content of that entry until the visitor enters the appropriate password. Each password-protected page has its own unique password, and only one single password is used for that page (as opposed to “Private” pages, which require a user to be logged in with their own username and password for the site). (more…)

May 24 Using Javascript in Wordpress Themes Written by: Curtiss | No Comments »

If you’re planning to use javascript on your Wordpress blog or website, there is one function with which you should become intimately familiar. That function is wp_enqueue_script(). It will also be helpful if you do a little bit of research into the wp_deregister_script() function, though, the only official information you’ll find about that function is in the codex information about the wp_enqueue_script() function.

Basically, this function keeps a log of all of the javascript files and libraries you want to use in your theme, makes sure you aren’t duplicating any, and then outputs them in the right order. I would recommend setting the $in_footer parameter to boolean true for all of the scripts you enqueue, as that causes Wordpress to add the javascript calls to the footer of your pages rather than putting them in the header. In order to do this, though, you need to make sure that you include the wp_footer() function inside of your theme (preferably just above the closing </body> tag). (more…)

May 19 Wordpress Post Thumbnails Written by: Curtiss | No Comments »

Although there was initially a lot of fanfare over the new “thumbnail” features that were added to Wordpress when version 2.9 was released, the documentation for the various functions related to post thumbnails is still severely lacking. In this article, I hope to shed a little light on the subject, as far as I can understand it. There are four new functions related to post thumbnails. Following are some short explanations about what the functions do and how to use them. (more…)