Ok so I’ve now gone back through a fresh version of the plugin and replaced anything related to “store” or “stores” with “cinema” or “cinemas”. However, while going through the “class-post-types.php” file I spotted it registers a post type using the following code:
// The arguments for the cinema post type.
$args = apply_filters( 'wpsl_post_type_args', array(
'labels' => $labels,
'public' => $public,
'exclude_from_search' => $exclude_from_search,
'show_ui' => true,
'menu_position' => apply_filters( 'wpsl_post_type_menu_position', null ),
'capability_type' => 'store',
'map_meta_cap' => true,
'rewrite' => $rewrite,
'query_var' => 'cinema',
'supports' => array( 'title', 'editor', 'author', 'excerpt', 'revisions', 'thumbnail' ),
'show_in_rest' => $this->maybe_show_in_rest()
)
);
register_post_type( 'cinema', $args );
Note that here, it’s registering my new post type of “cinema”.
Now, I don’t know whether the rewrite is coming from the WP Store Locator Settings, or whether the following code I have in my “apex-post-types.php” file, but the “cinema” slug now redirects to “cinemas” which is what I want (I would guess my code in “apex-post-types.php” is redundant to be honest).
function wp1482371_custom_post_type_args( $args, $post_type ) {
if ( $post_type == "cinema" ) {
$args['rewrite'] = array(
'slug' => 'cinemas'
);
}
return $args;
}
add_filter( 'register_post_type_args', 'wp1482371_custom_post_type_args', 20, 2 );
Now I’m in a situation whereby the “single” pages are working, but I still can’t get an archive or regular page to show, despite calling it “archive-cinema.php” and “page-cinema.php” to match the new post type registered via “class-post-types.php”.
Any thoughts why the main page may not be loading? I just get a 404 when I try to visit /cinemas (which is rewritten from /cinema, remember :))
Would it help to do a site export so you can see for yourself what the issue may be?
I’ve done several Permalink saves and nothing seems to resolve it.
-
This reply was modified 3 years, 3 months ago by shoxt3r.
-
This reply was modified 3 years, 3 months ago by shoxt3r. Reason: Added detail about which version of plugin amended