Archived topic
how to hide blog post?
8 replies · Started by jisu on October 6, 2022
Hi,
Is it possible to hide blog post but still have valid urls? I want to use the post in our ios app.
Also, i have set the blog post padding but can i set or delete in specific blog post?
here is the link
https://swim.im/mobile-app-test/2382/
Hi Jisu,
I'm not getting the full grasp of what you're trying to do. May you expound a bit more and provide an example of what you're trying to do?
How can i exclude my post from blog page? https://www.swim.im/blog
i just need a url of a post but now show on my blog page.
and also how can i exclude channel.io plugin in certain page?
I see. Are you planning to exclude all posts or just specific posts? If it's all posts, what should you Blog page look like.
With regards to Channel.io, how are you adding that currently?
specific post.
I see.
Try adding this code:
function excludePostId($query) {
$postIds = array(
66
);
if ( $query->is_home() && $query->is_main_query() ) {
set_query_var('post__not_in', $postIds);
}
}
add_action('pre_get_posts', 'excludePostId');
Replace 66 with the ID of the post.
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
If you want to hide it in archive pages and search pages as well, we'll need to modify that code. Let us know.
Thank you for the reply. is it possible to hide whole category?
and where do i add this code?
Hi there,
see my reply here: