Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6711541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:09:10+00:00 2026-05-26T08:09:10+00:00

I’m having some problems with the following code: <?php $temp = $wp_query; $wp_query= null;

  • 0

I’m having some problems with the following code:

<?php 
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('post_type' => 'news','posts_per_page='.$gogo_blog_text_no_posts.'&paged='.$paged); 
while ($wp_query->have_posts()) : $wp_query->the_post(); 
?>

I get *’syntax error, unexpected T_DOUBLE_ARROW’*

I’ve used similar code before without problems so I’m a touch mystified.

For clarity the remainder of the template looks like this:-

<?php
/*
Template Name: In The News page
*/
?>
<?php get_header(); ?>

<?php 
$gogo_blog_text_headline = get_post_meta($post->ID, 'gogo_blog_text_headline', true);
$gogo_select_blog_sidebar_position = get_post_meta($post->ID, 'gogo_select_blog_sidebar_position', true);
$gogo_blog_link_text = get_post_meta($post->ID, 'gogo_blog_link_text', true);
$gogo_blog_link_url = get_post_meta($post->ID, 'gogo_blog_link_url', true);
$gogo_blog_text_no_posts = get_post_meta($post->ID, 'gogo_blog_text_no_posts', true);
?>

<?php if($gogo_blog_text_headline) { ?>
<!--  Begin Motto -->
<div class="motto-meta">
    <h1><?php echo $gogo_blog_text_headline; ?></h1>
</div>
<!--  End Motto -->
<?php } ?>

<!--  Begin Page image -->
<?php if (has_post_thumbnail($post->ID)) { ?>
<?php $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
echo '<div class="header-image"><img src="'.get_template_directory_uri().'/lib/includes/timthumb.php?src='.$thumbnail[0].'&amp;w=960&amp;h=250&amp;zc=1&amp;q=100&amp;s=1" alt="'.get_the_title().'" /></div>';?>
<?php } ?>
<!--  End Page image -->

</div>
<!-- End Header -->
<!-- Begin main wrap (it ends in footer.php) -->
<div class="wrap wide">

<div class="main-content-holder">

<?php if($gogo_select_blog_sidebar_position=='right-sidebar-blog-template') { ?>
<!--Left content area-->
<div class="left-content left">
<?php } else { ?>
<div class="left-content right">
<?php } ?>

<?php 
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('post_type' => 'news','posts_per_page='.$gogo_blog_text_no_posts.'&paged='.$paged); 
while ($wp_query->have_posts()) : $wp_query->the_post(); 
?>


<!--Begin post content-->

<?php
    // The following determines what the post format is and shows the correct file accordingly
    $format = get_post_format();
    get_template_part( '/lib/includes/post-formats/'.$format );

    if($format == '')
    get_template_part( '/lib/includes/post-formats/standard' );
?>

<!--End post content-->

<?php endwhile; ?>
<!--End left content-->

<!--Pagination -->
<!--<?php posts_nav_link(' &#183; ', 'previous page', 'next page'); ?>-->
<?php if (function_exists("pagination")) {pagination($additional_loop->max_num_pages);} ?>
<!--End pagination -->
<?php $wp_query = null; $wp_query = $temp;?>
</div>
<!--End left content area-->

<?php if($gogo_select_blog_sidebar_position=='right-sidebar-blog-template') { ?>
<!-- Right content -->
<div class="right-content right">
<?php } else { ?>
<div class="right-content left">
<?php } ?>
<?php get_sidebar('blog'); ?>
</div>
<!-- End Right content -->

</div>
<?php get_footer();?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:09:10+00:00Added an answer on May 26, 2026 at 8:09 am

    I don’t know much about wordpress, but it seems like that you’re trying to pass an array and you forgot to pass it as an array

    Try changing:

    $wp_query->query('post_type' => 'news','posts_per_page='.$gogo_blog_text_no_posts.'&paged='.$paged);
    

    To:

    $wp_query->query(array('post_type' => 'news','posts_per_page='.$gogo_blog_text_no_posts.'&paged='.$paged));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.