WordPress Page-navi "Not Found"
-
Hi i have a big problem with page navi, when i click on the page number 2 or 3 or others it comes out “Not Found”.
So i dont know where is the problem i can send my index.php
<?php get_header(); ?> <div id="content"> <?php $postct = get_option('dion_postnum'); $args=array('post_type' => 'videos','post_status'=> 'publish','posts_per_page' =>$postct,'caller_get_posts' =>1,'paged' =>$paged,); query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="box rounded <?php if (++$counter % 4 == 0) { echo "lastbox"; }?>" id="post-<?php the_ID(); ?>"> <div class="postcover"> <?php $trailer = get_post_meta($post->ID, 'trailer_value', $single = true) ?> <?php $poster = get_post_meta($post->ID, 'poster_value', $single = true) ?> <a href="<?php echo $trailer; ?>" rel="prettyPhoto" ><img class="poster" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $poster; ?>&h=270&w=200&zc=1" alt=""/></a> </div> <div class="boxtitle"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> </div> </div> <?php endwhile; ?> <div class="clear"></div> <div id="navigation"> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?> </div> <?php wp_reset_query();?> <?php else : ?> <div class="title"><h2>Oops.. Nothing Found !</h2></div> <div class="cover"> <p>I think what you are looking for is not here or it has been moved. Please try a different search..</p> </div> <?php endif; ?> </div> <?php get_footer(); ?>So i really hope somebody can help me for this problem thanks a lot.
-
If this is on the front page (index.php) you can try it without the query_posts:
http://codex.ww.wp.xz.cn/Pagination#Removing_query_posts_from_the_main_loop<?php get_header(); ?> <div id="content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="box rounded <?php if (++$counter % 4 == 0) { echo "lastbox"; }?>" id="post-<?php the_ID(); ?>"> <div class="postcover"> <?php $trailer = get_post_meta($post->ID, 'trailer_value', $single = true) ?> <?php $poster = get_post_meta($post->ID, 'poster_value', $single = true) ?> <a href="<?php echo $trailer; ?>" rel="prettyPhoto" ><img class="poster" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $poster; ?>&h=270&w=200&zc=1" alt=""/></a> </div> <div class="boxtitle"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> </div> </div> <?php endwhile; ?> <div class="clear"></div> <div id="navigation"> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?> </div> <?php wp_reset_query();?> <?php else : ?> <div class="title"><h2>Oops.. Nothing Found !</h2></div> <div class="cover"> <p>I think what you are looking for is not here or it has been moved. Please try a different search..</p> </div> <?php endif; ?> </div> <?php get_footer(); ?>and with this in your theme’s functions.php:
function my_post_queries( $query ) { // not an admin page and is the main query if (!is_admin() && $query->is_main_query()){ if(is_home()){ $query->set('post_type', 'videos'); $query->set('posts_per_page', get_option('dion_postnum')); } } } add_action( 'pre_get_posts', 'my_post_queries' );Thanks but it didn’t work i took your edited index and i added the function code but nothing it doesn’t show even the first page now.
i add the function original if helps:
<?php include 'theme_options.php'; include 'guide.php'; if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Sidebar', 'before_widget' => '<div class="sidebox rounded">', 'after_widget' => '</div>', 'before_title' => '<h3 class="sidetitl">', 'after_title' => '</h3>', )); register_nav_menus( array( 'primary' => __( 'Primary Navigation', '' ), ) ); function post_type_videos() { register_post_type( 'videos', array( 'public' => true, 'publicly_queryable' => true, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/video.png', 'labels'=>array( 'name' => _x('Videos', 'post type general name'), 'singular_name' => _x('Video', 'post type singular name'), 'add_new' => _x('Add New', 'video'), 'add_new_item' => __('Add New video'), 'edit_item' => __('Edit video'), 'new_item' => __('New video'), 'view_item' => __('View video'), 'search_items' => __('Search video'), 'not_found' => __('No videos found'), 'not_found_in_trash' => __('No videos found in Trash'), 'parent_item_colon' => '' ), 'show_ui' => true, 'menu_position'=>5, 'supports' => array( 'title', 'editor', 'author', 'post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') ) ); } add_action('init', 'post_type_videos'); function my_query_for_homepage( $query ) { if( $query->is_main_query() && $query->is_home() ) { $query->set( 'post_type', array( 'movies' ) ); } } add_action( 'pre_get_posts', 'my_query_for_homepage' ); function create_genre_taxonomy() { $labels = array( 'name' => _x( 'Genre', 'taxonomy general name' ), 'singular_name' => _x( 'genre', 'taxonomy singular name' ), 'search_items' => __( 'Search genre' ), 'all_items' => __( 'All Genre' ), 'parent_item' => __( 'Parent Genre' ), 'parent_item_colon' => __( 'Parent Genre:' ), 'edit_item' => __( 'Edit Genre' ), 'update_item' => __( 'Update Genre' ), 'add_new_item' => __( 'Add New Genre' ), 'new_item_name' => __( 'New Genre Name' ), ); register_taxonomy('genre',array('videos'), array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'genre' ), )); } add_action( 'init', 'create_genre_taxonomy', 0 ); $new_meta_boxes = array( "trailer" => array( "name" => "trailer", "std" => "", "title" => "Trailer video", "description" => " <p>Enter the video url</p> " ), "poster" => array( "name" => "poster", "std" => "", "title" => "Movie poster", "description" => " <p> Movie poster image</p> " ), ); function new_meta_boxes() { global $post, $new_meta_boxes; foreach($new_meta_boxes as $meta_box) { $meta_box_value = get_post_meta($post->ID, $meta_box['name'].'_value', true); if($meta_box_value == "") $meta_box_value = $meta_box['std']; echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />'; echo'<h2 style=" margin:0px; padding:0px 3px; font-style:normal; font-family:Tahoma; font-size:13px;font-weight:bold;">'.$meta_box['title'].'</h2>'; echo'<input type="text" name="'.$meta_box['name'].'_value" value="'.$meta_box_value.'" size="95" /><br />'; echo'<p><label for="'.$meta_box['name'].'_value">'.$meta_box['description'].'</label></p>'; } } function create_meta_box() { global $theme_name; if ( function_exists('add_meta_box') ) { add_meta_box( 'new-meta-boxes', 'Trailer data', 'new_meta_boxes', 'videos', 'normal', 'high' ); } } function save_postdata( $post_id ) { global $post, $new_meta_boxes; foreach($new_meta_boxes as $meta_box) { // Verify if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) { return $post_id; } if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) return $post_id; } else { if ( !current_user_can( 'edit_post', $post_id )) return $post_id; } $data = $_POST[$meta_box['name'].'_value']; if(get_post_meta($post_id, $meta_box['name'].'_value') == "") add_post_meta($post_id, $meta_box['name'].'_value', $data, true); elseif($data != get_post_meta($post_id, $meta_box['name'].'_value', true)) update_post_meta($post_id, $meta_box['name'].'_value', $data); elseif($data == "") delete_post_meta($post_id, $meta_box['name'].'_value', get_post_meta($post_id, $meta_box['name'].'_value', true)); } } add_action('admin_menu', 'create_meta_box'); add_action('save_post', 'save_postdata');http://www.onstreaming.net is the website that currently not working if you try to change page you can test it in live.
Hope you can help me out with this
it doesn’t show even the first page now.
Did it show movie posts or no posts at all? Or was there no pagination?
there was no pagination =( something like “ooooops i cant find the page”
i really dont know what to do
The topic ‘WordPress Page-navi "Not Found"’ is closed to new replies.