Hide Category on Posts but not on Pages

Posted in: Newspaper
Post count: 114

Hello! I see in the Categories tab of the Theme panel that I am able to HIDE CATEGORY ON POST AND ON CATEGORY PAGES….but can I hide a category only on posts, but still have it visible on category pages? Is this possible with css? Thanks!

Post count: 20688

Hi,

Yes that could be possible. If you could provide more details about where exactly you want to hide it, I will try to give you a solution.

Thanks

Post count: 114

Ok, great! I’d like to hide the one category “Gallery” on all of the posts, and in the blocks. I want it to be visible on the category pages, and that is all…for it to be hidden everywhere else. Thanks!

Post count: 20688

Hi,

I can’t seem to be able to see a “Gallery” category on your website. I see a gallery page link in the top menu, but I cannot find a gallery category.
The option you mention in the theme panel simply removes the category tag you want, from posts and category pages. I thought you wanted to remove this tag only for posts.
For example you want to hide the “Get inspired” tag from this category page, and this post
https://www.screencast.com/t/7vs87LgzprL
https://www.screencast.com/t/Jx9vH23FCEw
That is the option you must select for that respective category. There is a way to hide the category tag only in the category page, with custom code.
Maybe I am misunderstanding this, please correct me.
For blocks you can control the category tag that is displayed on modules, by setting a primary category for the post
https://forum.tagdiv.com/primary-category/
Or you can disable the tag by module
https://forum.tagdiv.com/category-tag-on-modulesblocks/

Thanks

Post count: 114

Yes, I think there’s a misunderstanding. Let’s use the “Get Inspired” category as an example. I would like for the Get Inspired tag to show on the category page, but I do not want it to show on the post, or on any of the modules. So, for example, a post will have two categories: Get Inspired and Photography. I want it to display “Photography” but not Get Inspired. But if I go to the categories page, there will be a “Get Inspired” tag, and if I click on it, that post will be there. How can I do this? (By the way, I tried setting the primary category, but the post and modules will still show the other category that I don’t want displayed.)

Post count: 20688

Hi,

If a post has multiple categories, setting a primary category will ensure that it’s tag will be displayed on the modules.
For example this post has three categories
https://www.screencast.com/t/u35sP7044Gr7
By default the primary category will be the first one alphabetically, and it’s tag will be displayed
https://www.screencast.com/t/yM11UfwG
Setting a primary category like this
https://www.screencast.com/t/ei64KYdVy
Will make that primary category tag to be displayed for that post
https://www.screencast.com/t/2KnmNkCk
As per your example, you could try a code like this. This post has the “Get inspired” category, and the “Prose” category
https://www.screencast.com/t/ig8hcADV8
You would like to hide the “Get inspired” category just for the post, but it should not be hidden on the category pages
https://www.screencast.com/t/KbTkx24Hd
A code like this will work only on post pages and remove that category
https://www.screencast.com/t/CWPoqrrGuoX
If this is what is needed I will provide the code for the exact category.
This may be over-complicating things in regards of categories. The category structure should be clear and have a logic behind it. One should try not to hide posts from categories, or categories from posts.

Thanks

Post count: 114

Yes, this is what is needed. Please provide the code for the exact category: Gallery. Thanks!

Post count: 20688

Hi,

The code should be like the one below. Then the “Gallery” category tag will not be displayed on the posts, in the post page
Before – https://www.screencast.com/t/CCjoI3VWZKGl
After entering the code in Theme panel->Custom Css
https://www.screencast.com/t/Qs4hletLAA1Y
https://www.screencast.com/t/MsOGbPqoWv

.single
.td-post-title
.td-category
a[href*="gallery"]{
display: none;
}

Thanks

Post count: 114

Thanks for this code. This code makes the “Gallery” category not displayed on the posts in the post page…I also need for it to not be displayed in the blocks. For example, on the homepage, I am using Homepage Post and Block 5, and on the Blog page I am using Block 13…the category is still visible in all of these. Can you provide code that will make the “Gallery” category visible ONLY on the category page? Or code that will make it not visible in all of the blocks including the Homepage Post block? Thanks?

Post count: 20688

Hi,

I could give you a code for the modules as well. This will leave the posts without a category tag however.
This is the code and it should remove the gallery tag on all modules and the homepage post
https://www.screencast.com/t/B6qkTpKcvcXG
https://www.screencast.com/t/OlZ9ShIC
https://www.screencast.com/t/obpvkdAL

.td-post-template-8
a[href*="gallery"]{
display: none;
}
.td_module_wrap
a[href*="gallery"]{
display: none;
}

Thanks

Post count: 114

Hello! Thanks for this code. I notice that it does remove the “Gallery” tag on all of the posts, but it unfortunately also removes all of the tags. For example, this post (http://e50.4da.myftpupload.com/day-3-of-spring-2016-new-york-fashion-weeks-most-inspiring/) is in the categories Gallery (which is hidden), Get Inspired, and Music. However, no categories show in Block 5 on the homepage here: http://e50.4da.myftpupload.com/. Can we block just the Gallery tag, and not all of the other categories? Thanks!

Post count: 20688

Hi,

Yes that post belongs to those three categories. But the category tag displayed on the module will be only one, that of the primary category of the post. By default the primary category is the first one alphabetically.
Without the code this is how that post is displayed on the block
https://www.screencast.com/t/bzCg8Oli
You wanted to hide the Gallery tag on the module, the code does that. Like I previously mentioned, if a post has multiple categories you can control which category tag will appear on blocks by manually setting a primary category
For example this post has three categories
https://www.screencast.com/t/8ao6NkRfd
Without setting a primary category manually, the first one alphabetically is displayed
https://www.screencast.com/t/YUNMwHg0
Setting a primary category has this result
https://www.screencast.com/t/1Y8vqSFyZ3JG
https://www.screencast.com/t/bb0WQ0hqHrXd
The post will still be part of those categories, but the tag displayed in the one you choose.
The module only picks the primary category tag, hiding the Gallery tag will not make one of the other category tags to display
https://www.screencast.com/t/U3m0hVvtA

Thanks

Post count: 114

Thanks for explaining all of this so thoroughly. There is just one problem…when I assign “primary categories” for all of the posts which have multiple categories, then when I go to the categories page, the block only displays tags of the primary category. So for example, on the categories page, when you are looking at the Music category (http://e50.4da.myftpupload.com/category/music/), you see that the post “Nashville music’s John Mays gives his thoughts on showing creativity” shows only it’s primary category tag “Prose.” So it looks like it’s in the wrong place…a Prose article on the Music page.

I notice that when a post with multiple categories has NOT been assigned a primary category, then its tag follows the category page. For example, this post (http://e50.4da.myftpupload.com/this-weeks-featured-artist-tim-carr-talks-photography-and-24-hours-in-havana/) is in categories: Gallery, Get Inspired, Making a Difference, Photography, and Prose. The Gallery tag is blocked, using your code. (Thank you!) There has NOT been a primary category assigned to this post. So when you go to the Get Inspired category page (http://e50.4da.myftpupload.com/category/get-inspired/), the tag on the article shows “Get Inspired”. When you go to the Making A Difference category page (http://e50.4da.myftpupload.com/category/making-a-difference/), the tag on the article shows “Making A Difference”. And so on with the Photography category page (http://e50.4da.myftpupload.com/category/photography/) and the Prose category page (http://e50.4da.myftpupload.com/category/prose/). So the article looks like it’s in the right place…it shows the tag of the category page that it’s on.

How can we fix this? How can we make each article NOT show the Gallery tag (and I am happy to choose a primary category for each article) but still show the appropriate tags on each category page? Thanks so much!

Post count: 20688

Hi,

I believe this is over complicating things when there is no need to do it. That is why it is always best to create a clear and organized category structure, and do not resort to code customization to hide categories when possible.
By default on the category page, there will be displayed posts that are part of that category only, or among other categories including that one (reflecting in the displayed tag as well – this will be related to the category page currently in view). That is the way it works.
Setting a primary category will override the default behavior on the whole website, including the category pages. There is no other setting available in the theme in this matter. Except the one that allows you to hide a category tag on posts and category pages.
I cannot think of a way to display the category tag you want, while hiding the default category of a post, and not using a primary category. Maybe you should rethink the category tree, and make changes based on the available options. Maybe that will be more useful in the future as well, when these modifications may not work anymore.

Thanks

Post count: 114

Simion, I can see that you think I am over complicating things. However, if you look closely, I think you will see that I am trying to make things more simple on this website. I would like to have a gallery where visitors can see all of the posts, and then sort posts by categories. I know that this is possible with this theme through adding an Ajax filter to one of the blocks. However, then there is a separate design/layout when the visitor clicks on a category which brings them to a different category page. Having these two page designs – one with a block and ajax filter, and the other the theme’s standard category page – is confusing to a visitor, in my view. So I would like to make things more simple, having only one gallery where all of the posts are visible and sorted by category, and the category tags linking to this gallery. One way to achieve this would involve putting all of the posts into one additional category (Gallery) and then blocking that category designation from being seen in posts and blocks. You can see that this is what I have done (http://e50.4da.myftpupload.com/category/gallery/). I have linked my Gallery menu item to the Gallery category page where visitors can see all of the posts, and then search according to category. Now whenever anyone wants to click on a category tag, they will be brought to one central gallery that is navigable by categories. **The only problem is the one that I outlined above…in using the code you provided and setting primary categories, the category tags are no longer consistent. I can think of a few solutions: I can see in the Theme Panel that the theme offers the option to HIDE CATEGORY ON POST AND ON CATEGORY PAGES; is it possible to separate these into two different options? Then I could hide the category on posts, and it would still remain on the category pages. Secondly, we could find a way to block the “Gallery” tag without it clearing the category tag altogether, perhaps allowing the next alphabetical category tag to show. Finally, we could find some way to block the Gallery tag without choosing a primary category. I could also go a different route, and set up a Gallery page with a block and ajax filter, and then we could link the category tags to route to the individual category pages within the ajax filter of the block. Any of these solutions would be quite helpful. If you have another idea on how I can reach this goal, I am most grateful. Thanks for your continued efforts to get this correct.

Post count: 20688

Hi,

Yes that option hides the category tag on both posts and category pages. If you enable it, the respective category will not be displayed in both locations. Try enabling it and then modify this file from the theme
https://www.screencast.com/t/o8Hexr97jzt
Like this for example
https://www.screencast.com/t/nlrXsezm
Now that that hidden category tag will remain hidden on posts, and it should display on the category pages.
For the modules it is not easy to do what you want. Changes to these modules will affect all the website. Their default behavior is to get the main category of a post, or the primary one that overrides this. If you would like them to exclude a certain category tag while displaying the post, and display a different category without setting a primary category, it will have to be made custom. I suggest you consider hiring a freelancer or developer to make these modifications, because we cannot provide this level of custom work at the moment, sorry.
Or think of a simpler way to achieve something like this, using the default category and block settings
https://forum.tagdiv.com/block-settings-guide/

Thanks

Viewing 16 posts - 1 through 16 (of 16 total)
The forum ‘Newspaper’ is closed to new topics and replies.