Answer the question
In order to leave comments, you need to log in
How to infer instances of custom types in a wordpress template page?
Всем привет! Есть сайт на wordpress с установленным плагином Pods - Custom Content Types and Fields для вывода пользовательских постов. Создаю новый тип с именем test, в который добавляю текстовое поле test_text и создаю экземпляр этого типа уже с бокового меню.
Теперь у меня вопрос: как вывести экземпляры этих типов с полем на странице шаблона
<div><?php $text = pods('test');
echo $text->field('test_text');?></div>
Answer the question
In order to leave comments, you need to log in
in the required files (single.php, page.php, ...) I add to the cycle
Add. fields did Custom fields suite. and so read the corresponding api. in this case, I display two fields descript and file_upd, which are included in the zblock group, in the form of a tablet.
$loop = CFS()->get( 'zblock' );
if( is_array($loop))
{
echo "<table class='t1' ;> ";
foreach ( $loop as $row ) {
echo"<tr> ";
echo "<td style=width:15% >"." </td>";
echo "<td style=width:50% >". $row['descript']."</td>";
echo "<td style=width:35%>"."<a href=".$row['file_upd'].">Скачать</a>"."</td>";
echo"</tr>";
}
echo "</table>";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question