Skip to main content
added 439 characters in body
Source Link
Adam
  • 16.5k
  • 1
  • 44
  • 62

Try the following;

global $wp_query;
global $paged;
$temp = $wp_query;
$wp_query = null;

$args  = array( 
    'post_type' => 'portfolio', 
    'paged' => $paged, 
    'posts_per_page' => -1, 
);

$wp_query = new WP_Query( $args );
while ($wp_query->have_posts()) : $wp_query->the_post();

//do your output here...

endwhile;

//do your pagination here...
wp_paginate();
$wp_query = null; 
$wp_query = $temp;

...also this,

<?php
/*
Template Name: Home
*/
?>

...indicates that you are trying to use this template for the homepage right? Would this file happen to be named also home.php ?

In that case can you tell us what you have set under the following;

enter image description here![enter image description here][1]

Update: (lets debug the query)

Beneath this line;

$wp_query = new WP_Query( $args );

Please paste..

var_dump('<pre>', $paged, '</pre>');
var_dump('<pre>', $wp_query, '</pre>');

So it looks like;

...etc
$wp_query = new WP_Query( $args );
var_dump('<pre>', $paged, '</pre>');
var_dump('<pre>', $wp_query, '</pre>');
...etc

Then copy the output to http://www.pastebin.com so we can inspect whats going on in the query. [1]: https://i.sstatic.net/OWDCi.jpg

Try the following;

global $wp_query;
global $paged;
$temp = $wp_query;
$wp_query = null;

$args  = array( 
    'post_type' => 'portfolio', 
    'paged' => $paged, 
    'posts_per_page' => -1, 
);

$wp_query = new WP_Query( $args );
while ($wp_query->have_posts()) : $wp_query->the_post();

//do your output here...

endwhile;

//do your pagination here...
wp_paginate();
$wp_query = null; 
$wp_query = $temp;

...also this,

<?php
/*
Template Name: Home
*/
?>

...indicates that you are trying to use this template for the homepage right? Would this file happen to be named also home.php ?

In that case can you tell us what you have set under the following;

enter image description here

Try the following;

global $wp_query;
global $paged;
$temp = $wp_query;
$wp_query = null;

$args  = array( 
    'post_type' => 'portfolio', 
    'paged' => $paged, 
    'posts_per_page' => -1, 
);

$wp_query = new WP_Query( $args );
while ($wp_query->have_posts()) : $wp_query->the_post();

//do your output here...

endwhile;

//do your pagination here...
wp_paginate();
$wp_query = null; 
$wp_query = $temp;

...also this,

<?php
/*
Template Name: Home
*/
?>

...indicates that you are trying to use this template for the homepage right? Would this file happen to be named also home.php ?

In that case can you tell us what you have set under the following;

![enter image description here][1]

Update: (lets debug the query)

Beneath this line;

$wp_query = new WP_Query( $args );

Please paste..

var_dump('<pre>', $paged, '</pre>');
var_dump('<pre>', $wp_query, '</pre>');

So it looks like;

...etc
$wp_query = new WP_Query( $args );
var_dump('<pre>', $paged, '</pre>');
var_dump('<pre>', $wp_query, '</pre>');
...etc

Then copy the output to http://www.pastebin.com so we can inspect whats going on in the query. [1]: https://i.sstatic.net/OWDCi.jpg

Source Link
Adam
  • 16.5k
  • 1
  • 44
  • 62

Try the following;

global $wp_query;
global $paged;
$temp = $wp_query;
$wp_query = null;

$args  = array( 
    'post_type' => 'portfolio', 
    'paged' => $paged, 
    'posts_per_page' => -1, 
);

$wp_query = new WP_Query( $args );
while ($wp_query->have_posts()) : $wp_query->the_post();

//do your output here...

endwhile;

//do your pagination here...
wp_paginate();
$wp_query = null; 
$wp_query = $temp;

...also this,

<?php
/*
Template Name: Home
*/
?>

...indicates that you are trying to use this template for the homepage right? Would this file happen to be named also home.php ?

In that case can you tell us what you have set under the following;

enter image description here