Fatal error: Call to a member function
-
I am trying to make a portfolio for my page and every time I try to goto it I get this error, Fatal error: Call to a member function have_posts() on a non-object in temp.portfolio.php on line 45
<?php global $more; // projects loop $portfolio = new WP_Query(array('paged' => get_query_var('paged'), 'post_type' => 'project', 'posts_per_page' => get_portfolio('projects_per_page'))); $size = get_portfolio('image_size'); if($portfolio->have_posts()) : ?> <?php $_SESSION['portfolio'] = 'portfolio_2_col_s'; if( isset($_GET['portfolio']) ) $_SESSION['portfolio'] = $_GET['portfolio']; ?> <ol id="<?php /* if( get_portfolio('sidebar') && get_portfolio('num_columns') > 2) { echo '2'; } else { _portfolio('num_columns'); } ?>_col<?php if(get_portfolio('sidebar')) echo '_s';*/ echo $_SESSION['portfolio'];?>" class="portfolio_container"> <?php while($portfolio->have_posts()) : $portfolio->the_post(); $more = 0; ?>The last line is line 45. For some reason it has worked once or twice, but then if I reload the page it gives me the error.
The topic ‘Fatal error: Call to a member function’ is closed to new replies.