Mixing pages and categories in menu - permalink problems - wordpress

I have/want the structure:
News
NewsPage | AnotherNewsPage | NewsCategory1 | NewsCategory2
NewsPost1 etc
Permalinks should be /news/newspage (works), /news/newscategory1 (doesn't work / permalink collision), news/newscategory1/newspost1 etc/
I currently have it so that News is a standard page as opposed to the Posts Page.
If this possible? Or do I have to accept that the permalinks for posts will always be different from the page permalinks / not mix pages and posts?

The permalink of the post will always be different - unless you start using custom post types and taxonomies.
You can change the root of the category path in the permalink settings - this will change the path for all posts though.
You could also start messing with rewrite rules but this could break everything else.

Related

Wordpress: Consistent URLs and breadcrumb on post page

I'm working on a magzine page on a WordPress site. I want to get consitent URLs and breadcrumbs (Yoast) for SEO requirements.
I selected the magazin page, which I created under Pages, as the posts page in Settings -> Reading and now got the following URL for the magazine:
www.example.com/magazine/
In Settings -> Permalinks I got the following settings:
Individual structure: /magazine/%category%/%postname%/
and
for Category-Basis I put in magazine
In Yoast I selected to keep the category base.
Now I got the correct post URLs like I wanted:
http://example/magazine/category/this-is-my-post-slug/
But now there is the problem, that all posts are returning a 404 error. Another problem is, that the Yoast breadcrumb is not including the post page. So when I'm on a category it's in my example only Start | Category but should be Start | Magazine | Category
The other way around, when I remove magazine from the individual structure in permalinks, the posts dont have the right URL with /magazine/ in it. Also the breadcrumb doesen't include the "Magazine" page.
I would appreceate any help and hints to fix the issue.
Thanks in advance!

Postname permalinks not working – all pages send to homepage

I have WordPress installed in a subfolder of my domain. I want to keep it there, so that it is accessible only through http://www.example.com/mywordpress.
I have an issue with permalinks. If I use postname permalinks, all my pages (with different templates applied) redirect to the homepage, while my archives (including custom post type archives and singles) are displaying correctly. If I use custom structure permalinks and I prepend anything to the postname – for example /test/%postname%/ – all pages display correctly while custom post type archives and singles display a 404 error.
This happens whenever I refresh permalinks and also after replacing .htaccess with one from a brand new WP install.
The odd thing is also how the permalinks are displaying in the browser url field:
if I use /%postname%/
pages (not working) display as
http://www.example.com/mywordpress/postname – they all display the
homepage contents
CPT archives+singles (working) display as
http://www.example.com/mywordpress/postname
if I use /test/%postname%/
pages (working) display as
http://www.example.com/mywordpress/postname – so without the
prepended text!
CPT archives+singles (not working) display as
http://www.example.com/mywordpress/test/postname – displaying a 404
error
My custom post types have slugs translated to different languages with WPML. I thought that might cause the issue, however I tried to deactivate all plugins included WPML and still no luck.
Does anyone know what might cause that?
I figured it out. I was using reserved terms as custom taxonomy slugs (https://codex.wordpress.org/Reserved_Terms). By changing them to something else everything started working normally again!

Create WordPress posts with links under /blog

My current set-up results in posts being created under the webroot:
www.domain.com/my-post
www.domain.com/my-other-post
How can I make it so posts are created "under" /blog/:
www.domain.com/blog/my-post
www.domain.com/blog/my-other/post
Editing the permalink results in the / needed being turned into a -.
Is there a setting the force posts under a parent?
Use https://wordpress.org/plugins/custom-permalinks/ plugin and just add blog in url before post name,it will work
As at WordPress 5.2.2, in Settings > Permalinks, in the Common Settings section, the option to set a custom structure for permalinks exists for posts.
The default is set to Plain, which results in /?p=123 style posts. Switching to Custom Structure allows the switch from the default of /%postname% to /blog/%postname%.
My existing posts now live under /blog/ along with newly created ones.
As a side note, if the site is already live then redirects might be needed if you have post links out in the wild.

Add Posts page slug to Single Post permalink structure

Does anyone know if it's possible to place WordPress Blog POSTS in a unique directory?
In other words:
mywebsite.com/blog/Post-A/
mywebsite.com/blog/Post-B/
mywebsite.com/blog/Post-C/
I'd like to create /blog/ which I believe is done by creating a PAGE but that doesn't seem possible.
I've googled this for the last few hours and still can't figure it out.
The only way you're probably going to be able to do this without a plugin is by utilizing Categories and a custom permalinks structure.
Navigate to Posts > Categories
Add a new Category
Apply the Category to the desired posts
Navigate to Settings > Permalinks
Select Custom Structure and apply the following structure: /%category%/%postname%/
There are also plugins that expand endpoints and routing. https://wordpress.org/plugins/custom-permalinks/
If your goal is to not have the posts on the front page, you can also set the Blog page to a specific page in Wordpress.
Create two new Pages (not to be confused with a post)
Navigate to Settings > Reading
Set Front page displays to A Static Page
Select the Pages to be displayed for the Front page and the Posts page
The Blogroll (Posts page) will then appear under the endpoint of the defined Page's slug. However, the individual posts permalink will not have the Blogroll Page's slug in the route.

Wordpress 3.4.2 custom permalinks for Posts, Archives, and Categories only

We have a custom WordPress theme running on WordPress 3.4.2 and are running into some problems with our Permalink settings and a particular calendar plugin we're using on our website. Our website is somewhat non-traditional in the sense that all of our Posts are located within a section of the website called /news-events/ (e.g. www.domain.com/news-events/).
Currently, we are using the following custom permalink structure: /news-events/%year%/%monthnum%/%postname%/ to match the location of our Posts. We have created about 30 websites from this template using this permalink format without any issues.
However, the calendar plugin (The Events Calendar Pro 2.0.10) we're using on this particular site requires the Permalink structure to be /%postname%/. When the permalink structure is set to anything other than /%postname%/, any calendar events pages return 404 pages. Unfortunately, setting our Permalink structure to /%postname%/ is not a viable option for us as it's imperative for us to keep the /news-events/%year%/%monthnum%/%postname%/.
The Question:
Is it possible to set the overall WordPress Permalinks to /%postname%/ while customizing the Permalink structure for Posts, Archives, and Categories to /news-events/%year%/%monthnum%/%postname%/? Put another way: how can we change the Permalink structure to /news-events/%year%/%monthnum%/%postname%/ ONLY when a Post, Category, or Archive is being viewed?
The following pages provided some useful information, however, it seems we'd need to do the opposite of what's described:
http://shibashake.com/wordpress-theme/custom-post-type-permalinks
http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-2
Any and all help is greatly appreciated.
Can you set the permalink structure to %postname%/news-events/%year%/%monthnum% ?
It may possible allow the plugin to grab the first part of the request (Being postname)

Resources