0

I've created a template that shows all my blog posts. But the issue was that this page slug (tips-and-tricks) wasn't added to the URL of the single post.

Solution: I've selected this page as my blog page under Settings > Read. Now my url is https://domain.com/tips-and-tricks/post-name.

Issue: When I select the page as my blog page, the custom template isn't used anymore. Wordpress uses the index.php file.

How can I use my custom template for this page?

1 Answer 1

1

When you select a page as your blog page, the template that WordPress is looking for is the home.php file.

You should really check out the Template Hierarchy from the WordPress documentation as these things are really WordPress basic knowledge. Check out the Template Hierarchy here: https://developer.wordpress.org/themes/basics/template-hierarchy/

2
  • I did some changes: I've created a home.php file. In that file there's a category loop which shows all the posts in that specific category. That seems to work, except the URL of the single blog post isn't prefixed with the slug of the home.php page.
    – Dennis
    Apr 14 at 7:48
  • You can change the URL prefix of single blog pages via Settings > Permalinks.
    – DeltaG
    Apr 14 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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