Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.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 更改库显示缩略图的方式_Php_Jquery_Html_Css_Wordpress - Fatal编程技术网

Php 更改库显示缩略图的方式

Php 更改库显示缩略图的方式,php,jquery,html,css,wordpress,Php,Jquery,Html,Css,Wordpress,在我的Wordpress站点中,我有一个代码,它显示了大的特色缩略图,然后是站点标题,然后形成图库,然后是站点内容,底部有一个back/next导航 content-single.php代码 <article id="post-<?php the_ID(); ?>"<?php post_class('col-md-12'); ?>> <div class="container"> <?php $thumb = get

在我的Wordpress站点中,我有一个代码,它显示了大的特色缩略图,然后是站点标题,然后形成图库,然后是站点内容,底部有一个back/next导航

content-single.php代码

<article id="post-<?php the_ID(); ?>"<?php post_class('col-md-12'); ?>>
<div class="container">

    <?php
        $thumb = get_post_thumbnail_id();
        $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big)
        $image = aq_resize( $img_url, 1200, 720, true ); //resize & crop the image
    ?>

    <?php if($image) : ?>
    <img class="img-responsive singlepic" src="<?php echo $image ?>"/>
    <?php endif; ?> 

    <?php if ( $post->post_type == 'data-design' && $post->post_status == 'publish' ) {
$attachments = get_posts( array(
    'post_type' => 'attachment',
    'posts_per_page' => -1,
    'post_parent' => $post->ID,
    'exclude'     => get_post_thumbnail_id()
) );

if ( $attachments ) {
    foreach ( $attachments as $attachment ) {
        $class = "post-attachment mime-" . sanitize_title( $attachment->post_mime_type );
        $thumbimg = wp_get_attachment_link( $attachment->ID, 'thumbnail-size', true );
        echo '<li class="' . $class . ' data-design-thumbnail">' . $thumbimg . '</li>';
    }

}
}
?>

<div class="entry-content">
    <header class="entry-header">
        <h1 class="entry-title"><?php the_title(); ?></h1>
    </header>

    <?php the_content(); ?>
    <?php
        wp_link_pages( array(
            'before' => '<div class="page-links">' . __( 'Pages:', 'web2feel' ),
            'after'  => '</div>',
        ) );
    ?>
</div><!-- .entry-content -->

</div>
</article><!-- #post-## -->
我不想要图库,而是希望从图库代码的内容中检索的图像以与特色缩略图相同的方式显示图像。现在它在标题下创建了一个小的图像库

基本上,我希望它是由第一个php代码段创建的大图像,用于堆叠在一起的特色缩略图,然后是内容标题,然后是内容


奇怪的是,当我完全删除gallery代码时,它的显示方式仍然相同。

要以与第一个相同的样式显示图像,只需将foreach循环更改为如下所示

foreach$附件作为$附件{ $img_url=wp_get_attachment_url$attachment->ID,'full'; $image=aq_resize$img_url,1200720,true;
?>/>它似乎没有改变输出。但正如我前面提到的,当我去掉所有函数时,gallery部分仍然显示,因此它必须在其他地方生成,循环将其放在那里,但我没有sure@user3550879画廊代码可能在另一个文件中吗?不是100%确定,但我能够通过调整图像大小,不确定它到底是如何工作的,但我不是一个可以质疑的人