Home » Documentation » What is PeoplePods? » Creating a new content type

Creating a new content type

To create a new content type, use the core_usercontent pod as an example. This pod contains several files, including generic handlers for adding and editing content, viewing permalinks, viewing lists of content, adding comments, add accepting votes.

You can customize the content type by editing a simple config file and creating a few templates in your theme! However, you'll probably want to dig deeper into the code to add special functionality.

1) Copy core_usercontent pod to a new name

cp -R core_usercontent content_post
2) Edit the content_type.php file. This file contains information used by all the other files.

Set the $content_type variable to a short name for the new content type. No spaces!

	$content_type ='post';

Set the $permamlink variable tp first part of the permalink. This will be used to make links to each piece of content, as well as to the list of most recent content. We'll use "blog." This means we can get a list of new posts at /blog and each post will be located at /blog/title-of-post

	$permalink = 'blog';

Set the edit/add url. This means I can go to /edit to create a new post.

$edit_link = "edit";

Change the name of the edit form template. This template will be located in the theme/content folder and will be used on the add/edit page

	$input_template = 'postform';

Change the name of the default output template for the content permalink:

	$output_template = 'post';

Change the $pod_dir variable to the same name as the folder you created in step 1.

	$pod_dir = "content_post";

3) Go into your theme content directory. Copy editform.php to the new template you referenced in step 2.

cp editform.php postform.php

4) Make changes to the form design and fields.

You can create meta fields by naming them meta_fieldname

You can attach files by simply creating file inputs. The files will be named the same as thing as the input.

For example, if we wanted to add a meta field named "Via" we could add this to our form:

<input type="text" name="meta_via" value="" />

5) Copy output.php to the the new template you referenced in step 2.

cp output.php post.php

6) Load the PeoplePods Command Center, go to Options->Plugin Pods and turn on your new custom content type pods. They'll be called contenttype_YOURCONTENTTYPE_add, contenttype_YOURCONTENTTYPE_edit, and contenttype_YOURCONTENTTYPE_list.

7) Navigate to your new add/edit screen. You should see your new form. Create your first test post!

8) Your new post should show up at the top of your content list. Click on it. You should see that it goes to a new permalink url as descrived in step 2. But the template is the generic template!

9) Go back to your theme directory and customize post.php

VOILA!

You may want to change the access restrictions on your new content type pods. For example, you may want to restrict the add/edit pod to admin users. You can do this by changing the 'lockdown' parameter in the pod files.

  • Discuss This Document

No comments have been posted yet.

Download Download the latest version of PeoplePods!

0.7 Latest Version:
Release Notes

A free membership is required to download PeoplePods.

  Already Registered? Login

Recent Posts from Our Blog

Version 0.7 Now Available

Last night, I uploaded a new release of PeoplePods: version 0.7. The most exciting new features in this version are: new dynamic image resizing options, a faster comment polling system, new ways...

Developer Preview Launch!

I am very excited to announce the launch of PeoplePods version 0.666, THE DEVELOPER PREVIEW! After tons of hacking, I have tweaked the last line of code, and I am finally ready for a wider audience...

Recent Posts from The Forum