@gorkaps

Почему на вордпрессе не показывет миниатюру?

Всем привет, подскажите пожалуйста я только перешел с DLE на word, как мне сделать так чтобы картинки показывлись в постах? В самих постах они показываются, а в миниатюрах нет. Уже весь интернет перерыл всё перепробывл что нашел. Но не получается ни как(.
Подскажите что тут нужно добавить и где. Спасибо заранее.
<?php

/**
* List down the post category
*
* @since SuperNews 1.0.0
*
* @param int $post_id
* return string list of category
*
*/

if ( !function_exists('supernews_list_category') ) :
function supernews_list_category( $post_id = 0 ) {

if( 0 == $post_id ){
global $post;
$post_id = $post->ID;
}
$categories = get_the_category($post_id);
$separator = ' ';
$output = '';
if($categories) {
$output .= '';
foreach($categories as $category) {
$output .= ''.esc_html( $category->cat_name ).''.$separator;
}
$output .='';
echo trim($output, $separator);
}

}
endif;

/**
* Callback functions for comments
*
* @since SuperNews 1.0.0
*
* @param $comment
* @param $args
* @param $depth
* return void
*
*/

if ( !function_exists('supernews_commment_list') ) :

function supernews_commment_list($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ('div' == $args['style']) {
$tag = 'div';
$add_below = 'comment';
}
else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
<<?php echo $tag ?>
<?php comment_class(empty($args['has_children']) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
<?php if ('div' != $args['style']) : ?>

<?php endif; ?>

<?php if ($args['avatar_size'] != 0) echo get_avatar($comment, '64'); ?>
<?php printf(__('%s', 'supernews' ), get_comment_author_link() ); ?>

<?php if ($comment->comment_approved == '0') : ?>
<?php _e('Your comment is awaiting moderation.', 'supernews'); ?>


<?php endif; ?>

<?php /* translat...
<?php edit_comment_link(__('(Edit)', 'supernews'), ' ', ''); ?>

<?php comment_text(); ?>

<?php comment_reply_link( array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>

<?php if ('div' != $args['style']) : ?>

<?php endif;
}
endif;

/**
* Date display functions
*
* @since SuperNews 1.0.0
* edited 1.5.0
*
* @param string $format
* return string
*
*/
if ( ! function_exists( 'supernews_date_display' ) ) :
function supernews_date_display( $format = 'l, F j, Y') {
$supernews_customizer_all_values = supernews_get_theme_options();
if( 'default' == $supernews_customizer_all_values['supernews-header-date-format'] ){
echo esc_html( date_i18n( $format ) );
}
else{
echo date_i18n(get_option('date_format'));
}
}
endif;

/**
* Select sidebar according to the options saved
*
* @since SuperNews 1.0.0
*
* @param null
* return string
*
*/
if ( !function_exists('supernews_sidebar_selection') ) :
function supernews_sidebar_selection( ) {
wp_reset_postdata();
$supernews_customizer_all_values = supernews_get_theme_options();
global $post;
if(
isset( $supernews_customizer_all_values['supernews-sidebar-layout'] ) &&
(
'left-sidebar' == $supernews_customizer_all_values['supernews-sidebar-layout'] ||
'both-sidebar' == $supernews_customizer_all_values['supernews-sidebar-layout'] ||
'no-sidebar' == $supernews_customizer_all_values['supernews-sidebar-layout']
)
){
$supernews_body_global_class = $supernews_customizer_all_values['supernews-sidebar-layout'];
}
else{
$supernews_body_global_class= 'right-sidebar';
}

if( is_front_page() ){
if( isset( $supernews_customizer_all_values['supernews-front-page-sidebar-layout'] ) ){
if(
'right-sidebar' == $supernews_customizer_all_values['supernews-front-page-sidebar-layout'] ||
'left-sidebar' == $supernews_customizer_all_values['supernews-front-page-sidebar-layout'] ||
'both-sidebar' == $supernews_customizer_all_values['supernews-front-page-sidebar-layout'] ||
'no-sidebar' == $supernews_customizer_all_values['supernews-front-page-sidebar-layout']
){
$supernews_body_classes = $supernews_customizer_all_values['supernews-front-page-sidebar-layout'];
}
else{
$supernews_body_classes = $supernews_body_global_class;
}
}
else{
$supernews_body_classes= $supernews_body_global_class;
}
}
elseif (is_singular() && isset( $post->ID )) {
$post_class = get_post_meta( $post->ID, 'supernews_sidebar_layout', true );
if ( 'default-sidebar' != $post_class ){
if ( $post_class ) {
$supernews_body_classes = $post_class;
} else {
$supernews_body_classes = $supernews_body_global_class;
}
}
else{
$supernews_body_classes = $supernews_body_global_class;
}

}
elseif ( is_archive() ) {
if( isset( $supernews_customizer_all_values['supernews-archive-sidebar-layout'] ) ){
$supernews_archive_sidebar_layout = $supernews_customizer_all_values['supernews-archive-sidebar-layout'];
if(
'right-sidebar' == $supernews_archive_sidebar_layout ||
'left-sidebar' == $supernews_archive_sidebar_layout ||
'both-sidebar' == $supernews_archive_sidebar_layout ||
'no-sidebar' == $supernews_archive_sidebar_layout
){
$supernews_body_classes = $supernews_archive_sidebar_layout;
}
else{
$supernews_body_classes = $supernews_body_global_class;
}
}
else{
$supernews_body_classes= $supernews_body_global_class;
}
}
else {
$supernews_body_classes = $supernews_body_global_class;
}
return $supernews_body_classes;
}
endif;

/**
* Return content of fixed lenth
*
* @since SuperNews 1.0.0
*
* @param string $supernews_content
* @param int $length
* return string
*
*/
if ( ! function_exists( 'supernews_words_count' ) ) :
function supernews_words_count( $supernews_content = null, $length = 16 ) {
$length = absint( $length );
$source_content = preg_replace( '`\[[^\]]*\]`', '', $supernews_content );
$trimmed_content = wp_trim_words( $source_content, $length, '...' );
return $trimmed_content;
}
endif;

/**
* BreadCrumb Settings
*/
if( ! function_exists( 'supernews_breadcrumbs' ) ):
function supernews_breadcrumbs() {
$supernews_customizer_all_values = supernews_get_theme_options();
if ( ! function_exists( 'breadcrumb_trail' ) ) {
require_once supernews_file_directory('acmethemes/library/breadcrumbs/breadcrumbs.php');
}
$breadcrumb_args = array(
'container' => 'div',
'show_browse' => false
);
$supernews_you_are_here_text = $supernews_customizer_all_values['supernews-you-are-here-text'];
if( !empty( $supernews_you_are_here_text ) ){
$supernews_you_are_here_text = "".$supernews_you_are_here_text."";
}

echo "".$supernews_you_are_here_text."";
breadcrumb_trail( $breadcrumb_args );
echo "";
}
endif;
  • Вопрос задан
  • 412 просмотров
Пригласить эксперта
Ответы на вопрос 1
deniscopro
@deniscopro Куратор тега WordPress
WordPress-разработчик, denisco.pro
Привет.
В functions.php включить поддержку миниатюр
function mytheme_setup() {
    add_theme_support('post-thumbnails');
    //add_image_size('gallery', '293', '203', true); //Можно добавить нужные размеры
}

add_action('after_setup_theme', 'mytheme_setup');

Ну а где нужно вывести
<?php the_post_thumbnail(); ?>
или
<?php the_post_thumbnail('gallery'); ?>
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы