WordPress.org

Support

Support » How-To and Troubleshooting » Using body_class and reversing paged-n ID

Using body_class and reversing paged-n ID

  • I am trying to display a different body background image for every post. Currently, I’ve set the option to display only one post per page, and using body_class() to assign a unique background image for each post on its own page through CSS:

    .paged-1 { background:url(bg1.jpg); }
    .paged-2 { background:url(bg2.jpg); }
    etc.

    It works! Sort of. The paged IDs are in the reverse order of what I expected. It seems my most recent post/page is re-assigned paged=1. Every post/page then gets its paged ID changed every time I post. This shuffles my background images because all my CSS classes now point to a newer post. I would have to manually update all of them with every new post, which is bad.

    Does anyone know how I can solve this? Thanks in advance for your help.

  • The topic ‘Using body_class and reversing paged-n ID’ is closed to new replies.
Skip to toolbar