SHARE
TWEET

Untitled

a guest Aug 26th, 2011 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //functions.php:
  2.  
  3. <?php
  4. function setup_filter_rewrites()
  5. {
  6.     add_rewrite_rule('^sok/events/([^/]*)/?', 'index.php?p=1&kategori=$matches[1]', 'top');
  7. }
  8. add_action( 'init', 'setup_filter_rewrites' );  
  9.  
  10. function setup_filter_query_vars( $query_vars )
  11. {
  12.     $query_vars[] = 'kategori';
  13.     return $query_vars;
  14. }
  15. add_filter( 'query_vars', 'setup_filter_query_vars' );
  16.  
  17.  
  18. //index.php:
  19.  
  20. <?php
  21. $my_category = get_query_var('kategori');
  22. echo $my_category;
  23. ?>
  24. <pre>
  25. <?php print_r($wp_query); ?>
  26. </pre>
  27.  
  28. <?php
  29. if ( have_posts() ) :
  30. while ( have_posts() ) : the_post();
  31. ?>
  32. <h2><?php the_title(); ?></h2>
  33. <?php
  34. the_content();
  35. endwhile;
  36. endif; ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top