Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 更新:WordPress主页帖子标题后面的特色图片(列)_Php_Wordpress_Image - Fatal编程技术网

Php 更新:WordPress主页帖子标题后面的特色图片(列)

Php 更新:WordPress主页帖子标题后面的特色图片(列),php,wordpress,image,Php,Wordpress,Image,我有一个WordPress网站,有多个帖子。在主页上,我设置了一个插件(),以便显示三列最新的帖子。这工作得很好,我能够在CSS中设置列的样式。然而,我希望每个帖子的特色图片是该帖子专栏的背景?你知道我该怎么做吗 <ul> '; } // thumbnail $thclear = ''; $bullet = '<li style="background:url(<?php'.$thu

我有一个WordPress网站,有多个帖子。在主页上,我设置了一个插件(),以便显示三列最新的帖子。这工作得很好,我能够在CSS中设置列的样式。然而,我希望每个帖子的特色图片是该帖子专栏的背景?你知道我该怎么做吗

<ul>
            ';
        }

        // thumbnail
        $thclear = '';
        $bullet = '<li style="background:url(<?php'.$thumb.'?>);">';
        $thumb = '';
        if ( $args['thumb'] ) {
            if ( has_post_thumbnail($post->ID) ) {
                //$bullet = '';
                $thclear = '<div style="clear:both;"></div>';
                $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $args['tsize'], false, array('class'=>"alignthumb"));
            }
        }
        $ppost .= $bullet .'<a href="'.get_permalink($post->ID).'" title="'.sprintf(__('Article %s published at %s', 'cp'), $title_full, date_i18n(__('F j, Y g:i a'), strtotime($post->post_date)) ).'">'.$title.'</a>';

        // excerpt
        if ( $args['excerpt'] ) {
            $ppost .= '<p>' .get_the_excerpt() .'</p>' .$thclear .'</li>';
        }
        else{
            $ppost .= $thclear .'</li>';
        }

        if ($args['class'] == 'P' && $args['col_cnt'] == $args['col_post'])
            $ppost .= '
            </ul>
    '; } //缩略图 $thclear='';
    $bullet='WordPress没有将“/>转换为src url?我是否正确地编码了echo请求?它似乎没有处理该请求,因此它只是在html中显示为“/>我用更多的信息更新了我的问题。任何帮助都将不胜感激。非常感谢。您可以在定义$thumb之前使用它。在li之前使用if语句定义它。移除
    <li style="background:url(<?php'.$thumb.'?>);">
    
    $image=wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
    
    <img class="whatever" src="<?php echo $image;?>" />
    
    .whatever {
      z-index: -1;
    }