WordPress Meetup: Q&A

Thanks to Clark Wimberly for setting up tonight’s meetup. See his notes at clarklab.net.

Look for the video online soon at Austin Tech Videos.


Using a staging server to deploy changes

Presented by Chris Lazan and Mark Kelnar of WP Engine

They demonstrated their staging system which allows you to upload plugins and themes and test them before making the changes live.

If you’re not using the WP Engine hosting, the best plan is to use phpMyAdmin to backup your site, work on the site on a localhost, and then upload it to the live site.

Bill Erickson has a great post on his site that details out the process to move a site from a local/development server to the live site.

 

What is a custom post type

Presented by Clark Wimberly

What is a post?

  • Posts – blog posts, which are the chronologically-based posts
  • Pages hierarchical organization
  • Attachments,  Revisions and Nav menus are also posts

Custom post types can add new content by allowing you to add additional types of posts.

When you register a new custom post type, it is separate from normal loops/queries. They won’t show in RSS or widgets unless you want them to.

Register a new custom post type in functions.php. You need to define just a few options but that’s it. The new post type will show up in your WP-admin immediately.

See Clark’s presentation for an explanation of how to create a custom post type. Justin Tadlock also offers a tutorial on how to set up a custom post type.

Themergency has a code generator for custom post types.

More info on custom post types at WP Beginner.

 

Keeping your HTML safe from the editor

Presented by Pat Ramsey

The problem: if you put HTML in your page/post, it can get corrupted if someone goes in to edit that page later. If you create a shortcode, you can place a marker in the page to some HTML that resides in your functions file rather than in your HTML code in the editor.

Shortcodes are text in [brackets].

He showed code for your functions.php file to create different shortcodes.

This is particularly useful for adding HTML to widgets. You can pop in a shortcode into a text widget rather than HTML code. You will have to enable this in your functions file.

You can read more about shortcodes on Bill Erickson’s site as well as the WordPress codex.

 

WordPress beyond blogging

Presented by Jo Carrington

Using WordPress as a content management system: allows us to define any arbitrary amount of content like posts and pages. Can use custom post types to create new content areas.

How to create custom post types with plugins.

Let’s pretend we have a bookstore website. We would need:

  • Posts
  • Pages
  • Books: Title, Publisher, Author, ISBN, Price (each of these is a field)
  • Staff: Name, Photo, Bio, Twitter
  • Events: Name, Time, Description

Two plugins:

Create the new custom post type with More Types. Then you can add additional fields with More Fields. You will need to edit your template file (php file) with a WordPress hook to get this information and display it. Go to the WordPress Codex for the get post meta code to add the code into your site.

 

What is the Loop?

presented by Nick Batik (our brave soul for the evening)

The WordPress loop basically does this:

 if there are posts

    while (there are posts)

    do something

end

 An example of the loop in the WordPress Codex – see the section “the World’s Simplest Index Page” for a simple example of the loop in action.

The loop is the core of every single page displayed on your website. Every page/post on your site will run the loop, even if there’s just one post.

Look at the template files for the default WordPress theme Twenty Eleven for different examples of the loop.

One suggestion from the group: the premium plugin Loop Buddy allows to modify the loop without getting into the code.