Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.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 - Fatal编程技术网

Php 我有WordPress网站,我需要从一些帖子中压缩和下载一些图片

Php 我有WordPress网站,我需要从一些帖子中压缩和下载一些图片,php,wordpress,Php,Wordpress,我有一个wordpress网站,我使用这个网站的图像内容。我做了一些改变 我制作了一个插件,通过它的链接为一张图片发帖子,然后我制作了一个新页面来显示新帖子——10天前。我使用代码和短代码查看页面上的-10天帖子。我需要从zip文件中下载-10天帖子中的图片 我怎么能这么做 这是-10天帖子的代码。在function.php文件中为主题编写 function tendays_posts_shortcode($atts) { //defaults extract( shortcode_atts(

我有一个wordpress网站,我使用这个网站的图像内容。我做了一些改变

我制作了一个插件,通过它的链接为一张图片发帖子,然后我制作了一个新页面来显示新帖子——10天前。我使用代码和短代码查看页面上的-10天帖子。我需要从zip文件中下载-10天帖子中的图片

我怎么能这么做

这是-10天帖子的代码。在function.php文件中为主题编写

function tendays_posts_shortcode($atts) {
//defaults
extract( shortcode_atts( array(
    'what' => 'imagelinks',
    'days' => '-10 Days',
), $atts ) );

$args = array(
    'post_type' => $atts['what'],
    'posts_per_page' => '-1',
    'order' => 'DESC',
    'date_query' => array(
        'after' => date('Y-m-d', strtotime($atts['days']))
    )
);
query_posts($args);

// Reset and setup variables
$output = '';
$temp_title = '';
$temp_link = '';

// the loop
if (have_posts()) : while (have_posts()) : the_post();
  $post_img_maisra = wp_get_attachment_url( get_post_thumbnail_id($post->ID));
  $temp_title = get_the_title($post->ID);
  $temp_link = get_permalink($post->ID);
  $output .= "<p class='ten-days-post'><a href='$temp_link'><img class='ten-days-img' width:'100px' 
  height='100'' src='$post_img_maisra'/> $temp_title</a> </p>";
  endwhile; else:

  $output .= "";

 endif;

 wp_reset_query();
 return $output;}
 add_shortcode('tendays_posts','tendays_posts_shortcode');    
function tendays\u posts\u shortcode($atts){
//默认值
提取(短码)附件(数组)(
'什么'=>'图像链接',
“天”=>“-10天”,
)美元(附件);;
$args=数组(
“post_type”=>$atts['what'],
'每页发布'=>'-1',
“订单”=>“描述”,
“日期查询”=>数组(
'在'=>日期('Y-m-d',标准时间($atts['days'])之后
)
);
查询职位($args);
//重置和设置变量
$output='';
$temp_title='';
$temp_link='';
//环路
if(have_posts()):while(have_posts()):the_post();
$post_img_maisra=wp_get_attachment_url(get_post_缩略图_id($post->id));
$temp\u title=获取标题($post->ID);
$temp\u link=get\u permalink($post->ID);
$output.=“

”; 结束时;否则: $output.=“”; endif; wp_reset_query(); 返回$output;} 添加_短码('tendays_posts','tendays_posts_短码');