• Hi,

    I’ve tried to get the page-id within xoo-wsc-content.php but it doesn’t work.

    I want to do that to show a different message on the shop page when the cart is empty and a different message on other pages.

    I used this:

    global $wp_query;
    $post_id = $post->ID;

    But the $post_id always shows the same number…

    Any suggestion ?

    Thanks in advance, Fred

    ps.: love this plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    Its get_the_ID(); ID in uppercase.

    In your case you can also the is_shop() condition.

    if( is_shop() ){
       echo 'shop page';
    }
    else{
       echo 'other pages';
    }
    • This reply was modified 7 years, 7 months ago by xootixsupport.
    Thread Starter qwain

    (@qwain)

    Hi,

    Thanks for your quick reply.

    It used get_the_ID() (ID in uppercase) but that did not work.

    Since get_the_ID() was not working, I’ll thought it was outside the loop and used:

    global $wp_query;
    $post_id = $post->ID;

    But als without any result. get_the_permalink(), get_the_title, etc. is not working
    within xoo-wsc-content.php also.

    I tried is_shop() and that is not working also.

    You can check it out on https://trimsalonsnuit.nl/canivera-producten-bestellen/, if you like.

    I am totally lost….

    Thanks, Fred

    Just tested on my site.
    All cases are working fine.
    Are you directly making the changes to plugin file or overriding template file?
    Try deactivating other plugins.

    Thread Starter qwain

    (@qwain)

    I made the changes directly to the plugin file bij adding these lines:

    global $wp_query;
    $post_id = $post->ID;

    to the file xoo-wsc-content.php from public/partials.

    If you like I can send you the file for your reference.

    (by the way, tried it also without any plugin active besides WooCommerce)

    Thread Starter qwain

    (@qwain)

    By the way, I’ve translated the complete .pot file to Dutch. If you like I can send you the .mo and .po files….

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘get_the_id() not working’ is closed to new replies.