New Post Type page not working. How to troubleshooting

So I created a post type called Locations, the slug is just locations so in theory if you do sitename.com/locations it should just take you to the locations page which would be whatever is on page-locations.blade.php

this is what it is inside (page-locations.blade.php ):

@extends('layouts.app')

@section('content')

<h2>Hey whats up i am page-locations.blade.php</h2>

@endsection

For some reason the single-locations.blade.php does work but page-locations.blade.php doesn’t any ideas on how to troubleshoot this.
I am using this plugin to creat post types Custom Post Type UI 1.7.2… I did check the slug and it is locations

From your description this is behaving as intended. If the slug for your custom post type is locations then posts in that post type will match single-locations.blade.php. They won’t match page-locations.blade.php because they are not pages. The slugs of individual posts in your custom post type are not locations, they’re…whatever their slugs are. Several posts can’t share the same slug. The Template Hierarchy article in the dev handbook should explain some of this: https://developer.wordpress.org/themes/basics/template-hierarchy/

1 Like

Ok, but how come I have another custom post type called Services where the file single-services.blade.php is where the single Service post is, (sitename.com/services/service1/) then I made a page-services.blade.php that loads when you type (sitename.com/services/) and it just loops through all the services. Thats basically what I am trying to do, is to come up with sitename/locations/ so when you type that on your browser it loads the content from page-locations.blade.php just like it does with the Services Post type.

Oops nevermind, so apperantly i forgot that you have to actually create a page on Pages that has the url sitename.com/locations/ so you can then have page-locations.blade.php load the the information on it… duuuuh. At leas i hope this helps someone else. Thank you for your help

This topic was automatically closed after 42 days. New replies are no longer allowed.