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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:29:52+00:00 2026-06-09T00:29:52+00:00

How to retrieve recent posts on the basis of its corresponding category in fishpig

  • 0

How to retrieve recent posts on the basis of its corresponding category in fishpig wordpress magento integration?

  • 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-09T00:29:54+00:00Added an answer on June 9, 2026 at 12:29 am
    $numPostsToShow = 2;
    $categoryId = 1; //Replace with your category id
    $recentPostCollection = Mage::getModel('wordpress/post')->getCollection()
        ->addIsPublishedFilter()
        ->addCategoryIdFilter($categoryId)
        ->setOrder('post_date', 'desc')
        ->setPageSize($numPostsToShow)
    ;
    

    EDIT

    The Fishpig WordPress module registers the current wordpress category as ‘wordpress_category’

    So to answer the question in the comments as to how to get the current wordpress category dynamically:

    Mage::registry('wordpress_category');
    

    The full example above would then become:

    $numPostsToShow = 2;
    $categoryId = Mage::registry('wordpress_category')->getId();
    $recentPostCollection = Mage::getModel('wordpress/post')->getCollection()
        ->addIsPublishedFilter()
        ->addCategoryIdFilter($categoryId)
        ->setOrder('post_date', 'desc')
        ->setPageSize($numPostsToShow)
    ;
    

    But you should probably be using the Fishpig_Wordpress_Block_Category_View block which will give you access to $this->_getPostCollection() from within your template that essentially does everything above – why would you be coding this yourself when using the fishpig module?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to retrieve all records having the most recent modification time. For
I'm looking to retrieve the most recently published post in a wordpress system. I
I am trying to retrieve five recent documents from Deal collection in a MongoDB
I need to execute a program and retrieve its stdout output in c++. I'd
Hi I have to retrieve from my table most recent records that match a
I am trying to query for the 3 most recent posts in the home
I want to retrieve the most recent requestid from table tblquoteproposal` for perticular customerId
I have an sql statement as below attempting to retrieve the most recent entries
I need to retrieve the most recent item added to a collection. Here is
I have two tables(Friends and News_Feed). I need to retrieve the most recent rows(highest

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.