Site logo

Archived topic

Hide post in category

9 replies · Started by Jaime on July 2, 2018

Viewing posts 1–10 of 10

Appreciated

Have an excellent day

I need to hide the posts in the category files. I just want to see only the category page, without the related entries and paging-navigation.

Could you please supply me with a code for that purpose?

I was already exploring in the forum and I found this but I do not know how to accommodate my needs

add_filter('pre_get_posts', 'excludeCat');
function excludeCat($query) {
if ( $query->is_home ) {
$query->set('cat', '-3,-5,-23');
}
return $query;
}

First of all, Thanks

Hi there,

I'm not too sure what you mean. Are you wanting the page to display nothing when you go to a specific category?

Thanks tom

Please excuse my English

What I want to do hide the entries of the categories as in image No 2

It could be done with a plugin, but I would like to do it through code.

Thank you again

Img No 1

Image No 1

Img No 2

Image No 2

In all categories...

This CSS should work:

.category article {
    display: none;
}

Let me know :)

Hi Tom, I would like you not to be seen in the source code.

Would a solution in php be possible?

And hide also the page-numbers.

Although I think that if the entries are hidden by php, the page-numbers will not appear

Greetings and Thank you

In category.php remove the loop.

All prefect

Gives the query resolved

Thank you very much

You're welcome :)

This archived topic is closed to new replies.