I am trying to display pagination from archive.php with my custom post type news but when I click to Next page I am getting 404 page  My Custom Post Type Code:  function codex_custom_init() {   $labels = array(     'name'               =&gt; 'News',     'singular_name'      =&gt; 'News',     'add_new'            =&gt; 'Add News',     'add_new_item'       =&gt; 'Add New News',     'edit_item'          =&gt; 'Edit News',     'new_item'           =&gt; 'New News',     'all_items'          =&gt; 'All News',     'view_item'          =&gt; 'View News',     'search_items'       =&gt; 'Search News',     'not_found'          =&gt; 'No news found',     'not_found_in_trash' =&gt; 'No news found in Trash',     'parent_item_colon'  =&gt; '',     'menu_name'          =&gt; '1. News'   );    $args = array(     'labels'             =&gt; $labels,     'public'             =&gt; true,     'publicly_queryable' =&gt; true,     'show_ui'            =&gt; true,     'show_in_menu'       =&gt; true,     'query_var'          =&gt; true,     'rewrite'            =&gt; array( 'slug' =&gt; 'news' ),     'capability_type'    =&gt; 'post',     'has_archive'        =&gt; true,     'hierarchical'       =&gt; false,     'menu_position'      =&gt; null,     'supports'           =&gt; array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )   );    register_post_type( 'news', $args ); } add_action( 'init', 'codex_custom_init' );   and My Pagination Code:  &lt;?php      // the query to set the posts per page to 3     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array('posts_per_page' =&gt; 2, 'post_type' =&gt; 'news' , 'paged' =&gt; $paged );     query_posts($args);  ?&gt; &lt;!-- the loop --&gt; &lt;?php if ( have_posts() ) : while (have_posts()) : the_post(); ?&gt;     &lt;div class="news-main"&gt;         &lt;div class="news-image"&gt;&lt;img src="&lt;?php echo get_field('image'); ?&gt;" /&gt;&lt;/div&gt;         &lt;div class="news-container"&gt;             &lt;h1&gt;&lt;?php echo the_title(); ?&gt;&lt;/h1&gt;             &lt;p&gt;&lt;?php echo the_content(); ?&gt;&lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;?php endwhile; ?&gt; &lt;!-- pagination --&gt;     &lt;?php next_posts_link(); ?&gt;     &lt;?php previous_posts_link(); ?&gt; &lt;?php else : ?&gt; &lt;!-- No posts found --&gt; &lt;?php endif; ?&gt;   I am new with WordPress so please some one help me :).
4512
I've got a custom loop that I'm using to display some Real Estate listings that will be available within 60 days. I'm calling it with the following function:   &lt;?php  $sixtydays = date('Y/m/d', strtotime('+60 days')); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $query = new PostsOrderedByMetaQuery(array(   'post_type' =&gt; array('post', 'real-estate'),   'meta_key' =&gt; 'Time Available',   'meta_compare' =&gt; '&lt;=',   'meta_value' =&gt; $sixtydays,   'paged' =&gt; $paged,   'orderby_meta_key' =&gt; 'Price',   'orderby_order'    =&gt; 'ASC' )); ?&gt; &lt;?php while ($query-&gt;have_posts()) : $query-&gt;the_post(); ?&gt;   While the loop works great, I can't get it to paginate. It shows the first 10 (my default) posts but doesn't show the pagination. The only way to display all posts is to show them on one page by adding 'posts_per_page' =&gt; -1, I have similar loops on other pages that have no problem paginating. The only difference with this one is that there are two meta keys that are filtering the posts.   I'm using WP Page Navi for this and the rest of my pages. I'm closing the loop and adding the pagination using the following code:   &lt;?php endwhile; // End the loop. Whew. ?&gt; &lt;?php wp_pagenavi(); ?&gt; &lt;?php wp_reset_query(); ?&gt;   How can I go about fixing this?
76690
On the search results page (search.php) I would like to perform an additional WP_Query to keep a specific order of search result types e.g. search results from authors should always be shown before the other results -  The first few pages should hold the author results, the other results should be shown on all the following pages only (not mixed on each page).  global $wp_query; //holds the results of the initial search query  $authorposts = $wp_query-&gt;posts;     $query = new WP_Query( 'year=2012&amp;monthnum=12&amp;day=12' ); $otherposts = $query-&gt;posts;  $wp_query-&gt;posts = array_merge( $authorposts, $otherposts  ); $wp_query-&gt;post_count = count( $wp_query-&gt;posts );  if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;   //show results loop...   The problems appear with the behaviour of pagination - while the $authorposts seem to paginate correctly i.e. correct page numbers for author posts and pagination works as only those where existent. But the $otherposts on the other hand are shown at the bottom of each page, right under the author posts. And they are the same on every page! Also the page count reflects the count of the first query only.  I have also tried to merge with the plus operator:  $wp_query-&gt;posts = $authorposts + $otherposts;   but in this scenario the $otherposts don't show up at all and the page count stays the same (page count for author posts).  All the examples with similar goals using two separate queries I've seen looked quite the same -  So I'm wondering if the my way of extending the original search query results with that additional WP_Query is sufficient or if I'm missing some $wp_query fields to be populated (correctly)? What's the correct way doing this?  Update: It should be noted that I'm using the WP-PageNavi plugin to paginate but this should not be relevant in the first place as the first page is already rendered wrong. And it's also initialized with the query object: wp_pagenavi( array( 'query' =&gt; $wp_query ));
117775
On Latin.SE, I am getting a 404 error when clicking any of the three "history" links on the .  That is, this:        Gives this:        All three editable sections have a revision history with two revisions or more, and all three give an error.  The actual links are , , and .
109307
I'm trying to make a page where a user provides an ID of a attachment and the site will set the headers and deliver that file instead of a 404 page. so /download/1754 would lookup the attachment with that Id and output it for viewing/download depending on the file type.  I just can't think of a wordpress friendly way to do this from inside a plugin. I considered using add_rewrite_rule but couldn't see a good way around it, also considered checking $_SERVER['REQUEST_URI'] to deliver the content before any HTML but then I'd have to stop the page from rendering a 404 and I was not sure of a Wordpress friendly way to do this.  My current idea was to have my plugin make a download page, assign a template and have that template run the logic instead of my plugin class. while I have used this before for another situation it was very messy as I had to write a lot of code to force users to be unable to update or edit the file and recreate/delete it on activation.deactivation. so ideally I'd like to avoid that.
72968
I am attempting to create an AJAX call to pass custom taxonomy into my WP_Query but I am getting 400 (Bad Request). I believe my data array is built correctly so I am not sure what's causing it. Does anything look off here? Is there a way for me to get a more detailed error of why it is returning error 400?  $.ajax({     type:'POST',     url:ajaxUrl,     data: {         taxonomy: 'products',         slug: 'shirts'     },     beforeSend:function(xhr){      },     success:function(data){       $('#response').html(data); // insert data     } });   I console logged ajaxUrl and I am getting the correct path to admin-ajax.php so I know that's not the issue. I think it has to have something to do with data.
30177
i am getting a weird error - white screen in the list of posts for a specific Custom post type (just for that one)   tried deactivating all the plugins tried checking for error (debugging = true)   Still nothing the page just doesnt echos anything... (nothing in source too)  I am talking about such a url in the admin:     Here is register_post_type part i am using:    function register_submodelcpt() {     $labels = array(         'name'                  =&gt; __('Sub Models', THEME_NAME),         'singular_name'         =&gt; __('Sub Models', THEME_NAME),         'add_new'               =&gt; __('New Model', THEME_NAME),         'add_new_item'          =&gt; __('Add new Model', THEME_NAME),         'edit_item'             =&gt; __('Edit Model', THEME_NAME),         'new_item'              =&gt; __('New Model', THEME_NAME),         'all_items'             =&gt; __('All Sub Models', THEME_NAME),         'view_item'             =&gt; __('Watch Model', THEME_NAME),         'search_items'          =&gt; __('Search Models', THEME_NAME),         'not_found'             =&gt;  __('No Models found', THEME_NAME),         'not_found_in_trash'    =&gt; __('No Models found in trash', THEME_NAME),          'parent_item_colon'     =&gt; '',         'menu_name'             =&gt; __('Sub Models', THEME_NAME),      );      $args = array(         'labels'                =&gt; $labels,         'public'                =&gt; true,         'publicly_queryable'    =&gt; true,         'show_ui'               =&gt; true,          'show_in_menu'          =&gt; true,          'query_var'             =&gt; true,         'rewrite'               =&gt; array('slug' =&gt; 'submodels'),         'capability_type'       =&gt; 'post',         'has_archive'           =&gt; true,          'hierarchical'          =&gt; true,         'menu_position'         =&gt; 5,         'menu_icon'             =&gt; get_stylesheet_directory_uri().'/images/cpt/subcars.png',                     'supports'              =&gt; array('title', 'thumbnail', 'revisions', 'page-attributes')     );      register_post_type('submodelscpt',$args); } add_action('init', 'register_submodelcpt');   Did anyone encounter such an issuse? can you think of a reason this might happen?   Another weird thing when i change this:    To this:     The posts list loads correctly...
18655
So I made some custom posts and taxonomies..  http://example.com/?product_category=mytaxonomyterm&amp;lang=it  Till here, all fine: I get a 'mytaxonomyterm' taxonomy archive. Btw, lang is because I'm using polylang plugin.  If I try to add &amp;posts_per_page=15 to url, it doesn't work: it won't change number of post.   Even worse, if I add paged=1, It will reload into  http://example.com/?product_category=mytaxonomyterm&amp;lang=it (so stripping the page param).  Even worse, if I add paged=1, it will throw an error telling me that there's an error in post-template.php on line 279, 'Trying to get property of non-object'.  So what? What am I doing wrong?
110834
I have an archive page showing all blog posts (in a specific category). With a growing number of posts, I want to separate these by publish year. For example (simplified), I'd like the following:  2012   post post post   2011   post    I'm testing this system by changing my oldest post's publish date to mid-2011. Currently the structure appears to be mostly working, but all posts are showing up under 2012, and none under 2011, despite the oldest post's publish date being set to 2011. To illustrate, I'm getting this:  2012   post post post post (2011 post)   2011    I'm using the code below (some extra stuff has been removed to simplify, but it doesn't affect the result). Can anyone see why the old post is showing up under 2012 and not inside the 2011 &lt;ul&gt;? Thanks for your help.  &lt;?php global $query_string; query_posts($query_string . '&amp;posts_per_page=-1'); // Show all posts ?&gt; &lt;?php if (have_posts() { if (is_category('210')) { ?&gt; &lt;div class="archive-posts-box"&gt;     &lt;?php $firstyear = '2011';     $currentyear = date('Y');     $postyear = get_the_time('Y', $post-&gt;ID);     for ($i = $currentyear; $i &gt;= $firstyear; $i--) { ?&gt;             &lt;h4&gt;&lt;?php echo $i ?&gt;&lt;/h4&gt;             &lt;ul class="archive-posts"&gt;             &lt;?php while (have_posts() &amp;&amp; $postyear == $i) {                 the_post(); ?&gt;                 &lt;li&gt;&lt;span class="archive-post-title"&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="archive-post-date"&gt;&lt;?php the_time(get_option('date_format')); ?&gt;&lt;/span&gt;&lt;/li&gt;             &lt;?php } // end while ?&gt;             &lt;/ul&gt;         &lt;?php } // end for ?&gt;         &lt;/div&gt;&lt;!-- .archive-posts-box --&gt; &lt;?php } // end if (category) } // end if (have_posts) wp_reset_query() ?&gt;
78286
I got a loop from internet (I forgot the site) for two column post view. It has a nice CSS for it too. But skipping that for the question now.  &lt;?php $counter = 1; ?&gt;                  &lt;?php query_posts( 'cat=3&amp;showposts=6' ); //Find whether the catID is 3 ?&gt;             &lt;?php while ( have_posts() ) : the_post() ?&gt;                   &lt;?php /* Two Column Support get class */ ?&gt;              &lt;?php $class = ( $counter % 2  ? ' one' : '' ) ?&gt;                  &lt;?php /* Two Column output open the div class */ ?&gt;              &lt;div class="column&lt;?php echo $class;// echo $first; ?&gt;"&gt;              &lt;?php news_format(); ?&gt;             &lt;/div&gt; &lt;!-- End Two Column Support close div class --&gt; &lt;?php $counter++; //Update counter ?&gt;   It printed my posts into 2 columns like:  ========= | 1 | 2 | --------- | 3 | 4 | --------- | 5 | 6 | =========  It's fine. But I want to print it like this:  ========= |   1   | --------- | 2 | 3 | --------- | 4 | 5 | --------- | 6 | 7 | =========  What the modification I need to do? I can't pass any custom limit into the WordPress' custom loop &lt;?php while ( have_posts() ) : the_post() ?&gt;. It's for a custom theme. I did it, but the problem is, it's showing like:  ========= |   1   | --------- | 1 | 2 | --------- | 3 | 4 | --------- | 5 | 6 | =========   is my whole bunch of code.
89832
I want to display the pages 'famous' and 'mschief'.  Using this code, WP_query() doesn't return any result:  $args = array( 'post_type' =&gt; 'page', 'pagename' =&gt; 'famous,mschief', 'posts_per_page' =&gt; 3 );   This code returns one of the 2 pages:  $args = array( 'post_type' =&gt; 'page', 'pagename=famous,mschief', );   And this code returns the 2 pages correctly:  $args = array( 'post_type' =&gt; 'page', 'pagename=famous,mschief', 'posts_per_page' =&gt; 3 );   Why does the first piece of code (the only correct one to me) doesn't work? And why the two others produce these results?
3069
I want wp_link_pages (mutli-page posts) to display the page numbers, the word "previous" before those numbers, and a "next" after those numbers.  It would look like this:  Prev 1, 2, 3, 4 Next  I'm attempting to do this without a plugin.  Here's what I've tried so far, but it isn't working, it is only displaying numbers.  &lt;?php wp_link_pages(array(     'before' =&gt; '&lt;span style="clear:both; display:block"&gt;Pages',      'after'  =&gt; '&lt;/span&gt;',     'next_or_number'=&gt;'number',     'previouspagelink' =&gt; 'previous',     'nextpagelink'=&gt; 'Next' )); ?&gt;
108416
I can't figure out which template name to use to modify custom taxonomy archive page, but not the one for terms in that taxonomy.  My goal is to show terms list in custom taxonomy archive and in custom taxonomy terms - custom post types..  {taxonomy}-{term}.php is used to display custom taxonomy terms ( so there will be custom post types inside ) but i need so there would be terms list inside.  Hope my question in clear.  Edit:  Just found out that I can't open that kind of page in wordpress at all.. So now question is how to make such page?  For ex. I have ct - device. So /device/iphone will show all posts in iphone term, but /device/ should show all terms in device tax.  My problem is that /device/ is readed as page slug, not tax in wordpress by default.  How to change that?
83841
My site's drupal version is 6.19. There are always logs like the following.  the recent log entries shows  type: page not found location:http://www.example.com/display.html referrer:   message: 500.shtml   severity: warning   hostname: 95.64.11.29 or others (maybe search engine robot IP)   The URL and the content is right, but when the anonymous user accesses it, it returns the "Page not found" page. Anonymous users have the permissions to access content.  The cache_page table contains the following header for :  Content-Type: text/html; charset=utf-8 HTTP/1.1 404 Not Found   Why is the page being cached as "404 Not Found", when it actually exists?  When I access  as an anonymous user, the site shows "page not found"; when I clear the cache, anonymous users can access the page. How can I correct the cached content generated by search engine bots?
1112
My WordPress site is returning a 404 not found error on any page apart from the homepage and /wp-admin. I have no absolutely no idea why this is. My Permalinks are set up to use /year/month/date/post-title/ (e.g www.domain.com/2014/04/28/sample-post/). When I change the permalinks to the default (?p=123) it works fine, but not on any of the other ones.  Here is the contents of the .htaccess file:  &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt;   I have also installed the plugin 'Debug This', which provides details on the Rewrite Rules. However because it's a pretty big list and unformatted it would look quite bad, I've put it in a jsfiddle, here:   I think that's all the details I have, I've disabled all plugins and stuff like that. Thanks for any help.  EDIT: ok so I've since discovered a bit more info. I also forgot to say that the host for the site is Heroku (I'm building for a client and for some reason he's insisting I use Heroku, which is bad choice for WP I know but I can't persuade him otherwise so that's life). I recently installed , which also installed Nginx. So I'm assuming that's whats broken my Permalinks. I then found , which seems to be about the issue I'm having, which links to this page on the Nginx Documentation. Problem is I've never used Nginx before so I don't know where to put all the code it's got in the first section entitled Abridged Basic Setup. Can someone help me out? Thank you :)
90418
Is there a hook I can use that when a post is created or updated it goes back to the list/table page of all the posts. If it is also possible to target a post type as well that would be cracking.  It's a really silly request I know and have argued the toss about it but wanted to make sure it was achievable if not very user friendly.  Steve
90353
I have a Wordpress site that I have set up with Google Fetch and I have been getting a bunch of crawl errors and it has started significantly hurting my Google ranking and site traffic even though it clearly says it shouldn't. The thing that doesn't make sense to me is that the 404 pages are not actually pages that exist. They are Tags and categories on my blog mixed with a site address from one of my other websites that is not actually associated with this blog at all. They are different domains/databases and everything so they shouldn't be connected.   The site was actually giving me the same problem a few weeks ago and I actually switched to a new theme because I noticed the one I had was out of date and thought maybe it was throwing a random error. But now, I have no idea why this would even happen or where Google would come up with this URL.   Here are a few examples:   www.whenlovegrows.com/tag/lactose-free-food/www.deannemroz.com www.whenlovegrows.com/tag/crescent-dogs/www.deannemroz.com www.whenlovegrows.com/tag/turkey-dogs/www.deannemroz.com   Basically any time I add a new tag it seems that Google is crawling it and then adding my other site's web address to the end and claiming it is a 404 page. Has anyone ever experienced anything like this? Is there some way I can help it?  Any insight would be much appreciated. I am at a loss as to how to fix this and it is becoming extremely frustrating since it is affecting my ranking.
116834
I am not getting the posts under custom taxonomy(fabric_building_types). I am getting cat_id and cat-&gt;name also but not able to get the posts.  $args = array(     'type'                     =&gt; 'post',     'child_of'                 =&gt; 0,     'parent'                   =&gt; '',     'orderby'                  =&gt; 'name',     'order'                    =&gt; 'ASC',     'hide_empty'               =&gt; 1,     'hierarchical'             =&gt; 1,     'exclude'                  =&gt; '',     'include'                  =&gt; '',     'number'                   =&gt; '',     'taxonomy'                 =&gt; 'fabric_building_types',     'pad_counts'               =&gt; false  );   $categories = get_categories( $args );  foreach ( $categories as $cat ) {      // here's my code for getting the posts for custom post type      $posts_array = get_posts(         array(             'showposts' =&gt; -1,             'post_type' =&gt; 'fabric_building',             'tax_query' =&gt; array(                 array(                     'taxonomy' =&gt; 'fabric_building_types',                     'field' =&gt; $cat-&gt;cat_ID,                     'terms' =&gt; $cat-&gt;name,                 )             )         )     );     print_r( $posts_array );  }   Can anyone please help me out...Thanks in advance