Answer the question
In order to leave comments, you need to log in
How to display a category in a specific block in wordpress?
Hello. The site implemented the display of records with a certain category in a separate block on the main page.
Category - "top" was displayed in a container at the top of the page. After updating to the latest wp, the output stopped working.
Here is the code I found for this category.
home-page.php file
<?php $data = PostService::getPostsForTag('top', 3, ['excerpt_length' => 120]); ?>
<?php foreach ($data as $post) : ?>
<?php get_template_part('template-parts/bigtile', 'post'); ?>
<?php endforeach; ?>
How can I solve the problem?
Answer the question
In order to leave comments, you need to log in
The PostService class that receives posts from you is something not related to WordPress, something self-made.
Find where this class is declared - and there in the getPostsForTag method you can already see what is broken.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question