Timeline for Custom Post Type Pagination & duplicate posts
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 20, 2012 at 14:31 | comment | added | Mridul Aggarwal | no error in the code. Maybe you should see if this server is having problems somewhere else as well or maybe restart it. | |
Oct 20, 2012 at 13:57 | comment | added | Mridul Aggarwal | Honestly, i don't see a reason for server crash. Could you provide more details regarding the problem, maybe provide the code present before & after this code? Where you're getting the message? etc. | |
Oct 20, 2012 at 13:50 | comment | added | Eamon |
Ah yes that solved my navigation problem.. I'm running a local server and when I paste $post = get_posts(array( 'post_type' => 'projects', 'taxonomy' => 'featured', 'numberposts' => 1 )); in functions.php and hit save, I immediately get a message that apache stoped working.
|
|
Oct 20, 2012 at 13:43 | comment | added | Mridul Aggarwal |
you can't use is_home()&& is_main_query() , it's $query->is_home() && $query->is_main_query() . & this code can't make server crash, it must be something else
|
|
Oct 20, 2012 at 13:38 | comment | added | Eamon | I tried to implement some parts of your code: <code>function custom_query( $query ) { if ( is_home()&& is_main_query() ) { //Display 6 projects in home $query->query_vars['posts_per_page'] = 6; $query->set( 'post_type', 'projects' ); return; } } add_action('pre_get_posts', 'custom_query', 1);</code> It gives me 6 posts and pagination works. BUT I loose my navigation (really why??). If I paste the code for the featured post in functions.php my apache server crashes (again.. why?).. | |
Oct 19, 2012 at 20:08 | history | answered | Mridul Aggarwal | CC BY-SA 3.0 |