Animal rescue custom post type plugin for WordPress

screenie_plugin_animals-cpt_add-postI’ve worked on a number of animal rescue WordPress websites and recently developed a basic ‘custom post type’ plugin so that animals for adoption can be posted separately from regular ‘posts’. Posts can then be reserved for news, events and general blogging.

I’m making my ‘animals custom post type’ plugin available for download here (it’s free, released under GNU General Public License):

Download Animals Custom Post Type Plugin

Download the .zip file and:

  • upload it via FTP to your wp-content/plugins directory, or in your WordPress admin panel, go to Plugins > Add New > Upload, to upload the file manually, then
  • activate the plugin on the ‘Plugins’ page and the ‘Animals’ option should then appear in the menu

Note: In some cases, the permalink structure must be updated in order for the new template files to be accessed when viewing posts of a custom post type. To do this, go to Administration Panels > Settings > Permalinks, change the permalink structure to a different structure, save the changes, and change it back to the desired structure.

What’s included in the ‘Animals’ custom post type and custom taxonomies plugin?

Once the plugin has been installed and activated you will see an ‘Animals’ option appear in the list on the left of the WordPress admin dashboard.

Here you can add posts for any type of animal for adoption, and there are 6 types of custom taxonomy included with the custom post type, which are:

  • Species
  • Gender
  • Age Group – included so that you can group animals of similar ages together, e.g. 0-1 years, 2-5 years etc.
  • Age – so that you can also add a more specific age
  • Rehoming Status – you can add custom rehoming statuses such as ‘Available for adoption’, ‘In foster’, ‘Rehomed’ etc.
  • Rehoming Options – you can add custom rehoming options such as ‘Can’t be homed with children under 10’, ‘Can live with dogs’ etc.

All of these taxonomies can then be easily accessed from the front end of the site, for example in a menu, a tag cloud widget or an advanced search system so that people can perform very specific searches on animals for adoption.

(If you want to add more custom taxonomies here’s a very useful ‘Custom Taxonomy Code Generator‘.)

Why use a custom post type for animals for adoption?

Using a custom post type has many advantages over using regular posts:

  1. It makes the administration process easier for the rescue owner/website manager – it’s a much better user experience if you can see the ‘Animals’ section in the admin panel and click on ‘add new animal’ instead of using ‘add new post’ for animals AND regular posts alike.
  2. You can use different taxonomies for each post type, so whereas your ‘posts’ might just have the tags and categories taxonomies available, your ‘animals’ can have custom taxonomies like age, gender, breed etc. and it’s much simpler for the end-user than if these custom taxonomy options are presented to them on the post edit page when they’re simply writing a regular news/blog post.
  3. It’s easier to distinguish and display the animals for adoption on the front end of the site – your animals for adoption can be given their own style based on the custom post type – many WordPress themes add a special CSS class to the ‘body’ html tag based on the custom post type of the archive or single post being viewed, and special custom post template files can be included in your theme, so the layout of the page can be completely customised.
Update July 2014
I’ve had a few queries in the comments about how to display your animals custom posts. I found this tricky when custom post types were first introduced too!

You can basically access the custom posts via a URL and you can include the URL(s) in your menu on the front end of your site. So for example:

To view all animals:
http://yourwebsite.com/animals/

All animals marked as ‘available for adoption’:
http://yourwebsite.com/rehoming_status/available-for-adoption/

All animals of a certain species, for example – dogs:
http://yourwebsite.com/animal_species/dog/

All animals of a certain gender:
http://yourwebsite.com/animal_gender/male/

All animals of a certain age:
http://yourwebsite.com/animal_specific_ages/2-months/

So whatever terms you have used for taxonomies you can view all posts marked with those taxonomies.

Another method suggested by Jennifer Mann in the comments (thanks Jennifer!) is to use the ‘Display Posts Shortcode plugin‘ which makes it super easy to create a page and simply add in a shortcode to display any list of posts within that page.

So for example, to display a list of all animals posts created using this ‘animals custom post type’ plugin, you would use this shortcode:

[display-posts post_type=”phanimals”]

 

To find out more about different options for the list using this method (such as showing images and excerpts), see their arguments document here: https://github.com/billerickson/display-posts-shortcode/wiki

I love helping animal rescues get more from their WordPress websites, so hopefully this will be the first of many posts dedicated to the topic :) Soon I will add more information and code examples on how to display the custom taxonomies on your animals for adoption posts on the front end of your site using the terms function.

Do let me know in the comments if this plugin was useful for you or if you have any questions.

8 thoughts on “Animal rescue custom post type plugin for WordPress

  1. Hi
    Just installed your plugin as I am building a dog rescue website and your plugin looks like it will do the job.

    My only problem is how to show the custom post types on a set number of pages or even on one page.

    Have you or are you going to show us with some code examples please.

    Thanks

    Colin

  2. Hi, I am just wondering if you are going to let us know how to display this on a page. I’m not a developer but know how to use WordPress to a certain degree but the programming side I am a bit lost.

    I have just got a website up and running for a newly formed charity called Finding Furever Homes, that is involved with Dog Rescue’s in the UK but I have been having problems on how to change look of the page.

    I have used a plugin called Pet Manager and it produces a page of dogs but they are set out as 1 per row and it takes up too much space. All I want to do is show 3 per row and for some strange reason the 2nd row only shows 1, whereas the other rows show the required 3.

    This should be a simple CSS problem but it is driving me up the wall trying to fix it. I can read through some of the plugin code and get a gist of it but some of doesn’t make sense.

    The layout I’m trying to get works on localhost on my demo but when I copy the pages and made the same adjustments on the live version it doesn’t work.

    I can understand what your plugin is about but unfortunately I can’t take it any further so again just wondering if you where going to explain it further.

    Colin

  3. I would also be very much interest to know how to make the newly created posts to show up. I am not familiar with the “magic” that custom_post_type requires.

  4. Since no one has answered this, I thought I would give my solution.

    Download the “Display Posts Shortcode” plugin for WordPress found here:

    https://wordpress.org/plugins/display-posts-shortcode/

    Within the page / post that you would like to display your list of animals, put in this shortcode.

    [display-posts post_type=”phanimals”]

    For more options for the list (such as showing images and excerpts in the list), see their arguments document here:

    https://github.com/billerickson/display-posts-shortcode/wiki

  5. ALSO: After making a post of my animals, I would click to preview at the url and they would not be found (would show 404 page). I found this snippet from wordpress docs about custom post types.

    “Note: In some cases, the permalink structure must be updated in order for the new template files to be accessed when viewing posts of a custom post type. To do this, go to Administration Panels > Settings > Permalinks, change the permalink structure to a different structure, save the changes, and change it back to the desired structure. ”

    I went and changed the permalinks, clicked save, then selected the “Post Name” option and clicked save again. It worked! Finally!

    • Very important to remember (I’ve been frustrated by this myself when I first started working with custom post types!). I did mention it in the article above but it’s an easy point to miss.

  6. Hello,

    This custom post type is a fantastic starting point for our rescue group. Thank you for creating it! I do have a question. Is there something I can do to modify the post display to show the custom taxonomies? Also, I repurposed a couple and would like to change the label to match. How would I go about accomplishing these two goals?

    Very new to WordPress, but I wanted to give my rescue something they could maintain easily.

    Thank you!