まずはフォーム部分 テーマ的なとろこに
<div id="search">
<form method="get" action="<?php bloginfo( 'url' ); ?>">
<div class="kensakutitle">講座種類</div>
<?php $cats = get_categories(''); if ($cats) : ?>
<?php foreach ( $cats as $cat ): ?>
<div class="search-checkbox">
<label><input type="radio" name="cat" value="<?php echo $cat->cat_ID; ?>"><?php echo esc_html( $cat->name ); ?></label>
</div>
<?php endforeach; ?>
<?php endif; ?>
<div class="kensakutitle">地域を選んで下さい</div>
<div>
<?php $tags = get_tags(''); if ( $tags ) : ?>
<?php
$checkboxes = '';
foreach($tags as $tag) :
$checkboxes .='<input type="checkbox" name="tag[]" value="'.$tag -> slug.'" id="tag-'.$tag->tag_id.'" /><label for="tag-'.$tag->tag_id.'">'.$tag->name.'</label>'.' ';
endforeach;
print $checkboxes;
?>
</div>
<div>
<?php endif; ?>
<input id="submit" type="submit" value="検索" /></div>
</form>
</div>
アーカイブphpに以下をまるっとコピペ ※いらんかもしれん
<?php
/**
* The template for displaying archive pages.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package wpindex
*/
get_header(1); ?>
<div id="primary" class="content-area">
<main2 id="main" class="site-main" role="main">
<?php
if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
?>
</div>
<?php
get_footer();
content.phpを以下にまるっとコピペ
<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package index000
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_post_thumbnail(); ?>
<?php
if ( is_single() ) {
the_title( '<h1 class="entry-title">', '</h1>' );
} else {
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
}
if ( 'post' === get_post_type() ) : ?>
<!-- .entry-meta -->
<?php
endif; ?>
</header><!-- .entry-header -->
</article><!-- #post-<?php the_ID(); ?> -->
投稿数はワードプレスの管理画面→設定からでOK
チェックボックス部分を横並びはCSSに
.search-checkbox{
display: inline-block;
}