Change permalink if a specific Gutenberg block is being used - permalinks

I have changed all the posts from custom post type to a regular type and the permalinks do not include the type name anymore (from '.../recipe/postname' -> '.../postname'). I am wondering if I can change the permalink back to '...recipe/postname' only for posts that use a specific recipe block.

Related

How can i remove custom post type slug and add taxonomy

My question is about custom post rewrite url
On may page i have custom post type products
I have custom post type slug name - products and taxonomy - category.
I have urls like this:
domain.com/custom_post_type/product_name
but i need
domain.com/taxonomy/product_name
Is this acheivable?
To change the URL in wordpress go to settings -> permalinks
You can either choose a default permalink or create your own in this case.
https://codex.wordpress.org/Settings_Permalinks_Screen

How to do Wordpress Custom Post multiple rewrite?

how to rewrite below custom post in Wordpress
Live
http://example.org/custompost/post-title
Need as
http://example.org/category/subcategory/custompost-title
You need to update permalink from wp-admin/options-permalink.php here
Select "Custom Structure" and add this pattern after site URL /%category%/%postname%/.
Now create category and subcategory for post types and assign child category to specific post like (if I have a test(parent) and test2(child) and create test post type then I will select child category (test2) only).
Now you can able to see your pattern in post URL like http://example.org/category/subcategory/custompost-title

generate custom permalink based on a custom field - Wordpress

I'm a newbie to the Wordpress.
So far I have a custom post type called 'property'. This post type has one custom field called 'property_city'.
In WP-admin - permalink setting, I have selected Post name option. So, posts of this custom post type have URLs like:
http://xxx.local/properties/edge-apartments/
http://xxx.local/properties/northgate-point/
What I want to have those URL to be generated using the city of the property and also I want to change properties prefix with student-properties like that:
http://xxx.local/student-properties/Manchester/edge-apartments/
http://xxx.local/student-properties/Chester/northgate-point/
I have tried various plugin and various code, but none of them worked as expected.
Any help would be appreciated.
Thanks,
try Permalink manager plugin it works for me here is the link : https://wordpress.org/plugins/permalink-manager/

Wordpress getting template for post category type to work

Hiall,
In my wordpress site I have a Category called “meetings”, and it’s slug is “meeting”, also its ID is 27.
I create a default post article and then select “Meeting” from the categories panel and then publish etc.
Reading here
http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display
If I create a template file called category-meetings.php or category-27.php then it should pick those files up and use them for a template layout for my selected Meeting category posts etc???
But for whatever reason I can not get it to do this.
I have also tried changing the permalinks settings from “post name” to custom structre with /%category%/%postname%/
but again no luck.
Am I missing something here?
Any help would be great!
I think you're trying to target a single post, whereas your template is targeting the category archive pages. For example, look at this diagram of the template hierarchy.
You could:
1) Create that post as a page and then create a template just for that page.
2) Create a custom post type and create a custom template for that custom post type.
The naming has to match your slug. I would change
category-meetings.php
to
category-meeting.php
And make sure the category-customname.php files are in the same directory as the default category.php file.
Addition/Revision
For a custom page for a single post -- find the post number, let's say 999, then create a single page with the past number appended to the file name in the same directory where the single.php file exists. This worked up to WP ver 3.2-ish. Unless it's been deprecated, it should still work.
single-999.php

Wordpress custom post permalink structure inside custom post permalink

I have custom post structure like this:
mysite.com/custompostname/customposttitle
and i need to have one more custom post type that have depedency with myfirst custom post type so my permalink would be:
mysite.com/custompostname/customposttitle1/custompostname2/custompost2title1
mysite.com/custompostname/customposttitle1/custompostname2/custompost2title2
mysite.com/custompostname/customposttitle2/custompostname2/custompost2title3
mysite.com/custompostname/customposttitle2/custompostname2/custompost2title4
etc..
I to have news section for my custom posts in permalink, for example:
mysite.com/companies/company1/news/news1
Is there way to achieve this?
You can customise the permalink for a custom post type, but it needs to be hardcoded in the rewrite parameter given to register_post_type. You could use categories to achieve the same thing though: set up a taxonomy for the first custom post type and then use the posts to create a custom taxonomy for the second CPT (i.e. the posts from the first CPT would become the categories for the second).
So you would add something like this pseudo-code to the edit page for the second CPT:
get all posts of type 'CPT1'
loop through them to create a list of checkboxes
display in a metabox
save the result
There are still hoops to be jumped through to get those URLs going to the right place, but it's a start.

Resources