Wp:theme:storefront:appearance-of-list-of-posts

Материал из 8j0rn wiki

Настраиваем по своем списки постов в StoreFront:

// Исправляем внешний вид списка постов
function custom_storefront_post_content() {
	?>
	<div class="entry-content" itemprop="articleBody"><!-- A -->
	<?php
	echo '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
		if ( has_post_thumbnail() ) {
			the_post_thumbnail( 'full', array( 'itemprop' => 'image' ) );
		}
		else
		{
			echo '<img width="1080" height="1080" style="opacity: 0.3;" src="/content/images/post_thumbnail.png" class="attachment-full size-full wp-post-image" alt="" decoding="async" itemprop="image" sizes="(max-width: 1080px) 100vw, 1080px">';
		}
	echo '<div style="max-width: 60%; float: right;"><h3>' . get_the_excerpt() . '</h3></div></a>';
	?>
	</div><!-- .entry-content -->
	<?php
}
function _8j0rn_customise_storefront() {
	// Удаляем текущий вид
	remove_action( 'storefront_loop_post', 'storefront_post_content', 30 );

	// Создаем свой собственный
	add_action( 'storefront_loop_post', 'custom_storefront_post_content', 30 );
}
add_action( 'init', '_8j0rn_customise_storefront' );