Site logo

[Resolved] How to remove several elements on single post for specific category

Home Forums Support [Resolved] How to remove several elements on single post for specific category

Home Forums Support How to remove several elements on single post for specific category

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2533334
    mkjj

    I know this sounds absolutely stupid, but this is what my customers wants: I have to remove several elements from single posts of a specific category: title, featured image, date, category link and navigation. I’m not quite sure what would be best practice in this case.

    I could use quick and dirty CSS, but I don’t like this approach.
    I could use a layout element. This works fine for title and featured image, but not for date, category link and navigation (next/previous post).
    I could create a custom template. That would do the trick, but I usually avoid modifications of template files. More often than not, GP provides a much better way (a hook, for example).

    Any help would be very appreciated. Thank you!

    Mike

    #2533511
    Ying
    Staff
    Customer Support

    Hi Mike,

    You can try this filter:
    https://docs.generatepress.com/article/option_generate_blog_settings/

    Or you can create ablock element - post meta template to define a specific post meta template for certain category.
    https://docs.generatepress.com/article/block-element-post-meta-template/

    #2533718
    mkjj

    Hi Ying,
    thank you very much. option_generate_blog_settings would effect the archive page, not the single post, right? Sounds very powerful, but will probably not do the trick here.

    The block element - post meta template seems a great option. Unfortunately, I usually disable the block editor. I’m not a big fan of that thing. 🙂

    I think, I will go the CPT route using a customized template.

    It’s always amazing to see how many features GP provides. But sometimes it needs the good old custom template. 🙂

    Thanks again,
    Mike

    #2534486
    Ying
    Staff
    Customer Support

    you are welcome 🙂

    option_generate_blog_settings works for the single post as well, if you scroll down you can see the single options, eg:
    https://docs.generatepress.com/article/option_generate_blog_settings/#options-%E2%80%98single_date%E2%80%99

    #2534495
    mkjj

    Yikes! I should read more carefully. This is awesome! The code snippet gives me all the options that I need. Beautiful! 🙂
    Thank you very much. You never cease to surprise me!

    Mike

    #2534552
    Ying
    Staff
    Customer Support

    Glad to hear that 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.