• This image shows 3 categories Adventure, health & safety and Innovation. so want to set only 2 categories. so please help to set this limit also I want separate categories. this block was created to loop template.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Did you develop this block yourself? Or does it belong to your theme or a plugin?

    The solution depends on how the terms were retrieved. If WP_Term_Query is somehow involved, you could use the 'number' arg to limit the number of terms returned.

    If you want to separate each term into its own button, ideally each term would occur within its own div so each could be more easily styled separately.

    If you did not develop this block yourself, I suggest asking its developer for guidance through their dedicated support channel.

    “so want to set only 2 categories.”

    This leads to questions:

    – Should this requirement be enforced in the WP backend?
    – What about posts already published with more than 2 categories?
    – Are you only concerned with limiting the *display* of categories in just the component you screenshotted?
    – If so, how do you want to determine which categories get thrown out if there are more than 2? Alphabetical order? Something else?

    If so, the posts would still display in the category archives in all categories assigned, even if some of them are hidden in the screenshotted component.

    “also I want separate categories”

    This sounds like a markup/styling question. What’s the code used to output what’s currently there? Just need to separate each category into its own element.

    The block that controls the output of the categories apparently comes from the HappyAddons plugin. I would recommend contacting their support with your request: https://happyaddons.com/happy-support/

    Thread Starter nikunj125

    (@nikunj125)

    Thanks for your response. threadi you are right the block is comes from happy addons plugin. i will contact them thanks so much everyone for your reply .

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Set post category limit’ is closed to new replies.