T
T
Tim Nev2021-10-22 09:39:33
WordPress
Tim Nev, 2021-10-22 09:39:33

How to hide a category in "related articles"?

How to hide a specific category so that it does not appear in "related articles"? Wordpress, Newspaper theme.
Or.
How do I hide the "Related Articles" panel in a specific post?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-10-22
@aritim

There are 2 ways:
1. Create a separate template for a specific post. If this post is in posts, then connect the template via single.php and set exactly the same style for it (call it differently), but with display:none;.
2. Create the same style, name mystyle2 differently (again with display:none;). Next, paste the php code into the template. The principle is as follows: if a post with an id such and such, then display the style mystyle2 , otherwise mystyle1 .
Here's how I rendered another contact form 7 plugin form for a specific post:

<?php
if (is_single(3549) ) {
echo do_shortcode('[contact-form-7 id="3579" title="Заказать звонок"]'); // вместо do_shortcode('[contact-form-7 id="3579" title="Заказать звонок"]'); вставляете мойстиль2 в одинарных кавычках ''
} else { 
echo do_shortcode('[contact-form-7 id="220" title="Заказать звонок"]'); // вместо do_shortcode('[contact-form-7 id="220" title="Заказать звонок"]'); вставляете мойстиль1 в одинарных кавычках ''
   }?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question