0

独自のカスタム ワードプレス テーマを作成しています。

これは私のテーマの index.php にあるものです:

 <?php while (have_posts()) : the_post(); ?>
        <li id="post-<?php the_ID(); ?>">
            <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
            </span>
            <?php if ( has_post_thumbnail()) : ?>
                <a href="<?php the_permalink(); ?>" class="thumb"><img src="<?php the_post_thumbnail(); ?>" /></a>
            <?php endif; ?>
            <div class="post">
                <?php get_the_content(400, "Read more"); ?> <a href="<?php the_permalink(); ?>">Read more</a>.
            </div<br/>

私の functions.php ファイルには次のものがあります。

 <?php

 add_theme_support( 'post-thumbnails', array( 'post' ) );
 the_post_thumbnail( array(80,80) );

 ?>

私のサイトはこれを示しています(画像が読み込まれません):

 <a href="http://ipadappbuzz.com/?p=1" class="thumb"><img src="<img width="50" height="50" src="http://ipadappbuzz.com/wp-content/uploads/article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800-50x50.jpg" class="attachment-post-thumbnail wp-post-image" alt="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" title="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" />" /></a>
                            <div class="post">
                 <a href="http://ipadappbuzz.com/?p=1">Read more</a>.

画像ソースが正しく読み込まれない理由がわかりません。

4

1 に答える 1

1

問題は、別の img の文字列定義を指す img src 属性があることです。

<a href="http://ipadappbuzz.com/?p=1" class="thumb"><img src="<img width="50" height="50" src="http://ipadappbuzz.com/wp-content/uploads/article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800-50x50.jpg" class="attachment-post-thumbnail wp-post-image" alt="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" title="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" />" /></a>
                            <div class="post">
                 <a href="http://ipadappbuzz.com/?p=1">Read more</a>.

これは問題のある行です:

<img src="<img width="50" height="50" src="http://ipadappbuzz.com/wp-content/uploads/article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800-50x50.jpg" class="attachment-post-thumbnail wp-post-image" alt="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" title="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" />" />

次のように修正する必要があります-またはその趣旨の何か:

<img width="50" height="50" src="http://ipadappbuzz.com/wp-content/uploads/article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800-50x50.jpg" class="attachment-post-thumbnail wp-post-image" alt="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" title="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" />

さて、これを生成しているコードについては:

<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>

the_permalink()the_title_attribute()、またはthe_title()関数が何であるか、それらをどのように定義したか、およびそれらが何を返すかはわかりません。しかし、どこかに追加の終了タグを導入したのではないかと疑っています

アップデート:

元のポスターが私を更新したコードから、次のように PHP コードを作成する必要があると思います。

" クラス="親指">"

the_post_thumbnail() がエコーしている/ img を返しているように見えるため:

<img width="50" height="50" src="http://ipadappbuzz.com/wp-content/uploads/article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800-50x50.jpg" class="attachment-post-thumbnail wp-post-image" alt="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" title="article-new_ehow_images_a00_05_uu_decorate-outdoors-halloween-800x800" />
于 2012-10-11T03:21:12.360 に答える