Quantcast
Channel: responsive – WordPress.org Forums
Viewing all articles
Browse latest Browse all 16569

Piotr on "Mobile version"

$
0
0

Welcome. I wanted to create a mobile version of my template, but not a responsive. My idea was to just add a 'mobile' prefix before each link (permalink, page, author, category).

How can I add this prefix to each link?

My first function was failed, becouse I changed all link on whole site, not onlu mobile version:

function mobile_rewrite_permalinks() {
				global $wp_rewrite;
				add_rewrite_rule('^mobile','index.php','top');
				$wp_rewrite->authorbase = 'mobile/author';
				$wp_rewrite->category_base  = 'mobile/category';
				$wp_rewrite->search_base = 'mobile/search';
				$wp_rewrite->pagination_base = 'mobile/page';
				$wp_rewrite->feed_base = 'mobile/feed';
				$wp_rewrite->comments_base = 'mobile/comments';
				$wp_rewrite->page_structure = 'mobile/%pagename%';
				$wp_rewrite->date_structure = 'mobile/%year%/%monthnum%/%day%';
				$wp_rewrite->permalink_structure = 'mobile/%postname%';
				$wp_rewrite->root = 'mobile/';
				$wp_rewrite->flush_rules();
			}
			add_action('init','mobile_rewrite_permalinks');

Viewing all articles
Browse latest Browse all 16569

Trending Articles