微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从Wordpress图库模板中的内容中删除图像

如何解决从Wordpress图库模板中的内容中删除图像

我想将图库模板添加到儿童主题,并且发现很难找到好的示例。迄今为止,我发现的最好的示例是Andres Hermosilla,但该示例可以追溯到2012年。

第1步到第3步将使我得到一半的收益,这是在网站标题上方插入的图片库(此阶段我不需要fluxslider或类似工具。)以下是我正在使用的代码the_title()之前:

<?PHP

$image_args = array(
    'numberposts' => -1,// Using -1 loads all posts
    'orderby' => 'menu_order',// This ensures images are in the order set in the page media manager
    'order'=> 'ASC','post_mime_type' => 'image',// Make sure it doesn't pull other resources,like videos
    'post_parent' => $post->ID,// Important part - ensures the associated images are loaded
    'post_status' => null,'post_type' => 'attachment'
);

$images = get_children( $image_args );
if ( $images ) {
    foreach ( $images as $image ) { ?>
        <img src="<?PHP echo $image->guid; ?>" alt="<?PHP echo $image->post_title; ?>" title="<?PHP echo $image->post_title; ?>" />
    <?PHP    }
} ?>

我的问题是图像本身仍显示在帖子的内容中-如何同时从页面内容删除所有图像?

解决方法

为什么不将类添加到画廊模板页面,并且不显示所有图像,除了使用CSS的画廊图像。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。