Category: WordPress (page 1 of 2)

Custom Post Types and Custom Fields Made Easy

Last night, I presented at the local Milwaukee WordPress Meetup on Custom Post Types, Custom Taxonomies, and Custom Fields. These are very power features of WordPress that can allow you to do some pretty amazing things with the software.

Custom Post Types, Custom Taxonomies, and Custom Fields are major parts of what can unlock the true potential of WordPress as a full-fledged content management system. For a good overview of WordPress as a CMS, I recommend Aaron Holbrook‘s talk titled “WordPress is a CMS, Dammit!” [Slides | Video from WordSesh]

During our meetup presentation, I walked through setting up an employee listing feature for a site including the following info:

  • Custom Post Type: Employees
  • Custom Taxonomy: Departments
  • Name Field (Title)
  • Bio Field (Content Editor)
  • Job Title (Custom Text Field)
  • Certifications (Custom Repeater Field)
  • Start Date (Custom Date Picker Field)
  • Photo (Custom Image Field)
  • PDF of Bio (Custom File Upload Field)

We talked briefly about the WordPress Template Hierachy (and I even gave out some of Michelle Schulp’s template hierarchy posters from WordCamp Chicago).  Based on this, we created and edited archive-wpmke_employee.php and single-wpmke_employee.php to create some custom templates that displayed our post type and custom fields.

Overall, I believe everyone learned a thing or two.  There is a lot you can do with custom posts, custom taxonomies, and custom fields that I couldn’t touch on in my 1hr+ presentation.  Below are some resources from the meetup presentation and discussion.


WordPress 3.7 Core Contributor

WordPress 3.7 Core Contributors

WordPress 3.7 was released last night while I was on my way to our local WordPress meetup. Once I arrived, I promptly updated to the new version, because I like to stay on top of the newest releases, but also for another reason… Yes, I am listed as a Core Contributor in this version!

I’ve been wanting to help out WordPress core for some time and for this version I decided to start by volunteering to help document a few files in the inline docs for hooks initiative.

This is my first time contributing to WordPress core and I’m sure it won’t be my last. I love the community around WordPress and plan to give back by contributing more code to WordPress core and also continue to participate in my local meetup and WordCamps.

If you are interested in WordPress at all, I’d suggest getting involved!

A Redesigned WordPress Template Hierarchy

WordPress Template HierarchyWordPress offers a very useful Codex that I typically refer to multiple times a day while developing and designing WordPress websites.  One of the most valuable pieces of info that I’ve found in the Codex is the graphical representation of the Template Hierachy.  This graphic lets you know which files in your theme are used to display different post types and data (ie. Blog Posts, Custom Posts, Pages, Home Page, 404).  Unfortunately, what is there, while very useful isn’t the prettiest or easiest graphic to understand.

Luckily, one of my good WP Friends, Michelle of Marktime Media, took it upon herself to redesign the Template Hierarchy graphic with a focus on making easier to read and scan quickly so it can be more easily understood.

I urge everyone to use this great WP Resource.  Michelle did an awesome job of transforming this already useful resource into something even more valuable to the greater WordPress Community.

Check out the Redesigned WordPress Template Hierachy.

My First WordPress Plugin – WP-AntiSpambot

I’ve been making WordPress sites and plugin functionality for some time now, but have yet to make anything to release to the public.  I’ve been thinking about making something to submit to the WordPress plugin repo for some time and finally figured out I would do it.  I just wanted to see the process and get something up there, so I started out very simple.

I decided I’d create a plugin using the built-in WordPress antispambot() function.  This function will take a plain text email address and encode it into HTML entities so spambots can’t read it.  I don’t know how, but I didn’t actually know about this function until about a a month or two ago.  I figured I’d create a shortcode that takes advantage of this function in the WordPress editor.  You just have to wrap up your email address the shortcode as shown here to make your email address hidden to spammers (remove the spaces, of course).

[ email ][ /email ]

I say the plugin is simple.  How simple you ask?  Well, it’s only four lines of code, save comments:

function df_antispambot_shortcode( $atts, $content = null ) {
 return '<a href=mailto:' . antispambot( $content ) . '>' . antispambot( $content ) . '</a>';
add_shortcode( 'email', 'df_antispambot_shortcode');

Yep, pretty simple.

I end up making some future improvements.  I had a suggestion to parse the editor to detect emails and automatically add antispambot.  I also could add a TinyMCE button to create the shortcode.  Maybe we’ll see these in future versions.

The submittal process to the WordPress plugin repo was pretty simple and straightforward.  How long does it take to get a plugin approved in the WordPress repo?  I submitted the plugin on February 28th and it was approved on March 6th.  Not too bad.  I encourage anyone to try your hand at a plugin.  It’s a fun experience.

Download my WP-AntiSpambot plugin here »

Change ALL the WordPress URLs for Site Migration, the Easy Way

At some point during the development of your website you are going to need to move it to a different server. You may start out working on your local machine using MAMP or XAMPP or you may work on a staging server before pushing your site live. Someday, you may even need to change the URL of your website altogether.

Now, you are working with WordPress and you know that WordPress stores the Site URL and Blog URL in the database and uses this to provide the URL to the enqueued CSS and JS files and for your menu, among other things. You go and change this, but you see that there are other URLs in your content or plugins that have not been changed. How can you be sure that all of your URLs are changed without having to sift through each and every page and post or having to install yet another plugin?

Enter the Search Replace DB PHP Script. This is a PHP script that uses your WordPress wp-config file to gather your database information then searches your database for any string of text you’d like and replaces with another string of text. This can be done to replace any information into the database, however, it is extremely useful for replacing all of the URLs on your site. Continue reading

Older posts

© 2019 Dustin Filippini

Theme by Anders NorenUp ↑