0

I've registered two custom post types. Now I've created a template for the post but it's not being called by WP.

Registering the post types in functions.php:

function create_post_types() {
    register_post_type('behandelingen', array(
      'labels' => array(
        'name' => 'Behandelingen',
        'all_items' => 'All Posts'
      ),
      'public' => true
    ));

    register_post_type('medewerkers', array(
      'labels' => array(
        'name' => 'Medewerkers',
        'all_items' => 'All Posts'
      ),
      'public' => true
    ));
}
add_action('init', 'create_post_types');

The custom post sections come through in the WP backend and I've added posts to this which seems to be working fine.

Next I've added a custom post template ("post-medewerkers.php"):

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
Test
</body>
</html>

When I go to the permalink of the custom page it doesn't show "Test" but it shows the content from index.php.

Where did I go wrong? Why isn't the custom template registering?

Thanks!

1 Answer 1

0

The problem was that I didn't have a single.php file. When I added this and then added the single-medewerkers.php file it works perfectly. Thanks anyway!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.