• Resolved tysoned

    (@tysoned)


    Hello, first time posting here. Loving the new Twenty Twenty Three theme. This one has me stumped though.

    I’m looking for a way to assign unique CSS classes to posts called through a query loop.

    I’m anticipating having about 8 different post styles I want to be able to switch between.

    I think the neatest way to do this is via Custom Fields in each post as described on this page. But it’s an older article and have no idea how to implement this with the Twenty Twenty Three theme.

    Are custom fields the best method for what I want to do? And if so, how can this be done?

    Any assistance with this would be greatly appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Welcome and thank you for posting your question here ??

    I’m looking for a way to assign unique CSS classes to posts called through a query loop.

    Just to make sure I am following you, do you need to add these CSS classes to the query loop container (different loops) or to the individual post within a common query loop container?

    If you need the first, you could add a CSS class name to the container itself, under the “Advanced” section, like this:

    Screen Shot on 2023 06 16 at 09 58 06

    If you want to target individual posts within the loop, you could leverage tags or categories, they are added automatically (see below):

    Screen Shot on 2023 06 16 at 09 54 59

    Would this make sense? Were you referring to this? If not, please share more details and we will explore other options ??

    Thread Starter tysoned

    (@tysoned)

    Hi Alvaro,

    I had tried using tags but failed to see the classes they were adding. Tag classes are the perfect solution for what I wanted.

    Thank you very much for pointing me in the right direction!

    Moderator jordesign

    (@jordesign)

    Hey @tysoned – glad that helped out, it’s great news ??

    If that fully answers your question, we would love if you would mark this topic as resolved in the sidebar. This helps our volunteers find the topics that still need attention and more people will get helped, possibly like you did.

    Thread Starter tysoned

    (@tysoned)

    Done ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Style Posts Based on Custom Fields’ is closed to new replies.