Closed kevinkiel closed 8 years ago
Pull request https://github.com/themosis/framework/pull/343 fixes this
Before looking after the PR, are your custom post types public and have you set a custom public query var name? I find this strange to not work as we have 2 production projects with multiple custom post types and the routing is working as expected.
The custom post types are almost default:
And there is no custom logic added.
` 'actie' => [ 'plural_name' => "Acties", 'singular_name' => "Actie", 'supports' => ['title', 'editor', 'thumbnail'], 'menu_icon' => 'dashicons-awards', ],
'locatie' => [
'plural_name' => "Locaties",
'singular_name' => "Locatie",
'supports' => ['title', 'editor', 'thumbnail'],
'menu_icon' => 'dashicons-location-alt',
]
`
The default arguments for the custom post type do not set it as public. Can you add the public argument and set it to true
and let us know what's going on?
@jlambe Is makes unfortunately no difference. Still the same issue :(
Can you post your full code regarding the registration of your custom post types and the routes for reference so we can test this?
Constants.config.php:
'PAGE_POST_TYPE' => 'page', 'ACTIE_POST_TYPE' => 'actie', 'LOCATION_POST_TYPE' => 'location',
Post-types.config.php: ` return [
ACTIE_POST_TYPE => [
'plural_name' => "Acties",
'public' => true,
'singular_name' => "Actie",
'supports' => ['title', 'editor', 'thumbnail'],
'menu_icon' => 'dashicons-awards',
],
LOCATION_POST_TYPE => [
'plural_name' => "Locaties",
'public' => true,
'singular_name' => "Locatie",
'supports' => ['title', 'editor', 'thumbnail'],
'menu_icon' => 'dashicons-location-alt',
]
]; `
Routes.php: ` Route::get('cms', function () { // Check if you're logged in if (is_user_logged_in()) { // If so go to the wp dashboard return header('Location: /cms/wp-admin'); } // Otherwise go to the login form return header('Location: /cms/wp-login.php'); });
Route::group(['namespace' => 'App\Controllers'], function() {
/**
* Route for the default page
*/
Route::get('front', 'PageController@front');
/**
* Posttype: Acties
*/
Route::get('singular', [ACTIE_POST_TYPE, 'uses' => 'ActieController@singular']);
Route::get('postTypeArchive', [ACTIE_POST_TYPE, 'uses' => 'ActieController@archive']);
/**
* Posttype: Location
*/
Route::get('singular', [LOCATION_POST_TYPE, 'uses' => 'LocationController@singular']);
/**
* Route for the default singular page
*/
Route::any('singular', 'PageController@singular');
/**
* Route for the slide page template page
*/
Route::get('search', 'PostController@search');
/**
* Route for the default archive page
*/
Route::get('archive', 'ExampleController@archive');
/**
* Route for the 404 not found page
*/
Route::get('404', 'PageController@notFound');
}); `
@jlambe The PR from dstollie fixes my problems.
Cool, it's good to know, will test it all.
@kevinkiel I've updated the routing and fix an omit from @dstollie PR. Can you update to latest dev-master commit and let us know if everything works as expected? Thanks
@kevinkiel Can you pull the latest version of the framework as well as checking that you have version 5.3 of illuminate packages on your project and let me know if everything works correctly?
@jlambe When I do composer update I'm getting 404 error's for every routing. (It's not working with illuminate 5.3)
@kevinkiel Can you share your project so I can clone it and test it?
This issue can be closed. Ive talked with kevinkiel and he told me it was fixed.
👍 Cool thanks
I'm currently using "themosis/framework": "dev-master" When I'm trying to access my custom post type route it skips all singular routes except the last one.
Do i do something wrong?
This is my routing file: ` /* * Posttype: Acties / Route::get('singular', [ACTIE_POST_TYPE, 'uses' => 'ActieController@singular']); Route::get('postTypeArchive', [ACTIE_POST_TYPE, 'uses' => 'ActieController@archive']);
`