【问题标题】:Wordpress image ThumbnailWordpress 图片缩略图
【发布时间】:2013-02-20 12:43:02
【问题描述】:

我正在尝试找到一种解决方案,如何仅在博客主页上显示缩略图图像,并在帖子内显示附加到帖子的所有其他图像。

我用谷歌搜索了它,但没有运气...有人可以帮忙吗?

在这里你可以明白我的意思:blog.turdidesigns.com

我是 wordpress 新手,所以如果这是一个愚蠢的问题,我深表歉意。

谢谢,

【问题讨论】:

    标签: image wordpress post thumbnails blogs


    【解决方案1】:

    在你的 index.php 文件中替换 the_content(); with the_excerpt();

    此外,这可能是一个循环,因此请确保将其替换为文章列表(类别、存档、搜索),而不是单个循环。

    【讨论】:

    • 那你得修改content.php
    【解决方案2】:

    在我的索引 php 中我没有这个...

    这是我所拥有的: 在我的主题文件夹 infex php 我只有这个:

    <?php get_header(); ?>
    
    <div class="art-layout-wrapper">
    
        <div class="art-content-layout">
    
            <div class="art-content-layout-row">
    
                <div class="art-layout-cell art-content">
    
                <?php get_sidebar('top'); ?>
    
                <?php 
    
                    if(have_posts()) {
    
    
    
                        /* Display navigation to next/previous pages when applicable */
    
                        if ( theme_get_option('theme_' . (theme_is_home() ? 'home_' : '') . 'top_posts_navigation' ) ) {
    
                            theme_page_navigation();
    
                        }
    
    
    
                        /* Start the Loop */ 
    
                        while (have_posts()) {
    
                            the_post();
    
                            get_template_part('content', get_post_format());
    
                        }
    
    
    
                        /* Display navigation to next/previous pages when applicable */
    
                        if (theme_get_option('theme_bottom_posts_navigation')) {
    
                             theme_page_navigation();
    
                        }
    
    
    
                    } else {
    
    
    
                         theme_404_content();
    
    
    
                    } 
    
                ?>
    
                <?php get_sidebar('bottom'); ?>
    
                  <div class="cleared"></div>
    
                </div>
    
                <div class="art-layout-cell art-sidebar1">
    
                  <?php get_sidebar('default'); ?>
    
                  <div class="cleared"></div>
    
                </div>
    
            </div>
    
        </div>
    
    </div>
    
    <div class="cleared"></div>
    
    <?php get_footer(); ?>
    

    我是和 Artisteer 一起做这个主题的,所以不要过多评价我 ;)

    【讨论】:

    • 如果你能告诉我们发生了什么 get_template_part('content', get_post_format());也许我们可以帮助你。该文件应命名为 content-post.php 或 content-index.php
    • 我有 3 个文件, content.php , content-page.php 和 content-single.php 你想看一个吗?
    【解决方案3】:

    抱歉回复晚了!!!

    这里是 content.php 代码:

    <?php
    
    
    
    /**
    
     *
    
     * content*.php
    
     *
    
     * The post format template. You can change the structure of your posts or add/remove post elements here.
    
     * 
    
     * 'id' - post id
    
     * 'class' - post class
    
     * 'thumbnail' - post icon
    
     * 'title' - post title
    
     * 'before' - post header metadata
    
     * 'content' - post content
    
     * 'after' - post footer metadata
    
     * 
    
     * To create a new custom post format template you must create a file "content-YourTemplateName.php"
    
     * Then copy the contents of the existing content.php into your file and edit it the way you want.
    
     * 
    
     * Change an existing get_template_part() function as follows:
    
     * get_template_part('content', 'YourTemplateName');
    
     *
    
     */ 
    
    
    
        global $post;
    
        theme_post_wrapper(
    
            array(
    
                    'id' => theme_get_post_id(), 
    
                    'class' => theme_get_post_class(),
    
                    'thumbnail' => theme_get_post_thumbnail(),
    
                    'title' => '<a href="' . get_permalink( $post->ID ) . '" rel="bookmark" title="' . strip_tags(get_the_title()) . '">' . get_the_title() . '</a>', 
    
            'heading' => theme_get_option('theme_'.(is_single()?'single':'posts').'_article_title_tag'),
    
                    'before' => theme_get_metadata_icons( 'date,author,edit', 'header' ),
    
                    'content' => theme_get_excerpt(), 
    
                    'after' => theme_get_metadata_icons( 'category,tag,comments', 'footer' )
    
            )
    
        );
    
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-01
      • 2014-09-28
      • 2012-07-14
      • 2011-03-11
      • 2014-07-23
      • 2012-04-02
      • 2016-11-21
      相关资源
      最近更新 更多