How to embed a string in permalink structure ? - wordpress

I am creating a custom tours and travel theme in which I have created custom post type Cities, Locations, Destinations and i am using custom permalink structure. /%category%/%postname%/
So now I want to append a state name or district name before that city, destination or location name. Let me make it more clear by giving you an example .
the current url structure is like this
and how I want it to be
In the beginning i created a custom taxonomy but some time's city, destination and location slug clashes with custom taxonomy slugs and right now I am working with rewrite rules so is it possible by creating a new rewrite rules or do I have to do something else.

I'm not a Wordpress specialist, but maybe this wordpress oriented stackexchange site would be of more assistance: How to create Custom URL Routes in Wordpress
Hope this helps !

Related

Custom taxonomy rewrite rule

Hello i want to change the default WordPress categories url i tried but i don't know how to do it
can you guys please help me with that..
This is my admin URL of default post category here post type=post
/wp-admin/edit-tags.php?taxonomy=category
example of my categories list
cloths, shirt, goggles etc...
suppose current my fronted link for taxonomy url is like
example.com/shirt
example.com/cloths
example.com/goggles
but i want to modify it... like below
example.com/ethic/shirt
example.com/ethic/cloths
example.com/ethic/goggles
And post Url must be followed same as below
example.com/res-full-shirt
example.com/blackfull-goggles
I think, these permalink settings will do the job.

Wordpress CPT (Custom Post Type) and URLS

I am trying to develop a travel website where I have the following types of content:
Destinations (pj: Alicante)
Pages (ex: General information)
Places (ex: Beach of Sant Jhon)
Posts (ex: Tips for travel to alicante)
How could I get the following urls structure?
www.miweb.com/alicante (CPT Destinations)
www.miweb.com/alicante/general-information (CPT pages with relationship with the destination)
www.miweb.com/alicante/general-information/guide (CPT pages with relationship with the destination hierarchical)
www.miweb.com/alicante/beach-of-sant-jhon (CPT places with relationship with the destination)
www.miweb.com/alicante/tips-for-travel-to-alicante (CPT Posts)
Is it possible to make this urls structure? Can you help me?
Thanks in advance.
You don't need to use custom post types to achieve this, you can use the parent page feature so that pages have a parent-child in the permalink structure like so:
yoursite.com/parent-page/child-page
You can also setup categories to work this way for posts and set the permalink structure for posts so that the category appears first:
yoursite.com/category/post
In this way you can avoid CPT's which are more complicated to use than the core post types.
This will only affect the front end so if you need a backend or admin setup you may still need a CPT, however you could get away with simply re-naming 'posts' or 'categories' to 'destinations'.

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

Rewrite rule parameter htaccess from custom CMS to Wordpress

I am moving a website from a custom CMS to wordpress and have an issue with some custom rewrite URL that I need to match for SEO purpose.
Original url looks something like this
/search?Filter=filter1,filtervalue1&Filter=filter1,filtervalue2
filter1 correspond to a WP Taxonomy
filtervalue x correspond to the taxonomy term to search for.
In this original URL, mulitple can be added, so the URL can expand indefinitely, like Filter=filter1,filtervalue1&Filter=filter1,filtervalue2&Filter=filter4,filtervalue6&Filter=filter8,filtervalue25 etc etc
I need to find a way of Rewriting the url to match the taxonomies in Wordpress, so in some way extract each value of Filter= and then the taxonomies
something like
/search?filter1=filtervalue1+filtervalue2&filter4=filtervalue6 etc etc
I can't get my head around it and will appreciate some help
thanks in advance

WordPress Page URL rewrite Issue

I need to rewrite wordpress URL.
Currently My URL is : http://www.example.com/about/?pagekey=team1
and I need like ; http://www.example.com/about/team1
Here About is one page template and I've setup for wordpress custom parameter so, when you pass pagekey to this page it will take key and based on that display result.
Now, I need to show user friendly, can anybody have idea how to do this.
currently my parmalink is set to "PostName".
Thanks.
You should follow the WordPress codex here and create 2 files:
page-about.php
single-about.php (this one will be for the teams)
you should create CPT (custom post type) with all the custom post type fields you need for this eg.
Name,
Title,
Position,
Image,
Tag,
Taxonomy,
.... etc
then you will pass the custom post type query (the query) before the loop and you will be able to access the single-about.php from page-about.php
that'all.
Cheers and hope this helps

Resources