Posted By

jefrancomix on 05/13/13


Tagged

wordpress request uri wp


Versions (?)

Access Request URI in WordPress for template reuse


 / Published in: PHP
 

URL: http://kovshenin.com/2012/current-url-in-wordpress/

Easy way to access request URI to WP in order to not repeat whole templates for minor changes

  1. <?php
  2. switch ($wp->request) {
  3. case 'directory':
  4. get_template_part('content', 'directory');
  5. break;
  6. case 'history':
  7. get_template_part('content', 'history');
  8. break;
  9. default: get_template_part('content', 'default');
  10. };
  11. ?>

Report this snippet  

You need to login to post a comment.