A recent client project involved customizing the AgentPress Pro theme, which does not have a Communities custom post type in the theme (like the Winning Agent theme has). The client asked if I could add that feature to their site. I had two choices, either add the custom post type directly to the theme or add it via a plugin.
There are valid arguments for each case, but the consensus is that unless it is a heavily customized theme, where switching to a different theme would not be an option, you should use a plugin.
So rather than customize the AgentPress Pro theme – I wrote a plugin. In addition to the reason cited above, it also provides flexibility to add features going forward to the plugin, like support for Categories, Tags and custom taxonomies. If I had built that into the theme, then it would require modifying the theme again. That’s fine for one client, but what if I had several clients? or decided to offer this custom theme to everyone? You see where I’m going with this. If it’s in a plugin, all I have to do is update the plugin and voila, users have an easy way to update their version from the WordPress plugin repository.
So here it is: the Genesis Communities CPT plugin. The screenshots below are from a demo site I set up using the Genesis Sample Theme.
Wait a minute… why did you cross out Communities in the header above?
Because you can change the name of the custom post type to whatever you want, and change the name of the slug for better SEO. Top that off with the ability to sort the archive page and control the number of posts per page from within the WordPress Dashboard, and you can quickly see it offers a lot more than just Communities for real estate. All without having to mess with code!
So while I wrote this plugin to showcase communities, neighborhoods, and towns, you could easily use it for anything you want to showcase; a portfolio, projects, artwork, gardens, etc.
[clickToTweet tweet=”Easy to customize showcase plugin that adds a Custom Post Type to any Genesis theme. #genesiswp” quote=”Easy to customize showcase plugin that adds a Custom Post Type to any Genesis theme.”]
Custom Post Type Name and Slug
Deregistering the stylesheet
The plugin stylesheet is currently in use.
Check this box if you do NOT want to use the plugin stylesheet.
This option turns off the plugin stylesheet if checked. You can then manually move the plugin’s CSS to your theme’s CSS file for purposes of avoiding an additional HTTP request or for ease of customization.
A notice is displayed on the screen in red if the stylesheet has been turned off.
Changing the name of the custom post type
You can also change the singular and plural name of the custom post type. It defaults to Communities. For example, if neighborhoods make more sense for you, you can change the singular name to ‘Neighborhood’, plural name to ‘Neighborhoods’ and the slug to ‘neighborhoods’. This makes the plugin versatile as it can be used outside of real estate.
Change the name of the slug
The slug defaults to ‘communities’. You can change it on the settings page. It is added to the URL for each of the communities you set up.
Featured Communities Widget
The plugin includes a widget to feature your communities. Use it in the sidebar or in a custom widget area on the home page. It includes a random sort option, along with sorting by title, date, post id, and menu order. Options to include the page title, the featured image with a choice of sizes, and whether to include any content.
The plugin stylesheet includes styling for the widget on the home page and sidebar.
[clickToTweet tweet=”Add a Communities custom post type to AgentPress Pro with this versatile plugin. #genesiswp” quote=”Add a Communities custom post type to AgentPress Pro with this versatile plugin. “]
Communities Archive Page
Lots of sorting options for this page. Choose them in the Communities -> Settings page. Defaults to sorting by title (ascending A-Z).
This page displays communities in a grid, four across on the desktop and responsive for smaller viewport widths. You can change the number of posts that display per page. It includes sorting by title, date, post ID, and menu order.
The slug controls the URL for the archive page as well.
If you want to add this to your menu, you’ll use a Custom link and insert the URL that is shown below the Save Settings button on the settings page.
New Image Sizes
This plugin adds three new image sizes:
‘awp-featured-community’ – 440px x 300px
‘awp-feature-small’ – 340px x 140px
‘awp-feature-wide’ – 740 x 285
The new image sizes are available to you from the drop-down selector when choosing to insert an image in a post or page, giving you more choices for image sizes.
If you already have images uploaded that you want to use for the custom post type, you will need to regenerate your thumbnail images after activating the plugin.
If you have not uploaded any images to your site that you will be using with the Genesis Communities CPT plugin, you can skip the Regenerate Thumbnail step. Future images you upload will automatically generate the additional image sizes.
Regenerate Thumbnails for Existing Images
You can do that by downloading the free plugin ‘Regenerate Thumbnails’ by Alex Mills (Viper007Bond) in the WordPress.org plugin repository. Here is a link to that plugin:
Install the plugin and activate it. Go to Tools – Regen. Thumbnails. Regenerate all images, or if you prefer you can selectively regenerate the thumbnails in the media library that you will be using with this custom post type. Select the images, then in bulk actions, choose “Regenerate thumbnails”.
Whew! That’s it for this post. If you have questions, comments or suggestions, please let me know. I hope you find this plugin a helpful addition to your Genesis website.
Get the plugin
Want this plugin now? It’s free from the WordPress repository. Genesis Communities CPT plugin.
Note: If you are using the Winning Agent Pro theme, you already have Communities, but you could still use this plugin for creating another post type. Just be sure to change the name and slug to avoid a conflict. One idea might be to showcase amenities like shopping, restaurants, etc. in your area. Something that would span multiple neighborhoods. Get creative!