search results in three columns
This commit is contained in:
parent
9110bfe34d
commit
003f3443b2
80
archive.php
80
archive.php
|
@ -25,55 +25,47 @@ else:
|
|||
endif;
|
||||
?>
|
||||
|
||||
<article>
|
||||
<main>
|
||||
<?php
|
||||
// https://codex.wordpress.org/Conditional_Tags
|
||||
if ( is_post_type_archive ( 'archive_resource' ) ) :
|
||||
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
||||
get_template_part( 'template-parts/section', 'resources', array( 'post_per_page' => '10' ) );
|
||||
elseif ( is_category( 'news' ) ):
|
||||
// get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => 'news', 'post_per_page' => '3' ) );
|
||||
get_template_part( 'template-parts/section', 'categoryposts', array( 'post_per_page' => '3' ) );
|
||||
elseif ( is_category( '' ) ):
|
||||
get_template_part( 'template-parts/section', 'categoryposts', array('post_per_page' => '6' ) );
|
||||
<article>
|
||||
<main>
|
||||
<?php
|
||||
// https://codex.wordpress.org/Conditional_Tags
|
||||
if ( is_post_type_archive ( 'archive_resource' ) ) :
|
||||
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
||||
get_template_part( 'template-parts/section', 'resources', array( 'post_per_page' => '10' ) );
|
||||
elseif ( is_category( 'news' ) ):
|
||||
$thiscategoryname = esc_html( get_the_category()[0]->name );
|
||||
get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => $thiscategoryname,'post_per_page' => '3' ) );
|
||||
elseif ( is_category( '' ) ):
|
||||
$thiscategoryname = esc_html( get_the_category()[0]->name );
|
||||
get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => $thiscategoryname,'post_per_page' => '6' ) );
|
||||
else :
|
||||
?>
|
||||
|
||||
<?php if ( have_posts() ) :
|
||||
// Start the Loop
|
||||
while ( have_posts() ) : the_post();
|
||||
get_template_part( 'template-parts/content', get_post_format() );
|
||||
endwhile;
|
||||
else :
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
endif; // End have_posts() check.
|
||||
?>
|
||||
|
||||
<?php if ( have_posts() ) :
|
||||
// Start the Loop
|
||||
while ( have_posts() ) : the_post();
|
||||
get_template_part( 'template-parts/content', get_post_format() );
|
||||
endwhile;
|
||||
else :
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
endif; // End have_posts() check.
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Display navigation to next/previous pages when applicable
|
||||
if ( function_exists( 'foundationpress_pagination' ) ) :
|
||||
foundationpress_pagination();
|
||||
elseif ( is_paged() ) :
|
||||
?>
|
||||
<nav id="post-nav">
|
||||
<div class="post-previous"><?php next_posts_link( __( '← Older posts', 'foundationpress' ) ); ?></div>
|
||||
<div class="post-next"><?php previous_posts_link( __( 'Newer posts →', 'foundationpress' ) ); ?></div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
endif;//end if is archive_resource
|
||||
// Display navigation to next/previous pages when applicable
|
||||
if ( function_exists( 'foundationpress_pagination' ) ) :
|
||||
foundationpress_pagination();
|
||||
elseif ( is_paged() ) :
|
||||
?>
|
||||
<nav id="post-nav">
|
||||
<div class="post-previous"><?php next_posts_link( __( '← Older posts', 'foundationpress' ) ); ?></div>
|
||||
<div class="post-next"><?php previous_posts_link( __( 'Newer posts →', 'foundationpress' ) ); ?></div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</main>
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
endif;//end if is archive_resource
|
||||
?>
|
||||
</main>
|
||||
</article>
|
||||
<?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;
|
||||
header,main,aside {
|
||||
@include breakpoint(small){
|
||||
|
@ -168,8 +168,18 @@ main {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// end category-posts
|
||||
.search-results {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
// end news & resources category
|
||||
// end collections category
|
||||
|
||||
//
|
||||
// partners
|
||||
|
|
|
@ -5,14 +5,14 @@ Template Name: Front
|
|||
get_header(); ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php get_template_part( 'template-parts/home', 'announcement-main' ); ?>
|
||||
|
||||
<article>
|
||||
<main>
|
||||
<?php
|
||||
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
||||
get_template_part( 'template-parts/section', 'categoryposts', array('category_name' => 'news', 'post_per_page' => '3' ) );
|
||||
<?php
|
||||
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
||||
get_template_part( 'template-parts/section', 'categoryposts', array('category_name' => 'news', 'post_per_page' => '3' ) );
|
||||
?>
|
||||
</main>
|
||||
</article>
|
||||
|
|
|
@ -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;
|
||||
header,main,aside {
|
||||
@include breakpoint(small){
|
||||
|
@ -168,8 +168,18 @@ main {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// end category-posts
|
||||
.search-results {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
// end news & resources category
|
||||
// end collections category
|
||||
|
||||
//
|
||||
// partners
|
||||
|
|
|
@ -12,14 +12,22 @@
|
|||
//https://developer.wordpress.org/reference/functions/get_template_part/#comment-4130
|
||||
// var_dump( $args ); //will display everythin imported from
|
||||
// get_template_part( 'template-parts/section', 'category', array('category_name' => 'news', 'post_per_page' => '3' ) );
|
||||
// $thiscategory = $args['category_name'];
|
||||
$howmanyposts = $args['post_per_page'];
|
||||
$thiscategory = esc_html( get_the_category()[0]->name );
|
||||
$thiscategory = $args['category_name'];
|
||||
|
||||
?>
|
||||
|
||||
<section class="category-posts <?php echo $thiscategory;?> ">
|
||||
<header>
|
||||
<h2><?php single_cat_title();?></h2>
|
||||
<h2>
|
||||
<?php
|
||||
if ( is_category() ):
|
||||
single_cat_title();
|
||||
else:
|
||||
echo $thiscategory;
|
||||
endif;
|
||||
?>
|
||||
</h2>
|
||||
</header>
|
||||
<main class="">
|
||||
<?php $the_query = new WP_Query( array( 'category_name' => $thiscategory, 'posts_per_page' => $howmanyposts ) ); ?>
|
||||
|
|
Loading…
Reference in New Issue