Skip to content

Instantly share code, notes, and snippets.

View iamfaisal's full-sized avatar

Faisal Mughal iamfaisal

View GitHub Profile
@iamfaisal
iamfaisal / dki.php
Created August 16, 2018 19:42
dynamic keyword insertion
<?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) {
<?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');
@iamfaisal
iamfaisal / Web.config
Created August 9, 2015 11:38
Web.config for Codeigniter 3.0
<?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" />
@iamfaisal
iamfaisal / Web.config
Created August 9, 2015 11:34
Web.config for Laravel 5.1.4
<?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>