Skip to content

Commit

Permalink
Merge pull request #20 from creativecommons/dev
Browse files Browse the repository at this point in the history
Bugfixes & improvements on layout & styles
  • Loading branch information
hugosolar authored May 3, 2019
2 parents 84d87b2 + f969052 commit 4ffab3f
Show file tree
Hide file tree
Showing 52 changed files with 2,084 additions and 234 deletions.
70 changes: 65 additions & 5 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,36 @@
* @since Twenty Sixteen 1.0
*/

get_header(); ?>
get_header();
$search = new search_filter();
$the_search = isset($_GET['search']) ? esc_attr($_GET['search']) : '';
$the_month = isset($_GET['date_month']) ? esc_attr($_GET['date_month']) : '';
$the_year = isset($_GET['date_year']) ? esc_attr($_GET['date_year']) : '';
if (get_class(get_queried_object()) == 'WP_Post_Type') {
$search->set_post_type(get_queried_object()->name);
} else if (get_class(get_queried_object()) != 'WP_Term_Object') {
$search->set_post_type('any');
}
if ( get_query_var('paged') ) {
$search->set_page(get_query_var('paged'));
}
if ( isset($_GET['action']) ) {
if (isset($_GET['search'])) {
$search->set_search_text( $the_search ) ;
}
$date = array();
if ( isset($_GET['date_month'])) {
$date['month'] = $the_month;
}
if ( isset( $_GET['date_year'] ) ) {
$date['year'] = $the_year;
}
if ( !empty($date) ) {
$search->set_date($date);
}
}
$query = $search->search();
?>

<div id="primary" class="content-area">
<div id="wrapper-main" class="wrapper-main">
Expand All @@ -27,8 +56,36 @@
}
?>
</div>
<div class="filter-form">
<form action="" method="GET">
<div class="filter-row">
<div class="item search-description">
<h5>Filter</h5>
</div>
<div class="item search-key">
<input type="text" placeholder="Keyword" value="<?php echo $the_search; ?>" class="input-type" name="search">
</div>
<div class="item search-month">
<?php echo $search->get_months_select(array(
'name' => 'date_month',
'class' => 'input-type'
), $the_month); ?>
</div>
<div class="item search-year">
<?php echo $search->get_years_select(array(
'name' => 'date_year',
'class' => 'input-type'
), $the_year); ?>
</div>
<div class="item search-button">
<input type="submit" class="button secondary" value="Search">
<input type="hidden" name="action" value="send">
</div>
</div>
</form>
</div>
<main id="main" class="site-main" role="main">
<?php if (have_posts()) : ?>
<?php if ($query->have_posts()) : ?>

<header class="page-header">
<?php
Expand All @@ -38,10 +95,11 @@
</header><!-- .page-header -->
<?php get_template_part('template-parts/sidebar/sidebar','content-above-mobile'); ?>
<?php get_template_part('template-parts/sidebar/sidebar','content-above'); ?>
<div class="grid-container total-cols-2">
<?php
// Start the Loop.
while (have_posts()) :
the_post();
while ($query->have_posts()) :
$query->the_post();

/*
* Include the Post-Format-specific template for the content.
Expand All @@ -51,7 +109,9 @@
get_template_part('template-parts/content', get_post_format());

// End the loop.
endwhile;
endwhile;?>
</div>
<?php

// Previous/next page navigation.
the_posts_pagination(
Expand Down
80 changes: 67 additions & 13 deletions category.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,36 @@
* @since Twenty Sixteen 1.0
*/

get_header(); ?>
get_header();
$search = new search_filter();
$the_search = isset($_GET['search']) ? esc_attr($_GET['search']) : '';
$the_month = isset($_GET['date_month']) ? esc_attr($_GET['date_month']) : '';
$the_year = isset($_GET['date_year']) ? esc_attr($_GET['date_year']) : '';
if (get_class(get_queried_object()) == 'WP_Post_Type') {
$search->set_post_type(get_queried_object()->name);
} else if (get_class(get_queried_object()) != 'WP_Term_Object') {
$search->set_post_type('any');
}
if ( get_query_var('paged') ) {
$search->set_page(get_query_var('paged'));
}
if ( isset($_GET['action']) ) {
if (isset($_GET['search'])) {
$search->set_search_text( $the_search ) ;
}
$date = array();
if ( isset($_GET['date_month'])) {
$date['month'] = $the_month;
}
if ( isset( $_GET['date_year'] ) ) {
$date['year'] = $the_year;
}
if ( !empty($date) ) {
$search->set_date($date);
}
}
$query = $search->search();
?>

<div id="primary" class="content-area">
<div id="wrapper-main" class="wrapper-main">
Expand All @@ -27,8 +56,36 @@
}
?>
</div>
<div class="filter-form">
<form action="" method="GET">
<div class="filter-row">
<div class="item search-description">
<h5>Filter</h5>
</div>
<div class="item search-key">
<input type="text" placeholder="Keyword" value="<?php echo $the_search ?>" class="input-type" name="search">
</div>
<div class="item search-month">
<?php echo $search->get_months_select(array(
'name' => 'date_month',
'class' => 'input-type'
), $the_month); ?>
</div>
<div class="item search-year">
<?php echo $search->get_years_select(array(
'name' => 'date_year',
'class' => 'input-type'
), $the_year); ?>
</div>
<div class="item search-button">
<input type="submit" class="button secondary" value="Search">
<input type="hidden" name="action" value="send">
</div>
</div>
</form>
</div>
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php if ( $query->have_posts() ) { ?>

<header class="page-header">
<?php
Expand All @@ -39,11 +96,11 @@

<?php get_template_part( 'template-parts/sidebar/sidebar','content-above-mobile' ); ?>
<?php get_template_part( 'template-parts/sidebar/sidebar','content-above' ); ?>

<div class="grid-container total-cols-2">
<?php
// Start the Loop.
while ( have_posts() ) :
the_post();
while ( $query->have_posts() ) :
$query->the_post();

/*
* Include the Post-Format-specific template for the content.
Expand All @@ -53,8 +110,9 @@
get_template_part( 'template-parts/content', get_post_format() );

// End the loop.
endwhile;

endwhile; ?>
</div>
<?php
// Previous/next page navigation.
the_posts_pagination(
array(
Expand All @@ -65,17 +123,13 @@
);

// If no content, include the "No posts found" template.
else :
} else {
get_template_part( 'template-parts/content', 'none' );

endif;
}
?>
</main><!-- .site-main -->
<?php get_template_part( 'template-parts/sidebar/sidebar','content-bottom' ); ?>
</div>
<div id="wrapper-sidebar" class="wrapper-sidebar">
<?php get_sidebar(); ?>
</div>
</div><!-- .content-area -->

<?php get_footer(); ?>
Loading

0 comments on commit 4ffab3f

Please sign in to comment.