Dynamic URL generates dynamic content

I would actually tackle it with the .htaccess file, using RewriteCond and RewriteRule, something like: RewriteCond %{REQUEST_URI} ^/advice-on-(\[a-zA-z])$ RewriteRule ^/?(.*) http://domain.com/customadvice?advice=$1 [L] Note that the Regex in the parenthesis will be reused as $1 in the RewriteRule. You should then have a WordPress page on /customadvice and use the $_GET attribute from the page template … Read more

How to Include the Parent and Child Category in the Permalink if the Post is Added to Both

There are a few answers, scattered around this forum. To summarise: Configure your Permalinks: Head to Dashboard > Settings > Permalinks Scroll down to ‘Product Permalinks’ and select ‘Custom Base’. Enter /%category%/ into the text field and then select ‘Save’. Assign Product Categories: If your products are still not showing the Child Categories, within the … Read more

How to attach region identifier to a pretty url?

Referencing this question I was able to resolve this issue: Need help with add_rewrite_rule To briefly display the changes I made here it goes, in my theme functions.php I added the following action: add_action(‘init’,’custom_rewrite_rule’); function custom_rewrite_rule(){ add_rewrite_rule(‘^student/([^/]*)/’,’index.php?pagename=student&country=$matches[1]’,’top’); } This above allows for my urls to be the pretty form of: {{site_url}}/student/ca/ {{site_url}}/student/us/ However this form … Read more

How do I amend the fixed “author” part in the URL?

Use the plugin Edit Author Slug: This plugin allows an Admin to change the author slug (a.k.a. – nicename), without having to actually enter the database. You can also change the Author Base (the ‘/author/’ portion of the author URLs). Two new fields will be added to your Dashboard. The “Edit Author Slug” field can … Read more

Creating multiple page URL without creating the pages in WordPress

This is a simple outline so don’t use this in production but it’s a working example. Define your template and place it in templates/template-portfolio-template.php inside your theme. <?php /* * Template Name: Portfolio Template * Description: Page template to display portfolio custom post types */ echo ‘This is the Portfolio Template!’; Next, you’ll need to … Read more

flexible rewrite ‘ramble’ URLs with WordPress

You shouldn’t use the htaccess instead you should use the WordPress APIs e.g. function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘archives/(\d+)(?:/.*)+’ => ‘index.php?p=’. $wp_rewrite->preg_index(1) ); // ( array merge must be done this way, to ensure new rule comes first ) $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if … Read more

Change the url of Projects in Divi Theme

For the taxonomies (like category or any other custom taxonomies, registered for the custom post type, using register_taxonomy function ), to be part of single post permalinks in wordpress, you may use the following code in your functions.php of the current theme: function my_post_type_link( $post_link, $post ){ if( !empty( $post->post_type ) && in_array( $post->post_type, array( … Read more