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 9203961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:35:36+00:00 2026-06-17T23:35:36+00:00

EDIT 01-28-13: Revised to clarify my question. I’m using Magento 1.7.0.0 and FishPig WP

  • 0

EDIT 01-28-13: Revised to clarify my question.

I’m using Magento 1.7.0.0 and FishPig WP full integration. We have successfully listed products from specific category and from all categories but was wondering if we can exclude in some cases from specified category. I found solutions to do this in functions.php within WordPress but this does not seem to work.

Here is the current code that displays posts from all categories. We’d like to add an exception so WordPress 1 Category can be excluded.

Here is the code that displays from all categories which I’d like to NOT include category “Press_HomePage”:

    $col_posts = Mage::getResourceModel('wordpress/post_collection')->addIsPublishedFilter();
    $posttotal = count($col_posts->getAllIds());
    $posttotid = $col_posts->getAllIds();

    //i<=2 means displays last 2 posts
    //display latest 2 posts...
    for ( $i=1; $i<=2; $i++ )
      {
  ?>
        <div class="blog">
          <h2><?php echo $col_posts->getItemById($posttotid[$posttotal-$i])->getPostDate(); ?></h2>
          <h1><?php echo $col_posts->getItemById($posttotid[$posttotal-$i])->getPostTitle(); ?></h1>
          <div style="float:left; margin-top:15px; margin-bottom:25px;">
          <?php 
            $featured_img = $this->getSkinUrl('images/pree_emty.png');
            if($featuredImage = $col_posts->getItemById($posttotid[$posttotal-$i])->getFeaturedImage())
              {
                $featured_img = $featuredImage->getAvailableImage();
              }
          ?>
            <img style="float: left;" src="<?php echo $featured_img; ?>" width="204" height="204" alt="" />

            <div style="float: left; width: 580px; padding: 10px;">
              <p><?php echo substr(strip_tags($col_posts->getItemById($posttotid[$posttotal-$i])->getPostContent()), 0, 400); ?></p>
              <p>
                <a href="<?php echo $col_posts->getItemById($posttotid[$posttotal-$i])->getUrl(); ?>">
                  <img src="<?php echo $this->getSkinUrl('images/view_btn.jpg'); ?>" width="170" height="32" alt="" />
                </a>
              </p>
            </div>
          </div>
        </div>
  <?php
      }
  ?>

Let me know if I need to clarify myself. I appreciate your time.

  • 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-06-17T23:35:37+00:00Added an answer on June 17, 2026 at 11:35 pm
        //loki - get all the post ids
        $col_posts = Mage::getResourceModel('wordpress/post_collection')->addIsPublishedFilter();
        $posttotid = $col_posts->getAllIds();
    
        //loki - get all the press ids
        $col_posts_press = Mage::getResourceModel('wordpress/post_collection')->addIsPublishedFilter()->addCategorySlugFilter('press_homepage');
        $posttotid_press = $col_posts_press->getAllIds();
    
        //loki - removing the press_homepage category from array and reindexing
        $blogposts = array_diff($posttotid, $posttotid_press);
        $blogposts = array_values($blogposts);
        $posttotal = count($blogposts);
    
        //i<=2 means displays last 2 posts
        //display latest 2 posts...
    
        for ( $i=1; $i<=2; $i++ )
          {
    
      ?>
            <div class="blog">
              <h2><?php echo $col_posts->getItemById($blogposts[$posttotal-$i])->getPostDate(); ?></h2>
              <h1><?php echo $col_posts->getItemById($blogposts[$posttotal-$i])->getPostTitle(); ?></h1>
              <div style="float:left; margin-top:15px; margin-bottom:25px;">
              <?php 
                $featured_img = $this->getSkinUrl('images/pree_emty.png');
                if($featuredImage = $col_posts->getItemById($blogposts[$posttotal-$i])->getFeaturedImage())
                  {
                    $featured_img = $featuredImage->getAvailableImage();
                  }
              ?>
                <img style="float: left;" src="<?php echo $featured_img; ?>" width="204" height="204" alt="" />
    
                <div style="float: left; width: 580px; padding: 10px;">
                  <p><?php echo substr(strip_tags($col_posts->getItemById($blogposts[$posttotal-$i])->getPostContent()), 0, 400); ?></p>
                  <p>
                    <a href="<?php echo $col_posts->getItemById($blogposts[$posttotal-$i])->getUrl(); ?>">
                      <img src="<?php echo $this->getSkinUrl('images/view_btn.jpg'); ?>" width="170" height="32" alt="" />
                    </a>
                  </p>
                </div>
              </div>
            </div>
      <?php
          }
      ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See Edit below initial question for a revised version of the original problem Using
EDIT: my revised Entity relationship diagram A Student can have many contact times but
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
Edit: original question below, but I revise it now that I have some code
Edit (updated question) I have a simple C program: // it is not important
Edit: The original premise of the question was incorrect so revised the question: Basically
EDIT AGAIN: NEW REVISED VERSION So I have corrected the lack of tag in
EDIT: rephrased question for clarity of what I was wanting to achieve. I have
Edit: From another question I provided an answer that has links to a lot
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question

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.