/ Published in: PHP

Easy way to access request URI to WP in order to not repeat whole templates for minor changes
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php switch ($wp->request) { case 'directory': get_template_part('content', 'directory'); break; case 'history': get_template_part('content', 'history'); break; default: get_template_part('content', 'default'); }; ?>
URL: http://kovshenin.com/2012/current-url-in-wordpress/
Comments
