0

I am trying to create a custom post page. I have created a gallery-post.php page inside my theme file and put the following code in it:

<?php
/*
 * Template Name: Gallery Post
 * Template Post Type: post
 */
?>

As soon as I saved the file the option "Gallery Post" appeared on "Post Attributes" section of "Add Post" page. Now when I assign that template to my page I expect the post to appear empty since as you see there is nothing on the page and it is only that 6 lines but the page appears as if the template page doesn't have any effect here.

Actually at first I had some code in it pasted from single.php and when I tried to change parts of it I noticed that nothing changes so for the sake of this question I deleted everything and still as if the Default template is selected.

Am I missing something here? How come the template name appears on the "Add Post" page but this template page does nothing? Not even I add a die(); at the top of the template page.

1
  • Try renaming your template to single-gallery.php
    – disinfor
    Commented Mar 29, 2018 at 15:07

1 Answer 1

0

is the page supposed to display single posts?... then according to the WordPress Codex Docs you will have to rename your file from

gallery-post.php to single-gallery.php

Now if it is just a post-format you will have to register it in your functions.php file and see if that works.

I hope it helps.

Your Answer

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

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