Browsing articles in "Tutorial"
Sep
24
2012

WordPress Dynamic Post Tag Matching

wordpress_tags

The Problem: The client only wants to show posts when all post tags match the user selected form tags generated by a web form using an unknown amount of form field criteria and tag definitions. The Solution:  We use the PHP array_diff_assoc() function to compare two arrays.  If the arrays match we display the post.  If they do not match, we don’t.  Pretty simple, right? The How: First we need to get the array of [...]

Feb
10
2012

PHP Grid with Modulus and WordPress

grid

Creating a layout in WordPress can be a simple, or complicated task. This quick tip will show you how to use modulus and PHP within WordPress to create a grid for your posts and images. We will use a single variable to set how many grid columns to use or, in even simper terms, how many items to display across horizontally before we move to the next line.

Dec
5
2011

WordPress Parent Child Page Links

parent_child_relationship

WordPress page links can be accessed by default functions such as wp_list_pages and wp_page_nav. Yet I came across a project where I need the ability to control the WordPress page Parent->child links with more accuracy. I needed the ability to break apart the default WordPress data into groups of parent pages and their children, and then be able to display them using any HTML container I chose. WordPress Page function Limitations WordPress functions to access [...]

Nov
11
2011

WordPress Conditionals and PHP Switch Case

Wordpress Conditionals and PHP Switch Case

WordPress core comes with many built-in conditional statements. We are going to mix a traditional PHP switch / case statement with WordPress conditionals that make the most sense: WordPress Conditional is_page() The reason this WordPress conditional make the most sense for this tutorial is because it allow for more then a simple yes/no by allowing us to predefine several different options. Using WordPress is_page() <?php /******************************* * A custom Switch-> Case * statement for WordPress [...]

Jun
14
2011

WordPress Upload Multiple Attachments

Wordpress Upload Multiple Files

Quick Tutorial on Uploading Multiple Files in WordPress Uploading multiple files in WordPress is something that was mentioned in the post at lewayotte.com. I felt a need to answer the challenge of uploading multiple attachments in WordPress while still using media_handle_upload() instead of a custom PHP script. I’m never one to reinvent the wheel but I am someone whole likes to find ways to make that wheel better! File Checking This tutorial doesn’t go over [...]

May
31
2011

WordPress Upload Attachment

Wordpress Upload Attachment

Uploading an Image to WordPress An often requested part of WordPress is the ability to upload a file attachment or upload an image. This tutorial is a continuation of the WordPress Tutorial: Custom Profile Page. Using the WordPress function media_handle_upload() we will be uploading an image for our custom profile. More then that, we will be uploading an image in WordPress and then deleting the old one using wp_delete_attachment() and, lastly, we will be displaying [...]

May
23
2011

WordPress Tutorial: Custom Profile Page

Wordpress Custom Profile Page

Creating a WordPress Custom Profile Page Download the WordPress Custom Profile Page source files This is part 1. To learn about adding a profile image continue to step 2 Before we begin building a custom profile page for WordPress it is important to note that there are many methods to implement when the profile page is to be displayed. For simplicity in a tutorial I will be implementing the page using a custom WordPress page [...]

May
11
2011

WordPress: Adding custom buttons to TinyMCE

Wordpress Adding TinyMCE Buttons

This is an introduction to adding custom buttons to the WordPress TinyMCE With the frequency of WordPress themes including dozens of shortcodes I’ve created a class to place custom buttons into the WordPress TinyMCE editor. I have to give credit to Justin Tadlock for venting his concerns with over using shortcodes. It helped me realize that so many shortcodes are redundant. If one is determined to make life easier for your clients and customers I [...]

Apr
27
2011

Members Plugin Tricks

Members Roles Plugin

Custom Registration with the Members plugin The Members Plugin, by Justin Tadlock Has been around for some time. It is one of the most used plugins for user role management in the WordPress community. One unusual piece of code that wasn’t added was the ability to set up a custom login of sorts. The following script requires you to have downloaded and already installed the Members plugin and if you have not, you can download [...]