Remove posts index styling
This commit is contained in:
parent
f03f2dda2d
commit
d54a73d2e0
88
home.php
88
home.php
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* The template for displaying all pages.
|
||||
*
|
||||
* This is the template that displays all pages by default.
|
||||
* Please note that this is the WordPress construct of pages
|
||||
* and that other 'pages' on your WordPress site will use a
|
||||
* different template.
|
||||
*
|
||||
* @package understrap
|
||||
*/
|
||||
|
||||
get_header();
|
||||
|
||||
$container = get_theme_mod( 'understrap_container_type' );
|
||||
$sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
|
||||
$posts_style = get_theme_mod( 'understrap_posts_index_style' );
|
||||
?>
|
||||
|
||||
<?php if ( is_front_page() && is_home() ) : ?>
|
||||
<?php get_template_part( 'global-templates/hero', 'none' ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wrapper" id="wrapper-home">
|
||||
|
||||
<div class="<?php echo esc_html( $container ); ?>" id="content" tabindex="-1">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- Do the left sidebar check -->
|
||||
<?php get_template_part( 'global-templates/left-sidebar-check', 'none' ); ?>
|
||||
|
||||
<?php if ( 'masonry' === $posts_style ) : ?>
|
||||
|
||||
<div class="card-columns"><?php endif; ?>
|
||||
|
||||
<main class="site-main" id="main">
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
|
||||
<?php /* Start the Loop */ ?>
|
||||
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
|
||||
<?php
|
||||
if ( 'masonry' === $posts_style ) :
|
||||
get_template_part( 'loop-templates/content', 'card' );
|
||||
elseif ( 'grid' === $posts_style ) :
|
||||
|
||||
get_template_part( 'loop-templates/content', 'grid' );
|
||||
else :
|
||||
/*
|
||||
* 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( 'loop-templates/content', get_post_format() );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<?php get_template_part( 'loop-templates/content', 'none' ); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php if ( 'masonry' === $posts_style ) : ?></div><?php endif; ?>
|
||||
</main><!-- #main -->
|
||||
|
||||
<?php understrap_pagination(); ?>
|
||||
|
||||
</div><!-- #primary -->
|
||||
|
||||
<!-- Do the right sidebar check -->
|
||||
<?php if ( 'right' === $sidebar_pos || 'both' === $sidebar_pos ) : ?>
|
||||
|
||||
<?php get_sidebar( 'right' ); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div><!-- .row -->
|
||||
|
||||
</div><!-- Container end -->
|
||||
|
||||
</div><!-- Wrapper end -->
|
||||
|
||||
<?php get_footer(); ?>
|
|
@ -90,82 +90,10 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
|
|||
'priority' => '20',
|
||||
)
|
||||
) );
|
||||
|
||||
// How to display posts index page (home.php).
|
||||
$wp_customize->add_setting( 'understrap_posts_index_style', array(
|
||||
'default' => 'default',
|
||||
'type' => 'theme_mod',
|
||||
'sanitize_callback' => 'esc_textarea',
|
||||
'capability' => 'edit_theme_options',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Control(
|
||||
$wp_customize,
|
||||
'understrap_posts_index_style', array(
|
||||
'label' => __( 'Posts Index Style', 'understrap' ),
|
||||
'description' => __( 'Choose how to display latest posts', 'understrap' ),
|
||||
'section' => 'understrap_theme_layout_options',
|
||||
'settings' => 'understrap_posts_index_style',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'default' => __( 'Default', 'understrap' ),
|
||||
'masonry' => __( 'Masonry', 'understrap' ),
|
||||
'grid' => __( 'Grid', 'understrap' ),
|
||||
),
|
||||
'priority' => '30',
|
||||
)
|
||||
) );
|
||||
|
||||
// Columns setup for grid posts.
|
||||
/**
|
||||
* Function and callback to check when grid is enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_grid_enabled() {
|
||||
return 'grid' == get_theme_mod( 'understrap_posts_index_style' );
|
||||
}
|
||||
|
||||
// How many columns to use each grid post.
|
||||
$wp_customize->add_setting( 'understrap_grid_post_columns', array(
|
||||
'default' => '6',
|
||||
'type' => 'theme_mod',
|
||||
'capability' => 'edit_theme_options',
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'absint',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Control(
|
||||
$wp_customize,
|
||||
'understrap_grid_post_columns', array(
|
||||
'label' => __( 'Grid Post Columns', 'understrap' ),
|
||||
'description' => __( 'Choose how many columns to use', 'understrap' ),
|
||||
'section' => 'understrap_theme_layout_options',
|
||||
'settings' => 'understrap_grid_post_columns',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'6' => '2',
|
||||
'4' => '3',
|
||||
'3' => '4',
|
||||
'2' => '6',
|
||||
'12' => '1',
|
||||
),
|
||||
'default' => 2,
|
||||
'priority' => '30',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
) );
|
||||
|
||||
// hook to auto-hide/show depending the understrap_posts_index_style option.
|
||||
$wp_customize->get_control( 'understrap_grid_post_columns' )->active_callback = 'is_grid_enabled';
|
||||
|
||||
}
|
||||
} // endif function_exists( 'understrap_theme_customize_register' ).
|
||||
add_action( 'customize_register', 'understrap_theme_customize_register' );
|
||||
|
||||
|
||||
/**
|
||||
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Card patrial template responsible to show individual posts in home.php page.
|
||||
*
|
||||
* @package understrap
|
||||
*/
|
||||
|
||||
?>
|
||||
<div class="card">
|
||||
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
|
||||
|
||||
<header class="entry-header">
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<?php
|
||||
$alt = get_post_meta( get_post_thumbnail_id( $post->ID ), '_wp_attachment_image_alt', true );
|
||||
?>
|
||||
<img src="<?php echo get_the_post_thumbnail_url( $post->ID, 'large' ); ?>"
|
||||
alt="<?php echo $alt; ?>"
|
||||
class="card-img-top img-fluid">
|
||||
<?php endif; ?>
|
||||
<div class="card-block">
|
||||
<?php the_title( sprintf( '<h2 class="entry-title card-title"><a href="%s" rel="bookmark">',
|
||||
esc_url( get_permalink() ) ), '</a></h2>' ); ?>
|
||||
|
||||
<?php if ( 'post' === get_post_type() ) : ?>
|
||||
|
||||
<div class="entry-meta">
|
||||
<p class="card-text"> <?php understrap_posted_on(); ?> </p>
|
||||
</div><!-- .entry-meta -->
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="card-block">
|
||||
<div class="entry-content card-text">
|
||||
<?php
|
||||
echo understrap_excerpt_with_length( $post->ID, 15 );
|
||||
?>
|
||||
|
||||
<?php
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'understrap' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
|
||||
</div>
|
||||
</article><!-- #post-## -->
|
||||
</div>
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Partial template to display latest posts (home.php) as grid.
|
||||
*
|
||||
* @package understrap
|
||||
*/
|
||||
|
||||
$col = get_theme_mod( 'understrap_grid_post_columns' );
|
||||
?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
|
||||
<div class="col-md-<?php echo esc_html( $col ); ?> col-xs-12">
|
||||
|
||||
|
||||
<div class="card card-inverse ">
|
||||
|
||||
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
|
||||
<?php $alt = get_post_meta( get_post_thumbnail_id( $post->ID ), '_wp_attachment_image_alt', true ); ?>
|
||||
<img class="card-img "
|
||||
src="<?php echo esc_html( get_the_post_thumbnail_url( $post->ID, 'large' ) ) ?>" alt="<?php echo esc_html( $alt ); ?>">
|
||||
|
||||
<div class="card-img-overlay">
|
||||
|
||||
<header class="entry-header">
|
||||
<h4 class="card-title"><?php the_title(); ?></h4>
|
||||
|
||||
<?php if ( 'post' === get_post_type() ) : ?>
|
||||
|
||||
<p class="entry-meta card-text">
|
||||
<small>Posted: <?php the_date(); ?> at: <?php the_time(); ?></small>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</header>
|
||||
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</a>
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* The template used for displaying page content in a vertical layout
|
||||
* The template modifies Article's ID by using post's slug to lower case as anchor point.
|
||||
*
|
||||
* @package understrap
|
||||
*/
|
||||
|
||||
?>
|
||||
<?php global $post ?>
|
||||
|
||||
<article <?php post_class(); ?> id="<?php echo esc_html( strtolower( $post->post_title ) ); ?>">
|
||||
|
||||
<header class="entry-header">
|
||||
|
||||
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
|
||||
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>
|
||||
|
||||
<div class="entry-content">
|
||||
|
||||
<?php the_content(); ?>
|
||||
|
||||
<?php
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'understrap' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
|
||||
<?php edit_post_link( __( 'Edit', 'understrap' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
|
||||
</footer><!-- .entry-footer -->
|
||||
|
||||
</article><!-- #post-## -->
|
Reference in New Issue