0

I'm experimenting with paginated posts on my site using the SmartMag theme, and I've customized my post content template quite a bit.

However, I still have one issue I'd like to fix: On paginated posts, the subsequent pages all show the featured image at the top. Is there a function that is theme agnostic which would only allow the featured image to show on the first page of a paginated post?

1 Answer 1

1

You can use is_paged() for this. This function determines whether the query is for a paged result and not for the first page. So ofcourse, in your case, you should use !is_paged().

Check out the docs here: https://developer.wordpress.org/reference/functions/is_paged/

2
  • That makes sense, so in the section where I'm showing the featured image on the post, I would just wrap it in if(!is_paged()){//show image}
    – Geoff_S
    Apr 13 at 14:26
  • I/m using this if (isset($props['featured_in_head'])) { if ( !is_paged() ){ $props['featured'] = $props['featured_in_head']; } } but it's not working. I just read that this won't work on posts that are split with <!--nextpage-->
    – Geoff_S
    Apr 13 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.