What function / class is required to detect a Marketpress single post page?

Hi,

What function / class is required to detect a Marketpress single post page? Need to make a change.

Thanks!

  • Vubiquity
    • Premium Content Services

    My theme developers, I think, are confused. They had me add some code that didn’t really work.

    Is there a way to go into the php of the MarketPress plugin and have it call Sidebar8?

    Or can I duplicate sidebar.php and re-name it sidebar8.php, add some code so that it’s calling Sidebar8, and have the MarketPress plugin call that? Somehow?

    Thanks.

  • espsjurs
    • The Incredible Code Injector

    There is a function called mp_is_shop (or somthing similar), but will detect all shop pages, not just posts.. I have not tested this one, but I guess it should be the one you are looking for :slight_smile:

    It have seen it used in some widgets to tell if it should show on mp pages only..

    Espen

  • Vubiquity
    • Premium Content Services

    Thanks espsjurs. I’m not entirely sure how to use that.

    I’m wondering how I can add this code to the Shopping Cart widget. I now have the Shopping cart show up in the sidebar only in MP pages, but there’s no way (that I could see) to have custom code show up on those pages. And I really REALLY need at least a “Order Status” link in my sidebar. Otherwise, I’m not sure how anyone will ever be able to get to it. I’d also love to be able to add “Global Product Categories” to JUST my MP store pages, but there’s no option for that.

    Here’s the code I would like inserted so it shows up only on MP store pages. I figured if I slipped it under the Shopping Cart widget in MarketPress.php, that would work. But I don’t really know php, and can’t figure out how to add it properly.

    <div class=”list arrow grey-lite”>

    </div>

    Another awesome thing to add to MarketPress would be a “Only show on MP store pages” TEXT widget (along with “Global Product Categories”:wink:. That would be absolutely fantastic. Is there a way to make that happen?

  • espsjurs
    • The Incredible Code Injector

    Hi @ice9design

    Now I am not sure what your goal is here..

    If you want to give your theme developer a way to check if the current page is a shop page you can use the function mp_is_shop_page() like this:

    <?php if (mp_is_shop_page()) { _e('**Shop**');} else {_e('**Blog**');} ?>

    When I add this to my header it works fine :slight_smile:

    If you goal is to add a small static text/link to one of MP’s widgets then you should add your code to the widgets function in marketpress.php.

    If your goal is to create a new widget with ‘Only show on store pages’ option, you should add

    if (!mp_is_shop_page()) return;

    to your widget code.

    Hope this helps :slight_smile: