Дубли миниатюр в рубрике.

(Ответов: 7, Просмотров: 1195)
  1. Студент Аватар для Flip_Syde
    • Регистрация: 08.01.2016
    • Сообщений: 79
    • Репутация: 23
    По форуму поискал, вроде не обсуждалось ранее. Может не там смотрел...
    В общем, такая проблема. Есть запись в вордпрессе, на неё при создании прикрепляем миниатюру, всё хорошо. Отображается вот так вот.
    Нажимаем читать далее, смотрим. Миниютюра располагается вверху записи.

    Собственно вопрос. Как сделать так, чтобы миниатюра не выводилась в самой записи?
    • 0
  2. Гуру
    • Регистрация: 20.01.2013
    • Сообщений: 720
    • Репутация: 189
    • Webmoney BL: ?
    Flip_Syde, ну так удалить в самом шаблоне записи код, отвечающий за вывод миниатюры (в single.php посмотрите)
    • 0
  3. Опытный старожил) Аватар для vovasit91
    • Регистрация: 07.08.2011
    • Сообщений: 688
    • Репутация: 235
    • Webmoney BL: ?
    Если покажите код файла single.php вместе поможем вам удалить строчку отвечающую за вывод этих картинок если сами не знаете что нужно менять.
    • 0
  4. Студент Аватар для Flip_Syde
    • Регистрация: 08.01.2016
    • Сообщений: 79
    • Репутация: 23
    Это всё, что содержит файл single.php для моей темы. Тема storefront.
    PHP код:
    <?php
    /**
     * The template for displaying all single posts.
     *
     * @package storefront
     */

    get_header(); ?>

        <div id="primary" class="content-area">
            <main id="main" class="site-main" role="main">

            <?php while ( have_posts() ) : the_post(); ?>

                <?php
                do_action
    'storefront_single_post_before' );

                
    get_template_part'content''single' );

                
    /**
                 * @hooked storefront_post_nav - 10
                 * @hooked storefront_display_comments - 20
                 */
                
    do_action'storefront_single_post_after' );
                
    ?>

            <?php endwhile; // end of the loop. ?>

            </main><!-- #main -->
        </div><!-- #primary -->

    <?php do_action'storefront_sidebar' ); ?>
    <?php get_footer
    (); ?>
    Вот это ещё нашёл в css файле темы, думаю имеет отношение
    Код:
    /**
     * Post Formats
     */
    .blog .format-aside .entry-title, .archive .format-aside .entry-title {
      display: none; }
    
    /**
     * Media
     */
    .page-content img.wp-smiley,
    .entry-content img.wp-smiley,
    .comment-content img.wp-smiley {
      border: none;
      margin-bottom: 0;
      margin-top: 0;
      padding: 0;
      display: inline-block; }
    И ещё плюс это код из структуры ../public_html/wp-content/themes/storefront/inc/structure

    Код:
    <?php
    /**
     * Template functions used for posts.
     *
     * @package storefront
     */
    
    if ( ! function_exists( 'storefront_post_header' ) ) {
    	/**
    	 * Display the post header with a link to the single post
    	 * @since 1.0.0
    	 */
    	function storefront_post_header() { ?>
    		<header class="entry-header">
    		<?php
    		if ( is_single() ) {
    			storefront_posted_on();
    			the_title( '<h1 class="entry-title" itemprop="name headline">', '</h1>' );
    		} else {
    			if ( 'post' == get_post_type() ) {
    				storefront_posted_on();
    			}
    
    			the_title( sprintf( '<h1 class="entry-title" itemprop="name headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' );
    		}
    		?>
    		</header><!-- .entry-header -->
    		<?php
    	}
    }
    
    if ( ! function_exists( 'storefront_post_content' ) ) {
    	/**
    	 * Display the post content with a link to the single post
    	 * @since 1.0.0
    	 */
    	function storefront_post_content() {
    		?>
    		<div class="entry-content" itemprop="articleBody">
    		<?php
    		storefront_post_thumbnail( 'full' );
    
    		the_content(
    			sprintf(
    				__( 'Continue reading %s', 'storefront' ),
    				'<span class="screen-reader-text">' . get_the_title() . '</span>'
    			)
    		);
    
    		wp_link_pages( array(
    			'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
    			'after'  => '</div>',
    		) );
    		?>
    		</div><!-- .entry-content -->
    		<?php
    	}
    }
    
    if ( ! function_exists( 'storefront_post_meta' ) ) {
    	/**
    	 * Display the post meta
    	 * @since 1.0.0
    	 */
    	function storefront_post_meta() {
    		?>
    		<aside class="entry-meta">
    			<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
    
    			<?php
    			/* translators: used between list items, there is a space after the comma */
    			$categories_list = get_the_category_list( __( ', ', 'storefront' ) );
    
    			if ( $categories_list && storefront_categorized_blog() ) : ?>
    				<span class="cat-links">
    					<?php
    					echo '<span class="screen-reader-text">' . esc_attr( __( 'Categories: ', 'storefront' ) ) . '</span>';
    					echo wp_kses_post( $categories_list );
    					?>
    				</span>
    			<?php endif; // End if categories ?>
    
    			<?php
    			/* translators: used between list items, there is a space after the comma */
    			$tags_list = get_the_tag_list( '', __( ', ', 'storefront' ) );
    
    			if ( $tags_list ) : ?>
    				<span class="tags-links">
    					<?php
    					echo '<span class="screen-reader-text">' . esc_attr( __( 'Tags: ', 'storefront' ) ) . '</span>';
    					echo wp_kses_post( $tags_list );
    					?>
    				</span>
    			<?php endif; // End if $tags_list ?>
    
    			<?php endif; // End if 'post' == get_post_type() ?>
    
    			<?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
    				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'storefront' ), __( '1 Comment', 'storefront' ), __( '% Comments', 'storefront' ) ); ?></span>
    			<?php endif; ?>
    		</aside>
    		<?php
    	}
    }
    
    if ( ! function_exists( 'storefront_paging_nav' ) ) {
    	/**
    	 * Display navigation to next/previous set of posts when applicable.
    	 */
    	function storefront_paging_nav() {
    		global $wp_query;
    
    		$args = array(
    			'type' 	    => 'list',
    			'next_text' => _x( 'Next', 'Next post', 'storefront' ) . '&nbsp;<span class="meta-nav">&rarr;</span>',
    			'prev_text' => '<span class="meta-nav">&larr;</span>&nbsp' . _x( 'Previous', 'Previous post', 'storefront' ),
    			);
    
    		the_posts_pagination( $args );
    	}
    }
    
    if ( ! function_exists( 'storefront_post_nav' ) ) {
    	/**
    	 * Display navigation to next/previous post when applicable.
    	 */
    	function storefront_post_nav() {
    		$args = array(
    			'next_text' => '%title &nbsp;<span class="meta-nav">&rarr;</span>',
    			'prev_text' => '<span class="meta-nav">&larr;</span>&nbsp;%title',
    			);
    		the_post_navigation( $args );
    	}
    }
    
    if ( ! function_exists( 'storefront_posted_on' ) ) {
    	/**
    	 * Prints HTML with meta information for the current post-date/time and author.
    	 */
    	function storefront_posted_on() {
    		$time_string = '<time class="entry-date published updated" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    		if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    			$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s" itemprop="datePublished">%4$s</time>';
    		}
    
    		$time_string = sprintf( $time_string,
    			esc_attr( get_the_date( 'c' ) ),
    			esc_html( get_the_date() ),
    			esc_attr( get_the_modified_date( 'c' ) ),
    			esc_html( get_the_modified_date() )
    		);
    
    		$posted_on = sprintf(
    			_x( 'Posted on %s', 'post date', 'storefront' ),
    			'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
    		);
    
    		$byline = sprintf(
    			_x( 'by %s', 'post author', 'storefront' ),
    			'<span class="vcard author"><span class="fn" itemprop="author"><a class="url fn n" rel="author" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span></span>'
    		);
    
    		echo apply_filters( 'storefront_single_post_posted_on_html', '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>', $posted_on, $byline );
    
    	}
    }
    Думаю, что копать надо под последний, ибо в сингле темы нет них... чего.
    Последний раз редактировалось Flip_Syde; 20.01.2016 в 06:13.
    • 0
  5. Опытный Аватар для DOleg
    • Регистрация: 21.08.2010
    • Сообщений: 276
    • Репутация: 78
    • Webmoney BL: ?
    Цитата Сообщение от Flip_Syde Посмотреть сообщение
    ибо в сингле темы нет них... чего
    Потому, что в нём подключается content-single.php

    Код:
    get_template_part( 'content', 'single' )
    Плюс не известно, что делает перед подключением вызываемая функция storefront_single_post_before

    Цитата Сообщение от Flip_Syde Посмотреть сообщение
    Думаю, что копать надо под последний
    А вот как раз тут есть вывод миниатюры

    Код:
    storefront_post_thumbnail( 'full' )
    • 0
  6. Студент Аватар для Flip_Syde
    • Регистрация: 08.01.2016
    • Сообщений: 79
    • Репутация: 23
    А это содержимое content-single.php Думаю, тоже не нужно. Поэтому, когда написали, мол покажи код с файлов, мы поможем строчку удалить - я и создал эту тему т.к. ничего не понятно в этой теме. А таких записей где содержится
    Код:
    storefront_post_thumbnail( 'full' )
    много раскидано по файлам.

    content-single.php
    Код:
    <?php
    /**
     * @package storefront
     */
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> itemscope="" itemtype="http://schema.org/BlogPosting">
    
    	<?php
    	/**
    	 * @hooked storefront_post_header - 10
    	 * @hooked storefront_post_meta - 20
    	 * @hooked storefront_post_content - 30
    	 */
    	do_action( 'storefront_single_post' );
    	?>
    
    </article><!-- #post-## -->
    • 0
  7. Гуру
    • Регистрация: 20.01.2013
    • Сообщений: 720
    • Репутация: 189
    • Webmoney BL: ?
    Цитата Сообщение от Flip_Syde Посмотреть сообщение
    И ещё плюс это код из структуры ../public_html/wp-content/themes/storefront/inc/structure
    вам правильно написали, что за вывод миниатюры отвечает функция storefront_post_thumbnail( 'full' ).
    Попробуйте добавить там условие - выводить только, если не страница записи:
    PHP код:
     if(!is_single()) storefront_post_thumbnail'full' ); 
    • 1

    Спасибо сказали:

    Flip_Syde(20.01.2016),
  8. Студент Аватар для Flip_Syde
    • Регистрация: 08.01.2016
    • Сообщений: 79
    • Репутация: 23
    Всё отлично работает! Спасибо thomas и всем отписавшимся)
    • 0

Похожие темы

Темы Раздел Ответов Последний пост
как настроить отображение миниатюр
WordPress 2 04.12.2014 00:17
WordPress. Вывести суммарный рейтинг статей в рубрике
Другая работа 4 12.11.2014 16:38
Подскажите как зафиксировать статью в вордпресс в рубрике?
WordPress 2 30.03.2012 14:47
Возможно ли использовать разный фон в каждой рубрике WordPress?
WordPress 7 11.01.2012 18:04
Запрет title у миниатюр
Web программирование 10 21.05.2011 23:51

У кого попросить инвайт?

Вы можете попросить инвайт у любого модератора:

Информеры