101 lines
2.5 KiB
PHP
101 lines
2.5 KiB
PHP
<?php
|
|
get_header();
|
|
global $photocore;
|
|
?>
|
|
|
|
<div id="primary" class="content-area">
|
|
<main id="main" class="site-main">
|
|
|
|
<div class="single-page">
|
|
<div class="page-header medium-container">
|
|
<div class="label">
|
|
<?php _e('Search Results For', 'yuzu'); ?>
|
|
</div>
|
|
<h1 class="page-title">"<?= get_search_query(); ?>"</h1>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="search-results large-container top-and-bottom-margin">
|
|
<?php
|
|
if ( have_posts() ) {
|
|
/* Start the Loop to check what's in the results */
|
|
if (have_posts()) {
|
|
while (have_posts()) : the_post();
|
|
if(get_post_type() == "post") {
|
|
$post_exists = true;
|
|
}
|
|
if(get_post_type() == "meow_collection") {
|
|
$collection_exists = true;
|
|
}
|
|
if(get_post_type() == "attachment") {
|
|
$attachment_exists = true;
|
|
}
|
|
endwhile;
|
|
}
|
|
}
|
|
if($post_exists) { ?>
|
|
<div class="mwt-section-header">
|
|
<h3><?php _e('Articles', 'yuzu'); ?></h3>
|
|
<div class="line"></div>
|
|
</div>
|
|
<div class="articles-list">
|
|
<?php
|
|
$count = 0;
|
|
while (have_posts()) : the_post();
|
|
if(get_post_type() == "post") {
|
|
require get_template_directory() . '/components/article-cards/small-article-card.php';
|
|
}
|
|
if($count == 2) {
|
|
$count = 0;
|
|
} else {
|
|
$count++;
|
|
}
|
|
endwhile;
|
|
?>
|
|
</div>
|
|
<?php
|
|
}
|
|
if($collection_exists) { ?>
|
|
<div class="mwt-section-header">
|
|
<h3><?php _e('Collections', 'yuzu'); ?></h3>
|
|
<div class="line"></div>
|
|
</div>
|
|
<div class="collections-list">
|
|
<?php
|
|
while (have_posts()) : the_post();
|
|
if(get_post_type() == "meow_collection") {
|
|
$collection = $photocore->get_collection($post->ID);
|
|
require get_template_directory() . '/components/collection-card.php';
|
|
}
|
|
endwhile;
|
|
?>
|
|
</div>
|
|
<?php
|
|
}
|
|
if($attachment_exists) { ?>
|
|
<div class="mwt-section-header">
|
|
<h3><?php _e('Images', 'yuzu'); ?></h3>
|
|
<div class="line"></div>
|
|
</div>
|
|
<div class="attachments-list">
|
|
<?php
|
|
while (have_posts()) : the_post();
|
|
if(get_post_type() == "attachment") {
|
|
$ids_array[] = $post->ID;
|
|
}
|
|
endwhile;
|
|
$ids = implode(',',$ids_array);
|
|
echo do_shortcode('[gallery mgl-layout="default" ids="'.$ids.'"]');
|
|
?>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
</main>
|
|
</div>
|
|
|
|
<?php
|
|
get_footer();
|