How to show custom post for new single post template

Hi Experts,

Can anyone show me how to display a custom post for single post template?
Ảnh chụp Màn hình 2021-12-01 lúc 21.04.58

Thanks for your help!
Best regards,

Hi @raywade90,
To make a custom single post template

  1. Create a new page
  2. In the page setting modal chose to export as single.php or some more complex variation from the dropdown.
  3. In the export options section check the "Use as post/page template
    4)give your template a name
  4. define the post types
    Once you export there will be a template selection dropdown with your new template added.
    Cheers,
    Bob
1 Like

Hi RobM

Thanks you, but I want to show abc2 Post for new template.
It’s mean:

  • Default post for single Post: It’s Oke

Abc2 post for new single post(new template for abc2 post)-> when user click post of abc2 post → it’ll show single post(template) of acb2

Thanks and Regards.

Hi @raywade90,
Okay, gotcha. So this will require an extra step or two.
So you want to create your post template as above. Best practice would be to give it an export name of “single-abc_2.php”.
So the page settings for your post template would be:

You can change out the heading/footer if you want by checking the Master page checkbox.
Next, on your main page, register the post type. I put my action on the body tag.


Again, there are a number of options that you could change up.
Once you export you may need to re-save your permalinks to get the new CPT to appear. In the template dropdown it will show “default template” and “ABC2 template”, but the default template will be the template that you defined, no need to change.
If you need more help, let me know,
Bob

2 Likes

:grinning: Thanks and Best regards