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

  • SEARCH
  • Home
  • 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 7578007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:19:43+00:00 2026-05-30T17:19:43+00:00

Issue I’m having is returning some data in a sidebar depending on which category

  • 0

Issue I’m having is returning some data in a sidebar depending on which category the user is in. As of now I’m populating some thumbnails from ‘Press’ category in the sidebar, which is proving to be problematic. This is due to after I Query (from ‘Press’ cate) the thumbnails I want to pull, I notice it keeps me from accessing the current ‘Blog’ cate Query. How do I return back to the current category query?

        <?php the_category(', ') ?> // This Returns 'Blog'

        <?php
            $args = array( 'numberposts' => 2, 'category' => 4);
            $postslist = get_posts( $args );
            foreach ($postslist as $post) :  setup_postdata($post); ?> 
            <div>generic return values</div>
        <?php endforeach; ?>

        <?php the_category(', ') ?> // This Returns 'Press', I want this to return 'Blog'
  • 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-30T17:19:44+00:00Added an answer on May 30, 2026 at 5:19 pm

    A call to wp_reset_query should get everything working for you again:

        <?php
            $args = array( 'numberposts' => 2, 'category' => 4);
            $postslist = get_posts( $args );
            foreach ($postslist as $post) :  setup_postdata($post); ?> 
            <div>generic return values</div>
        <?php endforeach;
    
        // Restore's the loop's post object  
        wp_reset_query();
        ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Issue I want to implement TransparencyChecker Interface which would verify that from any exchange
Issue: An issue exists whereby I cannot access my Self Hosted ADO.NET Data Services
Issue I'm getting no output from a simple cout, whereas a printf will always
Issue: I have a Mootools Request object which sends a GET request to a
Issue is resolved now... I have a simple web form where i need to
The issue I'm currently having is mapping multiple GUI fields to object properties (i.e.
Issue 2. I am now getting an error in where the code is not
Issue: When creating a new SilverLight Application Project from Visual Studio 2010, the SilverLight
My issue is, I have to make one demo application in which I wants
The issue I am having with this naming convention ~iPad.xib is that everything loads

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.