<?php get_header(); ?>
<section id="content" <?php Avada()->layout->add_class( 'content_class' ); ?> <?php Avada()->layout->add_style( 'content_style' ); ?>>
<?php get_template_part( 'templates/blog', 'layout' ); ?>
</section>
<?php do_action( 'avada_after_content' ); ?>
<?php get_footer(); ?>
$status = 0;
$stmt = $pdo->prepare("SELECT categories.name, tovar.status, tovar.created_at, tovar.categories_id
FROM tovar
LEFT JOIN categories c ON (tovar.categories_id = c.id)
LEFT JOIN categories pc ON (c.parent_id = pc.id)
WHERE tovar.status = :status ORDER BY tovar.created_at DESC");
$stmt->execute(array(':status' => $status));
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
print_r($row);
}
$status = 0;
$stmt = $pdo->prepare("SELECT categories.name, tovar.status, tovar.created_at, tovar.categories_id
FROM tovar
LEFT JOIN categories c ON (tovar.categories_id = c.id)
LEFT JOIN categories pc ON (c.parent_id = pc.id)
WHERE tovar.status = :status ORDER BY tovar.created_at DESC");
$stmt->execute(array(':status' => $status));
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
print_r($row);
}
Похоже что я придумал. Спасибо.