Answer the question
In order to leave comments, you need to log in
How to properly use get_template_part('',''); again?
An example of calling get_... on the main page.
<div class="prices">
<?php get_template_part('content','table'); ?>
<div class="row"> ...
Ripped a couple of pieces off the main page to use on other pages with get_template_part('content', '...'); on the main page, these inserts are displayed correctly, on other pages they are displayed half-empty, for example, the table on the main one works fine, but when reused, the table is there, but there is no text inside. The table, like other elements, is filled with Advanced Custom Fields and I think that this is the problem. I tried to use get for elements that do not use this plugin, they are duplicated as they should.
Answer the question
In order to leave comments, you need to log in
Most likely, on the "main page" the get_template_part function was called in the context of the so-called "main loop" - the "while" loop, inside which, in particular, data is prepared for those parts of the template that you want to load. It looks something like this:
if (have_posts()) :
while (have_posts()) :
// Функция, которая подготавливает основные данные
the_post();
// Где-то здесь подключаются части шаблона
get_template_part();
endwhile;
endif;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question