【问题标题】:Bones Wordpress Theme - Featured Images骨头 Wordpress 主题 - 精选图片
【发布时间】:2014-12-29 11:39:22
【问题描述】:

在骨骼主题 here 中使用特征图像时遇到了一点问题。

我做了以下事情:

切换主题以确保它与主题相关的问题。 (切换主题时,特色图片起作用)

检查functions.php 有以下内容:

// Thumbnail sizes
add_image_size( 'bones-thumb-600', 600, 150, true );
add_image_size( 'bones-thumb-300', 300, 100, true );

检查bones.php 有以下内容:

// wp thumbnails (sizes handled in functions.php)
add_theme_support( 'post-thumbnails' );

// default thumb size
set_post_thumbnail_size(125, 125, true);

我还安装了一个 Regenerate Thumbnails 插件,因为它在过去的主题中有效。这些都不起作用,有什么想法吗?先感谢您。

index.php

    <?php get_header(); ?>

    <div id="inner-content" class="wrap cf">
    <div id="viewport">
    <div class="wrapper">
    <img id="slide" src="http://anythingforachickenwing.com/wp-content/uploads/2014/12/title.png" />
    </div>
    <div class="smoke" style="opacity: 0; left: 265.239558015019px; bottom: 585.729198143397px;"></div><div class="smoke" style="opacity: 0; left: 111.303957477212px; bottom: 521.699095993304px;"></div><div class="smoke" style="opacity: 0; left: 239.788159001619px; bottom: 553.840273584435px;"></div><div class="smoke" style="opacity: 0; left: 88.1203758250922px; bottom: 460.576940496822px;"></div><div class="smoke" style="opacity: 0; left: 256.351662445813px; bottom: 459.45647378021px;"></div><div class="smoke" style="opacity: 0; left: 213.352671097964px; bottom: 473.240349265965px;"></div><div class="smoke" style="opacity: 0.0428989610039475; left: 124.163146708161px; bottom:     406.1637748553px;"></div><div class="smoke" style="opacity: 0; left: 123.810111656785px; bottom: 432.110615685945px;"></div><div class="smoke" style="opacity: 0.521737447880111; left: 265.582363512367px; bottom: 334.704566204715px;"></div><div class="smoke" style="opacity: 0.999999959327771; left: 189.805412730202px; bottom: 262.790356662239px;"></div><div class="smoke" style="opacity: 0.889399847109862; left: 272.278033960611px; bottom: 250.057484541929px;"></div><div class="smoke" style="opacity: 0.897183034785094; left: 84.0002758614719px; bottom: 250.93308124543px;"></div><div class="smoke" style="opacity: 0.386225119123995; left: 154.982028547674px; bottom: 193.450337617564px;"></div><div class="smoke" style="opacity: 0.134262293133453; left: 189.276512218639px; bottom: 165.104502551952px;"></div><div class="smoke" style="opacity: 0.0615213497479412; left: 233.832862060517px; bottom: 156.921147440053px;"></div></div>

<script type="text/javascript">$(function(){
    if(!$.browser.msie){
        var a=0;for(;a<15;a+=1){setTimeout(function b(){var a=Math.random()*1e3+5e3,c=$("<div />",{"class":"smoke",css:{opacity:0,left:Math.random()*200+80}});$(c).appendTo("#viewport");$.when($(c).animate({opacity:1},{duration:a/4,easing:"linear",queue:false,complete:function(){$(c).animate({opacity:0},{duration:a/3,easing:"linear",queue:false})}}),$(c).animate({bottom:$("#viewport").height()},{duration:a,easing:"linear",queue:false})).then(function(){$(c).remove();b()})},Math.random()*3e3)}
    }else{      
    "use strict";var a=0;for(;a<15;a+=1){setTimeout(function b(){var a=Math.random()*1e3+5e3,c=$("<div />",{"class":"smoke",css:{left:Math.random()*200+80}});$(c).appendTo("#viewport");$.when($(c).animate({},{duration:a/4,easing:"linear",queue:false,complete:function(){$(c).animate({},{duration:a/3,easing:"linear",queue:false})}}),$(c).animate({bottom:$("#viewport").height()},{duration:a,easing:"linear",queue:false})).then(function(){$(c).remove();b()})},Math.random()*3e3)}}}())</script>

</div>



<div id="inner-content" class="wrap cf">

<div id="intro">
<h1>welcome to anything for a chicken wing. featuring wings from the space coast (and surrounding areas). 
if you've got a wing joint you think should be on here please, <a href="http://anythingforachickenwing.com/contact">drop me a line.</a>


</h1>


</div>

</div>
            <div id="content">

                <div id="inner-content" class="wrap cf">

                        <main id="main" class="m-all t-2of3 d-5of7 cf" role="main" itemscope itemprop="mainContentOfPage" itemtype="http://schema.org/Blog">

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

                            <article id="post-<?php the_ID(); ?>" <?php post_class( 'cf' ); ?> role="article">

                                <header class="article-header">

                                    <h1 class="h2 entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
                                    <p class="byline entry-meta vcard">
                                                        <?php printf( __( 'Posted %1$s by %2$s', 'bonestheme' ),
                                                    /* the time the post was published */
                                                    '<time class="updated entry-time" datetime="' . get_the_time('Y-m-d') . '" itemprop="datePublished">' . get_the_time(get_option('date_format')) . '</time>',
                                                    /* the author of the post */
                                                    '<span class="by">by</span> <span class="entry-author author" itemprop="author" itemscope itemptype="http://schema.org/Person">' . get_the_author_link( get_the_author_meta( 'ID' ) ) . '</span>'
                                                ); ?>
                                    </p>

                                </header>

                                <section class="entry-content cf">
                                    <?php the_content(); ?>
                                </section>

                                <footer class="article-footer cf">
                                    <p class="footer-comment-count">
                                        <?php comments_number( __( '<span>No</span> Comments', 'bonestheme' ), __( '<span>One</span> Comment', 'bonestheme' ), __( '<span>%</span> Comments', 'bonestheme' ) );?>
                                    </p>


                    <?php printf( '<p class="footer-category">' . __('filed under', 'bonestheme' ) . ': %1$s</p>' , get_the_category_list(', ') ); ?>

                  <?php the_tags( '<p class="footer-tags tags"><span class="tags-title">' . __( 'Tags:', 'bonestheme' ) . '</span> ', ', ', '</p>' ); ?>


                                </footer>

                            </article>

                            <?php endwhile; ?>

                                    <?php bones_page_navi(); ?>

                            <?php else : ?>

                                    <article id="post-not-found" class="hentry cf">
                                            <header class="article-header">
                                                <h1><?php _e( 'Oops, Post Not Found!', 'bonestheme' ); ?></h1>
                                        </header>
                                            <section class="entry-content">
                                                <p><?php _e( 'Uh Oh. Something is missing. Try double checking things.', 'bonestheme' ); ?></p>
                                        </section>
                                        <footer class="article-footer">
                                                <p><?php _e( 'This is the error message in the index.php template.', 'bonestheme' ); ?></p>
                                        </footer>
                                    </article>

                            <?php endif; ?>


                        </main>
<?php get_sidebar(); ?>


                </div>

            </div>


<?php get_footer(); ?>

【问题讨论】:

  • 您的图片不显示在首页或仪表板中吗?如果首页出现此问题,请添加您感兴趣的 HOME.php 或 index.php 代码。
  • 我不知道你在说什么。这些图像在其他主题中工作正常,它们在仪表板中,并且它们还为“特征图像”设置了每个帖子。
  • 好吧,你能添加你的(如果存在的话)home.php 或 index.php 代码吗?您在此主题中显示图像的问题,而不是定义图像。
  • 上面的index.php代码我已经添加了,谢谢。

标签: php wordpress


【解决方案1】:

您的主题没有缩略图获取代码。请像这样更新 While Loop

                        <article id="post-<?php the_ID(); ?>" <?php post_class( 'cf' ); ?> role="article">

                            <header class="article-header">

                                <h1 class="h2 entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
                                <p class="byline entry-meta vcard">
                                                    <?php printf( __( 'Posted %1$s by %2$s', 'bonestheme' ),
                                                /* the time the post was published */
                                                '<time class="updated entry-time" datetime="' . get_the_time('Y-m-d') . '" itemprop="datePublished">' . get_the_time(get_option('date_format')) . '</time>',
                                                /* the author of the post */
                                                '<span class="by">by</span> <span class="entry-author author" itemprop="author" itemscope itemptype="http://schema.org/Person">' . get_the_author_link( get_the_author_meta( 'ID' ) ) . '</span>'
                                            ); ?>
                                </p>

                            </header>

                            <section class="entry-content cf">
                                <?php     the_post_thumbnail( array(125, 125) ); the_content(); ?>
                            </section>

                            <footer class="article-footer cf">
                                <p class="footer-comment-count">
                                    <?php comments_number( __( '<span>No</span> Comments', 'bonestheme' ), __( '<span>One</span> Comment', 'bonestheme' ), __( '<span>%</span> Comments', 'bonestheme' ) );?>
                                </p>


                <?php printf( '<p class="footer-category">' . __('filed under', 'bonestheme' ) . ': %1$s</p>' , get_the_category_list(', ') ); ?>

              <?php the_tags( '<p class="footer-tags tags"><span class="tags-title">' . __( 'Tags:', 'bonestheme' ) . '</span> ', ', ', '</p>' ); ?>


                            </footer>

                        </article>

【讨论】:

  • 抱歉语法错误,我现在在 Android 中。下午我会编辑它。
  • 谢谢您,非常感谢您的帮助。我会做类似的事情来使图像更大吗?不是缩略图 - 看起来更好的更大图像,以及如何使图像显示在实际帖子中?一旦您单击帖子标题,它似乎就消失了。再次感谢!!
  • 其实我现在明白了!再次感谢您的所有帮助!
猜你喜欢
  • 1970-01-01
  • 2015-11-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-02
  • 1970-01-01
  • 2015-05-03
  • 2019-05-11
相关资源
最近更新 更多