How To Create Events for Custom Post Types

  1. Home
  2. Knowledge Base
  3. Pixel Cat
  4. Features
  5. How To Create Events for Custom Post Types

This article will show you how to add custom-posts-types to the Pixel Cat event builder.

Before you begin:
This article is helpful for free and premium users. Head here if you are interested in purchasing.

When to Use This

Originally, custom-posts-types (or cpts for short) were left out of the event builder. Many of these ‘posts’ are actually deployed into your standard pages and posts.

For these, it is best to target the pages and posts they’re deployed into. This way you will not create duplicate, or unnecessary events.

However, many cpts are their own page, which you may need to create events for. This is done by creating, and adding, a PHP filter.

Creating Your Filter

The first step is create your PHP filter, that specifies what cpts you want to add. Don’t worry if your not a developer, just modify and use our example:

function my_custom_cpt_pixel_support( $array ) {
return array( 'cpt_slug', 'another_cpt_slug' );
}
add_filter( 'fca_pc_custom_post_support', 'my_custom_cpt_pixel_support' );

You’ll need to change the example slugs, (in red) to the actual slugs for your cpts. These can be found quite easily in your URL, when you go edit said posts.

Deploying Your Filter

Once your filter is ready, you may add it to an appropiate functions.php file. This can be your theme’s, or our plugin’s.

To do this you will need to access your site via FTP, and copy your filter into the bottom of the file.

Remember, this will be overwritten by updates to that software. This why many people use a child-theme, so modifications like this do not get overwritten.

Once added you will be find , and target, your cpts in the event builder.

Tips:

-To learn more about using FTP, and find additional resources, checkout our troubleshooting guide:
WordPress Troubleshooting 101: How To Fix Plugins, Themes & Other WordPress Problems

-To learn more using WordPress filters, head to the WP codex here:
https://developer.wordpress.org/reference/functions/add_filter/

Related Articles