70 lines
2.3 KiB
PHP
70 lines
2.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Список игр.
|
|
*/
|
|
function gamelist($atts){
|
|
$nominations = array(
|
|
'main' => 'Основная номинация',
|
|
'translations' => 'Переводы',
|
|
'unranked' => 'Вне конкурса'
|
|
);
|
|
|
|
$a = shortcode_atts( array(
|
|
'category' => 'КРИЛ '.date('Y'),
|
|
), $atts );
|
|
$category = $a['category'];
|
|
|
|
$retval = '';
|
|
$args = array(
|
|
'numberposts' => -1,
|
|
'post_status' => 'publish',
|
|
'post_type' => 'game',
|
|
'meta_key' => 'nomination',
|
|
);
|
|
foreach ($nominations as $nomination => $name) {
|
|
$i = 1;
|
|
// $args['category'] = $category;
|
|
$args['meta_value'] = $nomination;
|
|
$the_query = new WP_Query($args);
|
|
if( $the_query->have_posts() ) {
|
|
while( $the_query->have_posts() ) {
|
|
$the_query->the_post();
|
|
$retval .= '<h2 class="nNomination">'.$name.'</h2>';
|
|
$retval .= '<div class="games">';
|
|
if ($i > 1) {
|
|
$retval .= '<hr class="kril">';
|
|
}
|
|
$retval .= '<div class="nKrilGame">';
|
|
$retval .= '<div class="nGameHeader">';
|
|
$retval .= '<div class="nGameName">'.
|
|
'<a name="game-'.$nomination.'-'.$i.'"></a>'.get_the_title().
|
|
'</div>';
|
|
$retval .= '<div class="nMeta">';
|
|
$retval .= '<p><span class="sr-only">Авторы:</span><span class="nAuthors">'.get_field('authors').'</span></p>';
|
|
$retval .= '</div></div>'.
|
|
'<div class="nGameInfo">'.
|
|
'<div class="nGamePic">'.get_the_post_thumbnail().'</div>';
|
|
$retval .= '<div class="nGameDescr"><p>'.get_the_content().'</p>';
|
|
$retval .= '<p><strong>Платформа:</strong> '.get_field('platform').'</p>';
|
|
$online = get_field('link_online');
|
|
$offline = get_field('link_offline');
|
|
if (!empty($online) || !empty($offline)) {
|
|
$retval .= '<div class="nLinks">';
|
|
if (!empty($online)) {
|
|
$retval .= '<a href="'.get_field('link_online').'" target="_blank">Играть онлайн</a>';
|
|
}
|
|
if (!empty($offline)) {
|
|
$retval .= '<a href="'.get_field('link_offline').'" target="_blank">Скачать архив</a>';
|
|
}
|
|
$retval .= '</div>';
|
|
}
|
|
$retval .= '</div></div>';
|
|
$i++;
|
|
}
|
|
$retval .= '</div>';
|
|
}
|
|
}
|
|
return $retval;
|
|
}
|