This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode("dki", "dynamic_content"); | |
/** | |
* Usage: [dki key="city" default="London"] | |
* Scenario 1: "city = Manchester" exists in the URL, function returns "Manchester" | |
* Scenario 2: "city" does not appear in the UR, return "London" | |
*/ | |
function dynamic_content($attributes) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// rewrite rules | |
add_action('init', function () { | |
// show all pages under '/p/{pagename}' | |
global $wp_rewrite; | |
$wp_rewrite->page_structure = $wp_rewrite->root . 'p/%pagename%/'; | |
// show all review pages under '/reviews/{pagename}' | |
add_rewrite_tag('%is_review%', '([^&]+)'); | |
add_rewrite_rule('reviews/([^/]*)/?', 'index.php?pagename=$matches[1]&is_review=true', 'top'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Rule" stopProcessing="true"> | |
<match url="^(.*)$" ignoreCase="false" /> | |
<conditions> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> | |
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Imported Rule 1" stopProcessing="true"> | |
<match url="^(.*)/$" ignoreCase="false" /> | |
<conditions> | |
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> | |
</conditions> |