WordPress.org

Ready to get started?Download WordPress

Forums

Magento WordPress Integration
[resolved] call blocks for only one page (5 posts)

  1. pimpinnick
    Member
    Posted 1 year ago #

    Hey,

    first off, thanks for the plugin. Now for my question:

    I was wondering if you could give me a hint on how to integrate blocks from magento on just one page? I have multiple pages (home, shop, blog, ...) and I would like to only have the magento blocks on the shop page. Not quite sure how to go about it. Are there conditional tags or how do I not have the blocks globally for my page.

    Any help is appreciated.

    cheers,

    Nick

    http://wordpress.org/extend/plugins/magento-wordpress-integration/

  2. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Nick,

    You'll want to use WordPress conditional tags in your templates, for example:

    if(is_page('page-slug')) { the_block('your-block'); }

    or

    if(is_page(25)) { the_block('your-block'); }

    where 25 is the page id. This will mean the block only shows on that page.

    http://codex.wordpress.org/Function_Reference/is_page

  3. pimpinnick
    Member
    Posted 1 year ago #

    Hey James,

    thanks for your answer. I will have to be a complete noob about this:

    I understand enough php to have a grasp of the syntax and what it does. However, I don't know where I have to put that line of code. I tried integrating it into a custom page template but to no avail. Any recommendations? Again, I appreciate your help.

    Cheers.

  4. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    If you only ever want the block to appear on said template, you should just be able to put:

    <?php the_block('your-block'); ?>

    where you want it to appear, if that doesn't work, paste some code and I'll take a look!

  5. pimpinnick
    Member
    Posted 1 year ago #

    James,

    thanks for the advice. I figured it out by now. And thanks again for the plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic