1. April Fools Day Sale starting today through Sunday April 2nd.
    $15 discount on all licenses. $10 discount on 1 year support/downloads extensions.
  2. REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Display/Hide custom fields in specified category/categories in article views

Discussion in 'Showcase Support' started by David Pugh, Aug 11, 2017.

  1. David Pugh

    David Pugh New Member Showcase

    I can see how to set up the options so that custom fields are displayed in article views.

    upload_2017-8-12_1-7-42.png

    Our requirement is to display different custom fields for categories groups.

    At the moment, I see a few options:
    • Use different custom fields for each category. This can be cumbersome, if you want to use these fields in Advanced search with the need to display multiple slightly varying fields.
    • Setup so that each custom field is displayed and then use <style></style> tags in the category description to hide unwanted customer fields ie. <style>dl.customShowcaseFieldiddblatin{display:none !important}</style>. This works, but the text within the style tags is displayed in the tooltip for the area whilst hovering over.
    • upload_2017-8-12_1-27-49.png
    Is there another way of achieving this?
     
  2. Bob

    Bob Developer Staff Member

    You should use Extra.css for this instead. That is what Extra.css is designed for.

    You'll need to add a few more CSS selectors tho to fine tune it to make sure the results are only being hidden where you want them to instead of everywhere.

    example... if you are using Article View layout, you'd want to do something like this:

    Code:
    .showcaseItem .showcaseItemFieldsArticleViewDesc .display_on_list .customShowcaseFieldtab2_field3 {display:none !important;}
    Hope that makes sense.
     
  3. David Pugh

    David Pugh New Member Showcase

    Correct me if I am am wrong, but using extra.css will apply to all categories.

    I am trying to be more specific and show fields on individual categories.

    In other words:

    On Category abc1 shows custom field abc
    On Category abc2 hides custom field abc
     
  4. Bob

    Bob Developer Staff Member

    Each piece of content is in an li element that has several classes to include class item ID and Category ID. You can use the CATEGORY ID as a CSS selector via .showcaseCategory-[category_id] eg, .showcaseCategory-10

    This would hide this field if the item was in Category ID 10. NOTE: when you are using multiple selectors in the same element, they need to be joined eg.. .showcaseItem and .showcaseCategory-10 are in the same li tab, so you need to JOIN them like this .showcaseItem.showcaseCategory-10

    Code:
    .showcaseItem.showcaseCategory-10 .showcaseItemFieldsArticleViewDesc .display_on_list .customShowcaseFieldtab2_field3 {display:none !important;}
    
    Selection_999(006).png
     
  5. David Pugh

    David Pugh New Member Showcase

    Brilliant thank you! I hadn't not noticed that.

    That will work fine.
     
    Bob likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.