I have the following custom post type
register_post_type('cp_clients', array(
'labels' => array(
'name' => __('Clients'),
'singular_name' => __('Client')
),
'public' => true,
'has_archive' => true,
'supports' => array('thumbnail', 'title', 'editor')
)
);
I want to output custom content when the user calls http://blogurl.com/companies. It’s a plug-in and not a theme.
Any ideas how I can redirect to a custom page/output for this URL?
I don’t think you need a redirect. You are missing the rewrite rule for your custom post type.
You should now be able to create and use single-cp_clients.php, and archive-cp_clients.php template files. And your urls will look like example.com/comapnies and example.com/comapnies/acmecorp
I’m not sure I understand your question.
I’ve used this Redirection plugin successfully before, but it looks like it’s been updated fairly substantially since.
Thank you for your answers. I found a solution to the problem. The solution is to use “template_redirect” and to detect if the page is the post type archive page