Attachments as Post Custom Fields

Download Plugin

This is one of those plugins I’ve been waiting for someone to come up with for a long time. But I guess, it’s not very sexy and definitely not very ambitious. But pretty useful.

You need to be create a custom field for an attachment URL. Maybe it’s a custom thumbnail, maybe it’s a document link, etc. But instead of the user having to copy and paste the URL, you want them to be able to do it from the Media Window. Well now they can, install the plugin and you’ll now be able to assign the URL of any attachment to any custom field without having to copy and paste.

Screenshot 1 – Upload Photo and Select and existing custom field:

Screenshot 2 – Or add a new custom field:

WordPress PodsCMS Widgets

I’m not sure why it took me this long to put this plugin together, but whatever. I’ve been using WordPress PodCMS plugin for a long time now. And quite often I need to add pod stuff to a sidebar. Usually, I’d go find a custom sidebar that I’d made before and adapt it. But then I realized how super easy it would be to have a widget that allows you to select which Pod you want to show and which template you want to show it with !!! so bang!

WordPress PodsCMS Widgets – Version 0.1

Registration Forms: What’s New in 1.5

Last week I released version 1.5 of my Simplr Registration Forms plugin. The new version includes some big fixes and requested features. Particularly, this version now supports WP Multisite and has a few addition profile fields that can be added to the default form. It also includes better security, via WP nonces, and better field validation.

But the most important change is that it includes hooks and filters that allow it to be extended by you, the user.

For instance, let’s add a field to our form that requests the user’s zip code. First, in your functions.php file create a function for displaying the field:

function sample_zip_field($form) {
 $form .=  '<div>';
 $form .=  '<label for="zip">Zip Code:</label>';
 $form .=  '<input type="text" name="zip" value="'.$_POST['zip'] .'"/><br/>';
 $form .=  '</div>';
 return $form;
}

Note that this function receives the parameter $form and then returns $form. Failing to return the form will make the entire registration form disappear. To add this form to the registration use:

add_filter('simplr_add_form_fields', 'sample_zip_field');

But then we also need to make sure this data gets saved when the for gets saved. So you’ll need to create a function for that as well.

function sample_save_meta($user_id) {
if(isset($_POST['zip'])) {
 add_user_meta($user_id, 'user_zip', $_POST['zip']);
 }
return $user_id;
}

Note that in order for this function to work properly it has to receive the $user_id. It is also good practice to return the $user_id at the end of the function, though not necessary.

To make sure your save function is called use the hook:

add_action('simplr_profile_save_meta','sample_save_meta');

With these two “hooks”, you can customize the registration form however you want. You could even set up your field function to only display on certain pages, making it form-specific.

Finally, I’ve also added filters to the labels on the default form fields so you can change them at will. For instance, to change username to “screen name” use the following.

function sample_label_username($label) {
 $label = "Screen name: ";
 return $label;
}
add_filter('simplr_label_username','sample_label_username');

I hope you find the changes useful.

Custom WordPress Registration Pages (v 0.1.7)

Key Links:

Installation Instructions:

Download and unzip the package. Upload the simplr_reg_page folder into your wp-content/plugins directory. Go to your plugins dashboard and click “Activate”.

Usage Instructions:

To use this plugin simply employ the shortcode [Register] on any WordPress post or page. The default role is “subscriber”. To apply another role to the registration simply use the the role parameter, for instance: [Register role="editor"]. If you have created custom roles you may use them as well.

You can also use shortcode so specify a custom confirmation message for each form:

[Register role="teacher" message="Thank you for registering for my site. If you would like to encourage your students to register, please direct them to https://www.domain.com/students"]

Finally, you can specify emails to be notified when a new user is registered. By default site admins will receive notice but to notify others simply use the notify parameter:

[Register role="teacher" message="Thank you for registering for my site. If you would like to encourage your students to register, please direct them to https://www.domain.com/students" notify="email1@email.com,email2@email.com"]

Plugin Options:

Please feel free to suggest future options for this plugin in the comments. The current options are:

  • Admin Email: Specify the FROM email you would like to use for the registration confirmation message.
  • Confirmation Message: Customize the message you would like to appear in the confimation email.
  • Style: Overrides the default stylesheet included with the plugin.

WordPress PodsCMS SEO Titles Plugin

I haven’t submit this plugin to the WordPress SVN yet, because I’m still playing with it. The remaining issue is that while it works, I’m not sure it works in the most efficient manner possible. I’m also going to post it over at @podscms and get some feedback.

At any rate, for anyone who’s running a pods installation and having trouble getting SEO friendly titles on your pod pages, this plugin creates a template tag <?php pods_seo_title(); ?> that you can use to override wordpress default behavior. The plugins check to see if the page is a pod page, and if so calls the title of the respective pod. If not, it checks to see if the page is singular and returns the TITLE | SITENAME format if it is. Otherwise it returns the SITENAME | SITE DESCRIPTION form.

Download: Pods SEO Titles

Flutter vs. Pods: A Conversation

A friend of mind attended Wordcamp B-Ham and taped (that’s old school lingo for podcasted) a panel discussion about Pods and Flutter as two competing options for making WordPress a CMS.

Admittedly, I’m biased. You can read my review of WordPress Pods CMS here. But here’s my two cents anyway:

  1. If all you’re looking for is a way to add a new content type, and it’s ok that that content type is mostly based on the “post” format, then flutter will probably get you there. Flutter basically customizes the user interface for entering custom fields. Theoretically you could even get rid of all the default fields and use all custom fields instead.
  2. But if you need to create all new content types and need to have complete control over the end-user experience then pods is a much better choice. Pods is especially powerful when creating directories where you need to cross reference fields. For instance, you want to create a list of events where the end user can click on the speaker’s name and see all other events with that speaker. Trying to do this with flutter would be a nightmare. But with pods, you create a pod table for events and one for speakers, set up a template, and your done. Well, it’s not quite that easy … but it’s close.

The advantage of pods is that it’s robust and dynamic. Flutter is essentially just an advanced hacked. Pods is a true extension. But the disadvantage of pods is that, at least for now, it is still a tool for developers who know their html and at least a little bit of PHP. A novice user is going to find Pods maddening!

More info on Pods and Flutter.