Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //functions.php:
- <?php
- function setup_filter_rewrites()
- {
- add_rewrite_rule('^sok/events/([^/]*)/?', 'index.php?p=1&kategori=$matches[1]', 'top');
- }
- add_action( 'init', 'setup_filter_rewrites' );
- function setup_filter_query_vars( $query_vars )
- {
- $query_vars[] = 'kategori';
- return $query_vars;
- }
- add_filter( 'query_vars', 'setup_filter_query_vars' );
- //index.php:
- <?php
- $my_category = get_query_var('kategori');
- echo $my_category;
- ?>
- <pre>
- <?php print_r($wp_query); ?>
- </pre>
- <?php
- if ( have_posts() ) :
- while ( have_posts() ) : the_post();
- ?>
- <h2><?php the_title(); ?></h2>
- <?php
- the_content();
- endwhile;
- endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement