How to display list categories in wordpress integration magento

How to display list categories in wordpress integration magento

October 14, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to display list categories in wordpress integration magento

Displaying WordPress Category List on Magento Homepage

Integrating WordPress with Magento allows you to leverage the powerful blogging functionality of WordPress within your e-commerce platform. However, displaying a list of categories from your WordPress installation on your Magento homepage can be challenging.

Understanding the Problem

The code provided by the user attempts to access the current category using Mage::registry('wordpress_category'). If this method returns null (as in the user’s case), it means that either the category registry is not set correctly or there is no category associated with the current context.

The Fishpig_Wordpress_Block_Category_View block is a component of the FishPig WordPress Integration extension. It provides methods to retrieve and display WordPress categories in Magento.

Step-by-Step Solution

1. Ensure the FishPig Extension is Installed and Configured Correctly

Before proceeding, it’s crucial to ensure that you have installed and configured the Fishpig WordPress Integration extension correctly on your Magento site.

2. Add the Category Block to Your Layout XML File

To display the category list, you need to add the wordpress/category block to your layout XML file (usually app/design/frontend/<your_theme>/layout/default.xml).

<block type="wordpress/category" name="wordpress.category.list" template="wordpress/category/list.phtml"/>

3. Create the Category List Template

In your theme directory, create a new file named category/list.phtml (usually located at app/design/frontend/<your_theme>/template/wordpress/category/list.phtml).

Inside this file, add the following code:

<?php
$categories = $this->getChildHtml('wordpress.category.list');
if ($categories) {
    foreach ($categories as $category) {
        echo '<a href="' . $category['link'] . '">' . $category['name'] . '</a><br/>';
    }
}
?>

This code retrieves the list of categories using $this->getChildHtml('wordpress.category.list') and then loops through each category, displaying its name as a clickable link.

4. Refresh Your Magento Cache

After adding the block to your layout XML file and creating the template, flush your Magento cache by running php bin/magento cache:flush from your terminal.

Conclusion

Displaying a list of WordPress categories on your Magento homepage involves a few simple steps:

  1. Ensure you have installed and configured the FishPig extension correctly.
  2. Add the category block to your layout XML file.
  3. Create the template for displaying the category list.
  4. Refresh your Magento cache.

Remember, the key is to use the provided Fishpig blocks (wordpress/category) and templates (category/list.phtml) to display WordPress data in Magento.

For a more detailed guide on integrating WordPress with Magento and utilizing the full functionality of the FishPig extension, I recommend checking out our comprehensive guide on the Laravel Company blog.

Catalog Extensions Themes Configuration

Our network