search results in three columns
This commit is contained in:
parent
9110bfe34d
commit
003f3443b2
18
archive.php
18
archive.php
|
@ -25,7 +25,7 @@ else:
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<main>
|
<main>
|
||||||
<?php
|
<?php
|
||||||
// https://codex.wordpress.org/Conditional_Tags
|
// https://codex.wordpress.org/Conditional_Tags
|
||||||
|
@ -33,11 +33,11 @@ endif;
|
||||||
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
||||||
get_template_part( 'template-parts/section', 'resources', array( 'post_per_page' => '10' ) );
|
get_template_part( 'template-parts/section', 'resources', array( 'post_per_page' => '10' ) );
|
||||||
elseif ( is_category( 'news' ) ):
|
elseif ( is_category( 'news' ) ):
|
||||||
// get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => 'news', 'post_per_page' => '3' ) );
|
$thiscategoryname = esc_html( get_the_category()[0]->name );
|
||||||
get_template_part( 'template-parts/section', 'categoryposts', array( 'post_per_page' => '3' ) );
|
get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => $thiscategoryname,'post_per_page' => '3' ) );
|
||||||
elseif ( is_category( '' ) ):
|
elseif ( is_category( '' ) ):
|
||||||
get_template_part( 'template-parts/section', 'categoryposts', array('post_per_page' => '6' ) );
|
$thiscategoryname = esc_html( get_the_category()[0]->name );
|
||||||
|
get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => $thiscategoryname,'post_per_page' => '6' ) );
|
||||||
else :
|
else :
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -63,17 +63,9 @@ endif;
|
||||||
</nav>
|
</nav>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
endif;//end if is archive_resource
|
endif;//end if is archive_resource
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php get_footer();
|
<?php get_footer();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -69,10 +69,10 @@ main {
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// category view and news
|
// category view, news, search results
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
.category-posts,.archive-posts {
|
.category-posts,.archive-posts,.search-results {
|
||||||
@include xy-grid;
|
@include xy-grid;
|
||||||
header,main,aside {
|
header,main,aside {
|
||||||
@include breakpoint(small){
|
@include breakpoint(small){
|
||||||
|
@ -168,8 +168,18 @@ main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.search-results {
|
||||||
// end category-posts
|
article {
|
||||||
|
main {
|
||||||
|
.search-results-elements {
|
||||||
|
h1,h2,h3,h4,h5,h6 {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// end category view, news, search results
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -205,7 +215,7 @@ main {
|
||||||
aside {
|
aside {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end news & resources category
|
// end collections category
|
||||||
|
|
||||||
//
|
//
|
||||||
// partners
|
// partners
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The search template file
|
||||||
|
*
|
||||||
|
* This is the most generic template file in a WordPress theme
|
||||||
|
* and one of the two required files for a theme (the other being style.css).
|
||||||
|
* It is used to display a page when nothing more specific matches a query.
|
||||||
|
* e.g., it puts together the home page when no home.php file exists.
|
||||||
|
*
|
||||||
|
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
|
||||||
|
*
|
||||||
|
* @package arcHIVE-theme
|
||||||
|
* @since arcHIVE-theme 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
get_header(); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<article>
|
||||||
|
<main>
|
||||||
|
<section class="search-results-elements">
|
||||||
|
<header>
|
||||||
|
<h4>search results for:</h4>
|
||||||
|
<h2>
|
||||||
|
<span class="search-query-terms">
|
||||||
|
<?php echo get_search_query( ); ?>
|
||||||
|
</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
|
||||||
|
<main class="">
|
||||||
|
<?php if ( have_posts() ) : ?>
|
||||||
|
<?php while ( have_posts() ) : the_post(); ?>
|
||||||
|
<article class="">
|
||||||
|
<?php if ( has_post_thumbnail() ) :?>
|
||||||
|
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
|
||||||
|
<figure style="background-image: url(<?php echo get_the_post_thumbnail_url();?>);">
|
||||||
|
</figure>
|
||||||
|
</a>
|
||||||
|
<?php else :?>
|
||||||
|
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
|
||||||
|
<figure style="background-image: url(<?php echo catch_post_first_image();?>);">
|
||||||
|
</figure>
|
||||||
|
</a>
|
||||||
|
<?php endif;?>
|
||||||
|
<h5 class="date">
|
||||||
|
<?php the_date('d.m.Y');?>
|
||||||
|
</h5>
|
||||||
|
<h3 class="entry-title">
|
||||||
|
<a href="<?php the_permalink(); ?>" rel="bookmark">
|
||||||
|
<?php the_title(); ?>
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
<section class="excerpt post-excerpt">
|
||||||
|
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
|
||||||
|
<?php the_excerpt() ?>
|
||||||
|
</a>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
<?php endwhile;//end of the loop ?>
|
||||||
|
</main>
|
||||||
|
<?php //pagination here ?>
|
||||||
|
<aside>
|
||||||
|
<nav>
|
||||||
|
<!--a href="" class="button hollow">see more news</a-->
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
<?php wp_reset_postdata(); ?>
|
||||||
|
<?php else : //if no post in query ?>
|
||||||
|
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</article>
|
||||||
|
<?php get_footer();
|
|
@ -69,10 +69,10 @@ main {
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// category view and news
|
// category view, news, search results
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
.category-posts,.archive-posts {
|
.category-posts,.archive-posts,.search-results {
|
||||||
@include xy-grid;
|
@include xy-grid;
|
||||||
header,main,aside {
|
header,main,aside {
|
||||||
@include breakpoint(small){
|
@include breakpoint(small){
|
||||||
|
@ -168,8 +168,18 @@ main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.search-results {
|
||||||
// end category-posts
|
article {
|
||||||
|
main {
|
||||||
|
.search-results-elements {
|
||||||
|
h1,h2,h3,h4,h5,h6 {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// end category view, news, search results
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -205,7 +215,7 @@ main {
|
||||||
aside {
|
aside {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end news & resources category
|
// end collections category
|
||||||
|
|
||||||
//
|
//
|
||||||
// partners
|
// partners
|
||||||
|
|
|
@ -12,14 +12,22 @@
|
||||||
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
||||||
// var_dump( $args ); //will display everythin imported from
|
// var_dump( $args ); //will display everythin imported from
|
||||||
// get_template_part( 'template-parts/section', 'category', array('category_name' => 'news', 'post_per_page' => '3' ) );
|
// get_template_part( 'template-parts/section', 'category', array('category_name' => 'news', 'post_per_page' => '3' ) );
|
||||||
// $thiscategory = $args['category_name'];
|
|
||||||
$howmanyposts = $args['post_per_page'];
|
$howmanyposts = $args['post_per_page'];
|
||||||
$thiscategory = esc_html( get_the_category()[0]->name );
|
$thiscategory = $args['category_name'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<section class="category-posts <?php echo $thiscategory;?> ">
|
<section class="category-posts <?php echo $thiscategory;?> ">
|
||||||
<header>
|
<header>
|
||||||
<h2><?php single_cat_title();?></h2>
|
<h2>
|
||||||
|
<?php
|
||||||
|
if ( is_category() ):
|
||||||
|
single_cat_title();
|
||||||
|
else:
|
||||||
|
echo $thiscategory;
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
|
</h2>
|
||||||
</header>
|
</header>
|
||||||
<main class="">
|
<main class="">
|
||||||
<?php $the_query = new WP_Query( array( 'category_name' => $thiscategory, 'posts_per_page' => $howmanyposts ) ); ?>
|
<?php $the_query = new WP_Query( array( 'category_name' => $thiscategory, 'posts_per_page' => $howmanyposts ) ); ?>
|
||||||
|
|
Loading…
Reference in New Issue