WordPress.org

Support

Support » Plugins and Hacks » Hacks » how i can show part of the page without GET method ?

how i can show part of the page without GET method ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The Rewrite API does exactly this, takes user friendly urls and rewrites them into usable url parameters.

    Thank bcworkz, I think rewrite is usage for pages with custom template, I cant use this for posts !

    Well the code has to reside somewhere, template, functions.php, or plugin, regardless. If the rewrite output results in an url usable by WP without customization, no special template is required.

    Unless your theme supports partial post segments you will need custom code somewhere, even with just url parameters.

    thank you BcWorkz 🙂 rewrite rules is useful for my problem, but I have some little problem. I have posts in custom post type, I want use a custom query in their post and paginate it, but i cant. this is my sample codes:

    1- in single post type (city-single.php):

    $type = 'city';
      $args=array(
        'post_type' => $type,
        'post_status' => 'publish',
        'paged' => $paged,
        'posts_per_page' => 10,
        'caller_get_posts'=> 1
      );
      $temp = $wp_query;
      $wp_query = null;
      $wp_query = new WP_Query($args);
    ?>
    <?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <?php the_title();?><br />
    <?php endwhile; else : ?>
    <?php endif; ?>
    <?php it_pages($pages = '', $range = 5);?>

    2- In my Functions.php I have this code for rewrite rules and paginate:

    $virtualCityPages = array(
            'photos' => 'Photos',
            'info' => 'Info',
            'maps' => 'Maps',
        );
        add_filter('rewrite_rules_array', 'it_insertrules');
        add_filter('query_vars', 'it_insertqv');
        function it_insertrules($rules)
        {
            global $virtualCityPages;
             $newrules = array();
            foreach ($virtualCityPages as $slug => $title)
            $newrules['city/([^/]+)/' . $slug . '(/page/([0-9]+)?)?/?$'] = 'index.php?city=$matches[1]&vpage=' . $slug.'&pages=$matches[3]';
            return $newrules + $rules;
        }
        function it_insertqv($vars)
        {
            array_push($vars, 'vpage');
            return $vars;

    with this codes I cant paginate the content. 🙁

    There’s no technical reason you shouldn’t be able to paginate. WP_Query supports it, and knows nothing of the rewrite API. There must be a glitch somewhere. Unfortunately, I’ve no idea what it might be from the code you posted.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how i can show part of the page without GET method ?’ is closed to new replies.