Adding the amp url prefix to the beginning
Adding the amp url prefix to the beginning
Adding the amp url prefix to the beginning
Here is the answer. And for future references, Deepak, you need to actually post the solution as an answer. Instead, you posted your answer within your own question and then made a comment about it. Please don’t do that. function analytics_rewrite_add_var( $vars ) { $vars[] = ‘analytic’; return $vars; } add_filter( ‘query_vars’, ‘analytics_rewrite_add_var’ ); function … Read more
Create an attachment template file within the theme. Since we are only interested in images, the file should be image.php <?php if ( have_posts() ) { the_post(); $image_url = wp_get_attachment_url(); } header(‘Location: ‘.$image_url); ?> Template Hierarchy
Adding a rewrite rule with an order part is very easy, if you do it for one site. It would be harder if you want to create a generic solution that works for all installations with all kinds of permalink structures and custom taxonomies. This short example works on a basic install of WordPress 3.1, … Read more
I am not sure why this happens, but you can stop all write access to your .htaccess with a simple filter: add_filter( ‘flush_rewrite_rules_hard’, ‘__return_false’ ); Neither WordPress nor any plugins calling flush_rewrite_rules() will write something into the file now. Other methods to access and change the file will still work, for example insert_with_markers().
First, you need to change your Front Page settings: 1) Create a Static Page, called “Blog” (and a slug of “blog”) 2) Create another Static Page, to serve as your site Front Page 3) Go to Dashboard -> Settings -> Reading 4) Change “Front Page Displays” from “Your latest posts” to “A static Page (select … Read more
You can accomplish this with the following rewrite rule ( you’ll want to add this in your functions.php add_rewrite_rule( ‘author/([0-9]+)/?$’, ‘index.php?author=$matches[1]’, ‘top’ ); Be aware that you might need to flush your rules for it to become active. You can do this with rewrite plugin.
I manually deleted the .htaccess file and regenerated, which along with the code below, made the rewrite work. The second rewrite rule in the code below makes the pagination work properly. The .htaccess file doesn’t seem to be getting written with any rules though, but the rewrite is working now anyhow. function listen_rewrite_action() { add_rewrite_tag(‘%show%’,'([^/]*)’); … Read more
In each of the web.config files for each directory, they will look much like this: <rewrite> <rules> <rule name=”wordpress” stopProcessing=”true”> <match url=”*” /> <conditions> <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” /> <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” /> </conditions> <action type=”Rewrite” url=”index.php” /> </rule> </rules> </rewrite> For each sub-site, you need to change the rule name and add a … Read more
Assuming you are using custom post types for songs, books etc: function add_rewrite_rules($rules) { $newrules[‘author/([^/]+)/songs/?$’] = ‘index.php?post_type=songs&author=$matches[1]’; $newrules[‘author/([^/]+)/songs/page/?([0-9]{1,})/?$’] = ‘index.php?post_type=songs&locations=$matches[1]&paged=$matches[2]’; $rules = $newrules + $rules; return $rules; } function flushRules() { global $wp_rewrite; $wp_rewrite->flush_rules(); } add_filter(‘rewrite_rules_array’, ‘add_rewrite_rules’); /* This function should only really be run once per change of rules – comment out */ add_filter(‘init’,’flushRules’); … Read more