Integrating WordPress into Zen Cart

Before you start, keep in mind that we also offer a service to integrate WordPress with Zen Cart.  This tutorial and service has been tested with Zen Cart versions: 1.3.8a to 1.5.5f.

When we first launched the Numinix Blog, we tried to use a module called WordPress on Zen Cart to display our WordPress blog as a page inside Zen Cart. Unfortunately, that module hasn’t been updated in years (the word “years” is almost never a good thing when referring to software) and actually causes conflicts with a lot of other modules for Zen Cart. Fast forward to a week ago when one of our loyal customers insisted we find a way to integrate the blog into Zen Cart so that such things as shopping cart quantity and login status can be maintained even when in the blog. After doing a little research, I found that integration had been achieved for osCommerce and that it must also be possible for Zen Cart. So, after a few successful integrations across multiple customer’s websites, including our own, I decided to write this tutorial on how to integrate WordPress with Zen Cart. Due to the large number of steps, I thought it wouldn’t be a good idea to release this as a module.

So firstly, this tutorial assumes you have one the following setups:

Situation 1

  • Zen Cart installed to the root
  • WordPress installed to a sub-folder such as /blog/

We’ve also achieved the following situation:

Situation 2

  • Zen Cart installed to a sub-folder such as /shop/
  • WordPress installed to a sub-folder such as /blog/

It is recommended that your site either not use SEO URLs, or use a SEO URLs module such as SIMPLE SEO URLs (Magic SEO URLs works as well) which can disable/exclude rewriting the “blog” page. If you are using a module that cannot disable rewriting, issues could arise if the module tries to rewrite PHP URLs created by WordPress. For example, when “previewing” a blog post, WordPress creates a PHP URL that could be mistakenly rewritten.

The second situation requires additional steps unless you are fine with your blog appearing in /shop/blog/ rather than /blog/.

Preparing WordPress


Step 1:

Create a WordPress Child Theme.

Step 2:

First, you will need to disable access to your current blog by uploading a blank file named index.html to your WordPress root directory. You may also want to rename your index.php file in case your server settings automatically load this file before any html files (this will differ from server to server).

Step 3:

Next, save a copy of your theme’s style.css file and any images that are referenced in the style sheet to a place on your desktop to later be uploaded to your Zen Cart installation.

Rename style.css on your desktop to blog.css and open the file and change all image URL paths to match the URLs found in your Zen Cart style sheets.

Step 4:

Open and go to SETTINGS

Change WordPress address (URL) to (WordPress will be physically installed here)

Change Blog address (URL)

Note: these two paths must not match.  If WordPress is located in “/wordpress/”, then the blog will be publicly accessible through an alternate URL (i.e. /blog/).  You can name either whatever you like, but the blog must physically exist at the WordPress Address.  The Blog address will be used as a rewrite for the Zen Cart page we will be building later on.  If you’d like to use a different name other than /blog/ in the URL, you’ll need to modify the htaccess rewrite provided in the Zen Cart installation instructions below.

Step 5:

Rename your WordPress folder to the folder name you chose for the WordPress Address in step 4 above.


Zen Cart Installation

Step 1:

Upload blog.css to includes/templates/YOUR_TEMPLATE/css/

Upload your wordpress images to includes/templates/YOUR_TEMPLATE/images/

Step 2:

Download the WordPress/Zen Cart integration package.

Unzip the package and upload the full package to your Zen Cart folder.

Step 3:

Open includes/wordpress_page.php and change


To use your wordpress folder name that you chose previously. If your Zen Cart folder is in the root, remove “../”.

Step 4:

Open includes/template/YOUR_TEMPLATE/common/tpl_main_page.php and find


Replace it with:

$zc_template = $template;
$template = $zc_template;

Step 5:

Open includes/application_top.php and find:


Add after:

// WordPress integration

Step 6 (skip this step if using a SEO module that cannot be disabled):

In your domain root, open .htaccess and add the following:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^blog(.*)$ /catalog/index.php?main_page=blog&$1 [E=VAR1:$1,QSA,L]

This will rewrite your blog page url to If this causes a server error, try changing the last line above to:

RewriteRule ^blog(.*)$ /catalog/index.php?main_page=blog$1 [L]

Note: if your store is in the root of your domain, remove “/catalog” from the rule.  If you want wordpress to load as a different URL, change the first instance of “blog” in the RewriteRule to whatever you set as the Blog Address in step 3 of the Preparing WordPress section above.

Step 7:

To display your blog titles as the page title:
Open includes/modules/YOUR_TEMPLATE/meta_tags.php
// EZ-Pages:
case 'page':

And add before:
case 'blog':
define('META_TAG_TITLE', (defined('NAVBAR_TITLE') ? NAVBAR_TITLE . PRIMARY_SECTION : '') . wp_title(PRIMARY_SECTION, false, 'right') . TITLE . TAGLINE);

You can manipulate this code if you have experience with PHP to create the title format that you’d like. Also opening the meta_tags.php file and creating a custom format for “blog” would be a good idea.

Step 8

Add the following AROUND any meta tags in includes/templates/YOUR_TEMPLATE/common/html_header.php that you do not want to load on the blog page (i.e. description and keywords) so that wordpress tags will be used instead:

<?php if ($_GET['main_page'] != 'blog') { ?>


<?php } ?>


Well, the EASY part is over. Now is the part where you will need some experience with CSS and HTML as you have just imported your entire blog into the main page area of your Zen Cart template… chances are it isn’t going to fit and all of the CSS is ruined by the global style sheet of your Zen Cart. Or, global styles within the blog.css file will have an effect on the look of your store.

Some tips:

  • Remove the header and footer code that you no longer need from header.php and footer.php in your WordPress theme folder.
  • Change all selectors in your css file to be specific to only the main area of the blog page.

Well, that is the end of the tutorial on how to integrate WordPress into Zen Cart. If I’ve missed any steps, please let me know and I will double check everything and update this posting as needed. If you would like to get Numinix to complete these steps for you, please visit our WordPress/Zen Cart Integration service page.

Happy blogging!

350 thoughts on “Integrating WordPress into Zen Cart

  1. It works good! But it looks like WP is only being loaded for ezpages. How do I get WP to load on other pages like category, product, etc?

    The reason is I want to call some functions in my WP’s custom functions.php. I already have edited some zencart code to allow PHP code to be processed in the description of categories.

  2. Missing detail!

    At the end of your zencart tpl_main_page.php, just before , be sure to add

    I couldn’t get instagram embeds to work for weeks until I figured this out.

    1. At the end of your zencart tpl_main_page.php, just before the closing body tag add

      if ($_GET['main_page'] == 'blog') {

  3. Hey man, I’m having an issue using this method with zc version 1.5.4 where bloginfo() in jscript_blog.php. Where and how is it that the WP functions are supposed to become available?

  4. Hi Numinix – Thank you for sharing this. I am testing an upgrade from Zencart 1.5.0 (where I have this module installed and works well) to Zencart 1.5.3. The zencart and wordpress installations are in (zencart installation) and (wordpress installation – wordpress folder name has been changed to a custom name in the admin settings and site url to /blog/). I can get to my wordpress admin page and create a test page. But when I click on the link I created to open the blog ( I get a error message:

    The requested URL /custom wordpress name/index.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    I’ve checked all the steps for both wordpress and zc above and have not missed anything…

    I’ve been playing around with the .htaccess file but can’t seem to figure this out. My .htaccess file is this:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    #RewriteRule ^blog(.*)$ /zc153/customwordpressfolder/index.php?main_page=blog&$1 [E=VAR1:$1,QSA,L] <— Tried this and did not work!

    #Options +FollowSymLinks
    #RewriteEngine On
    #RewriteBase /
    #RewriteRule ^blog(.*)$ /index.php?main_page=blog&$1 [E=VAR1:$1,QSA,L] <— Tried this and did not work
    RewriteRule ^blog(.*)$ /customwordpressfolder/index.php?main_page=blog$1 [L] <— Tried this and did not work.

    Can you please guide me as to what I might be doing wrong?

  5. Hi, many thanks for this post. I implemented on and It´s seems ok, but I have problem with access to administration and question about nice adresses on WP.

    blog adress:
    admin adresses: – not function, when redirect match is in .htaccess (it shows normal blog page and not administration)

    I use magic seo URLs.

    2) is possible to use some “nice adresses” on WP? Now it is and i need f.e.

    Many thanks.

  6. First, thank you for this tutorial!

    Everything seems to work properly except when clicking on Hello World or Comments link on the WordPress site. The url appears as but I am shown the Zencart 404 page.

    I am using CEON Ultimate URI Mapping, and my .htaccess includes the following:

    # Don’t rewrite blog directory
    RewriteCond %{REQUEST_URI} !^/blog/ [NC]

    then the code you provided in the tutorial is added at the bottom.

    My permalinks are set to post name

  7. Hello, thank you very much for this powerfull tool that you shared with us!
    Installed in

    Just that i can’t set the Step 8 right… there is an example of ADD AROUND the metatag the php code ?

  8. Hi Numinix thanks a lot for this powerfull tool that you have shared with us!!..
    I installed this in and its working ok, all except Step 8 meta tags.
    My porpouse of installing this blog was to share the post in my fanpage so bring trafic to the store with content of interest. So it is important to me about HOW the post are shared.
    Facebook for example use the MetaDescription, and i can’nt make it work, cause i’m not sure what do you mean with AROUND the meta tag .
    Can you show me an example? please?

  9. joinsen, unfortunately I do not have experience with nginx. You’ll have to refer to their documentation on how to rewrite a URL to point index.php?main_page=blog.

    1. Hello! can u help me with my problem? Ex. My site is and I’v installed worpress under

      blog link -> if I will click any of the link inside the blog content it will directed me to ex. http://www.grace.comblog/?p=4 and the page return blank white page.

      WordPress Address (URL) -> http://localhost/visuo/wordpress
      Site Address (URL)Site Address (URL) -> http://localhost/visuo/blog

      Hoping for your reply soon. Thank you.

  10. Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^blog(.*)$ /catalog/index.php?main_page=blog&$1 [E=VAR1:$1,QSA,L]
    i use nginx and how can i rewrite it ?

  11. I’m using your most recent version of wordpress_page for Zen Cart integration, and with the TwentyThirteen theme, am still getting same error message ONLY when using a widget in the secondary widget area:
    [10-Oct-2013 19:18:42] PHP Fatal error: Cannot redeclare twentythirteen_setup() in /Users/mikekilmer/Sites/wordpress/steel/wp-content/themes/twentythirteen/functions.php on line 60
    I’ve done a bit of research and troubleshooting,with not luck still. any insights? Thanks much. Your fan – MikeiLL

    1. Mike iLL Kilmer, does this error happen only when you have integrated with Zen Cart? Seems like each widget is trying to load the functions.php file again rather than only once. The issue is likely in your theme and not with the integration.

      1. Thanks for the insight, Numinix! It was actually the social sidebar I was using at that was creating the conflict, so for not I’ve just disabled it on the blog pages by adding an if statement to tpl_main_page:
        /*mZoo Remove Social Sidebar from Blog Page*/
        if ($current_page_base != ‘blog’) {?>

  12. I’ve been using this method on a couple of blogs for years (thank you very much), but there is an issue with the Twenty Thirteen theme: PHP Warning:

    call_user_func_array() expects parameter 1 to be a valid callback, function ‘stats_template_redirect’ not found or invalid function name in /path/to/wp-includes/plugin.php on line 406. it occurs when i add any widget into the seconday widget area.

    Any ideas? – thanks.

    1. if ( !function_exists( ‘stats_template_redirect’ ) ) {
      add_action( ‘wp_footer’, ”, 1 );
      } else {
      add_action( ‘wp_footer’, ‘stats_template_redirect’, 1 );

      1. wrong.

        if ( !function_exists( ‘stats_template_redirect’ ) ) {
        add_action( ‘wp_footer’);
        } else {
        add_action( ‘wp_footer’, ‘stats_template_redirect’, 1 );

        or just replace with `add_action( ‘wp_footer’);`

  13. Great mod to have for Zen Cart. Only thing is I can’t get it to work and I’m certain may have to do my SEO mod as you mentioned in the tutorial. I am using CEON’s SEO module, and it has its own rewrite rule htaccess, id this a module that may cause issues that you are aware of?

    1. Jason, you’ll likely need some advanced URL rewriting in your htaccess to get that mod to play nice with the rewrite needed for the virtual blog URL to work.

  14. Having issues with WordPress Stats in the Jetpack plugin? We’ve just uploaded a new package with a modified file located at includes/wordpress_page.php that fixes this bug. Enjoy!

  15. I follow your tutorial, but no luck. I am getting the wp content on the zen cart homepage but nothing else from wordpress past that homepage. when I click on a wp link within that zen cart front page I get a blank page.
    I have been getting the same error with everything single tutorial on zen cart and wordpress integration and nothing dated after 2010.
    will be helpful if anyone has a strong tutorial out there or a way to resolve this. Thanks

    1. Sounds like you are trying to use this tutorial differently than how it was intended. It should be integrated as a DEFINE PAGE in Zen Cart, not on your home page. If you are having it load outside of the “blog” page, or whatever you may have renamed the page to, then the instructions have not been followed correctly. I strongly recommend that you consider our integration service if you are having trouble with our tutorial. There is a lot of file editing and room for error in this integration as it requires introductory PHP and intermediate CSS knowledge.

  16. I have this installed and almost working. The zencart site is at The blog is at

    Everything looks fine when you first go to the blog, however, if you try and click any links (posts, comments, etc.), it just redirects back to the blog home page, although it does display the url for the page in the address bar (e.g.

    I did try changing the permalinks, I tried all the different styles, but then I get 404 errors on all blog links.

    I noticed when changing the permalinks that it gives new code that is supposed to be added to the .htaccess file. I did try adding that code, but then the site showed an internal server error.

    I’m guessing it is something in my .htaccess I need to change to get the permalinks to work, but I’m just not sure what?

    This is my .htaccess right now:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /~abckid/

    RewriteRule ^blog/(.*)$ index\.php?main_page=blog$1 [L]

    I would really appreciate any tips on how to get this working.

    Thank you!

    1. Hi all.

      Well, after spending yesterday scouring the net for the most reliable way of implementing Zencart and WordPress. I am torn between linking the sites together or this method by incorporating WordPress into Zencart.
      I have not quite successfully implemented this method.
      The only problem I have is that I am unable to login to wordpress so I can add/edit my posts. Otherwise it’s great.
      Any ideas peeps?
      Or am I gonna have to link my sites instead. 🙁

      Thanks in advance.

      1. Keep in mind that under this integration your blog is accessible under /blog/ and your blog admin is accessible under /wordpress/wp-admin/.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Contact Account Cart Search Cart Open Menu Arrow Link Arrow Chat Close Close Popup Facebook Twitter Google Plus linkedin2
    Integrating WordPress into Zen Cart - Numinix Blog