Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

category links not working #12

Open
jnz31 opened this issue Dec 6, 2019 · 1 comment
Open

category links not working #12

jnz31 opened this issue Dec 6, 2019 · 1 comment

Comments

@jnz31
Copy link
Contributor

jnz31 commented Dec 6, 2019

hi

i work on a fresh wordpress install in combination with angularxo plugin (1.1.1) and angular xo theme (0.1.4). i got the urls working, permalink-structure is /blog/%postname% and that works fine. however, the categories do not. i have one category and there is a post inside, but it redirects to the 404 page. the url is /blog/category/some-category and my routes look like so
{"routes":[{"path":"xo-page-preview-3","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":{"postId":3}},{"path":"xo-post-preview","loadChildren":".\/pages\/posts\/posts.module#XoMaterialPostsPageModule","pathMatch":"prefix","data":{"postPreview":true}},{"path":"xo-attachment-preview","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"prefix","data":{"postPreview":true}},{"path":"xo-blog-preview","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"prefix","data":{"postPreview":true}},{"path":"agb","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"datenschutz","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"impressum","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"kontakt","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"leitung","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"seminare","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"institut","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"blog","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":false},{"path":"blog\/hallo-welt","loadChildren":".\/pages\/posts\/posts.module#XoMaterialPostsPageModule","pathMatch":"full","data":false},{"path":"blog","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"prefix","data":{"postType":"blog"}},{"path":"**","loadChildren":".\/pages\/default\/default.module#XoMaterialDefaultPageModule","pathMatch":"full","data":{"url":"\/error-404"}}],"success":true,"message":"Successfully retrieved routes."}

i dont see any category routes in there. i resaved the permalinks and i rebuilt the template cache, but it didn't help. any clue on this?

now that i looked a little bit around i see that you register a cpt blog and i think that my settings may clash. but i changed the structure to /blogz/%postname% but the result is the same.
i know for a fact, that you should register your custom taxonomies before you register custom post types (if they belong together), but i dont think that that is the issue here, since angular takes over the routing.
but why do you register that cpt in the first place? just for testing/showing, that this works?

btw. you should change the rewrite parameters of register_post_type call to
'rewrite' => array( 'slug' => 'blog/%blog_category%', 'with_front' => false, )

so the custom base will not get added to your slug. before that i had a 404 since the url was /blogz/blog/post-name, with my setting it works fine (tested).

and i was wondering about the fact, that you disable gutenberg on blog posts. can you tell me, why you do that? just wanted to know, why you do that. and how would you disable that behaviour?

thanks

@jnz31
Copy link
Contributor Author

jnz31 commented Dec 6, 2019

btw. same rewrite rule should be applied to the custom taxonomy:
'rewrite' => array( 'slug' => 'blog', 'with_front' => false ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant