I am fully ware that /store /check-out and /shopping-cart

I am fully ware that /store /check-out and /shopping-cart are virtual pages and hence don't have a post id

but this then causes issues with 'standard' themes that use
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> or
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

as the post_class() function fails to return a class and hence the right formatting for div.page or article.page fails.

Obviously I can recode a theme to use a 'super' function that uses slug logic (as per this post) https://premium.wpmudev.org/forums/topic/wordpress-pagepost-ids-and-auto-generated-marketpress-urls

But it would make marketpress more compatible with themes without coding is there was some way to 'fake' the post-id / post_class.

Is there are way?

  • Fullworks

    Sorry /store does have an id, its the /product & /check-out that don't.

    They do get recognised as pages, so I only have to fix up my page template, if there is no post_id to add in an appropriate class, so it is not a big deal, just seems it could be easier.

    If just means the wordpress default themes, which use that call may not format these virtual pages correctly. For instance, twentythirteen uses 'hentry' class added by post_class() to add a 40px padding to the top of single pages.

    This formatting doesn't work on /products or /check-out as the call fails to add the class (no post id) so these marketpress pages don't have the padding and hence 'out of style'.

    Would be good to get it working at least with the default theme :slight_smile:

  • Fullworks

    Its the article tag that doesn't get the classes, and it is article.hentry that has padding 40px in twenty thirteen.

    for instance for /products
    <article id="post-" class="">
    when it should be something like
    <article class="post-2 page type-page status-publish hentry" id="post-2">

    the css is in 2013 is

    .hentry {
    padding: 40px 0;

    hence the styling break

    the 2013 code at 'fault' is in page.php (its the same code as 2011 & 2012 but they are in content-page.php)
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    this is very commen code in many themes

    As mentioned I can apply a fix at theme level (I'll show you my fix below) but of course it would be much better if marketpress worked 'out of the box' on standard themes.

    global $mp;
    global $post;
    if (($mp->is_shop_page)&&(!$post->ID)) {
    <article class='page hentry shop-page'>
    } else {
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.