Support

Account

Home Forums Front-end Issues Show field only on first woocommerce category page

Solving

Show field only on first woocommerce category page

  • Hi,

    I build a site with Elementor and using ACF for custom text on Woocommerce category pages. Works perfect but there is just one issue.

    I’m showing the extra content beneath the products, but the extra content is also showing on the 2nd, 3th, 4th pages etc. But i don’t want these pages to have the same content.

    How can i show the content only on the first category page?

    Thanks! Example page: https://www.beddies.nl/ledikanten/

  • You’ll need a way of detecting which page is being handled by the pagination. If you can access the $page variable then you can put a loop around the render of the ACF field like:

    if( $page == 1 ) {
     print get_field('field');
    }
  • Thanks Goldhat for your reply. Still not sure how to dectect which page is being handled by the pagination.

    I have no idea how to detect this, anybody else maybe?

  • 
    $paged = get_query_var('paged');
    
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.