Files
wordpress-theme-aksrt/templates/parts/content-post-card.php
T

32 lines
1.1 KiB
PHP

<?php
/**
* Post card wrapper for the unified renderer.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$args = isset($args) && is_array($args) ? $args : [];
$forced_layout = (string) get_query_var('aksrt_post_card_layout', '');
$mode = 'card';
if (in_array($forced_layout, ['card', 'list', 'grid-cms'], true)) {
$mode = $forced_layout;
} elseif (!empty($args['mode']) && in_array($args['mode'], ['card', 'list', 'grid-cms', 'mini'], true)) {
$mode = (string) $args['mode'];
} elseif (function_exists('aksrt_get_post_flow') && aksrt_get_post_flow(get_the_ID()) === 'cms') {
$mode = 'grid-cms';
} elseif (class_exists('\AKSRT\Settings\Settings')) {
$archive_layout = \AKSRT\Settings\Settings::get_archive_layout();
$mode = in_array($archive_layout, ['card', 'list', 'grid-cms'], true) ? $archive_layout : 'card';
}
$scene = (string) get_query_var('aksrt_post_card_scene', '');
$context = ($scene === 'home' || is_front_page() || (is_home() && !is_paged())) ? 'home' : 'archive';
echo aksrt_render_post(array_merge($args, [
'mode' => $mode,
'context' => $context,
])); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped