将帖子中的图像发送到外部页面时,我有一个小问题,例如:我想在用作首页标题的滑块中使用最新的帖子图像(我正在使用metabox在帖子中插入图像和卡头))我正在努力实现:
<?php
$popularpost = new WP_Query(
array( 'posts_per_page' => 4, 'post_status' => 'publish', 'orderby' => 'publish_date', 'order' => 'DES')
);
$titles = array();
$s_desc = array();
$image = array();
while ( $popularpost->have_posts()) : $popularpost->the_post();
$titles[] = the_title('', '', FALSE); // set third parameter to FALSE.
$s_desc[] = short_desc();
//$image[] = rwmb_meta( 'my_image', array( 'size' => 'large' ));
endwhile;
?>
<div class="blog-masthead">
<div class="ct-header ct-header--slider ct-slick-custom-dots" id="home">
<div class="ct-slick-homepage" data-arrows="true" data-autoplay="true">
<div class="ct-header tablex item" data-background="">
<div class="ct-u-display-tablex">
<div class="inner">
<div class="container">
<div class="row">
<div class="col-md-8 col-lg-6 slider-inner">
<h1 class="title animated"><?php echo $titles[0]; ?></h1>
<p class="header animated slider-desc"><?php echo $s_desc[0] ?></p>