Custom Post Types

Custom Post Types

Enable Instant Articles for a custom post type

Version 1.3.0 introduced the wpna_allowed_post_types function. This sets the default post types for the entire plugin and has the filter wpna_allowed_post_types. Use this filter to add or remove post types that are converted.

Version  1.3.4 Adding post types using the wpna_allowed_post_types filter will enable the post meta box for the post edit screen for that custom post type.

Example code for adding a custom post type called movies:

          /**
           * Enable Instant Articles for a custom post type.
           * 
           * @param array $post_types Post types to enable Instant Article for.
           * @return array Post types to enable Instant Article for.
           */
          function wpna_custom_add_post_types( $post_types ) {
            $post_types[] = 'movies';
            return $post_types;
          }
          add_filter( 'wpna_allowed_post_types', 'wpna_custom_add_post_types', 10, 1 );
          

Adding a custom post type to your RSS feed

If you're NOT using the filter above, RSS Feeds can also be generated for custom post types by passing in Url parameters.

To generate a feed for posts from a single post type:

            https://wordpress.dev/feed/facebook-instant-articles?post_type[]=movies
          

To generate a feed for posts from multiple post types combined:

          https://wordpress.dev/feed/facebook-instant-articles?post_type[]=movies&post_type[]=books
          

n.b This will only work from WP Native Articles version 1.2.0 or higher.