我正在尝试将帖子的附加视频显示为feature-img。
这在使用以下代码的每个父页面上都很有效:
echo "17" > /sys/class/gpio/export
echo "18" > /sys/class/gpio/export
echo "21" > /sys/class/gpio/export
echo "22" > /sys/class/gpio/export
echo "23" > /sys/class/gpio/export
echo "24" > /sys/class/gpio/export
echo "25" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio17/direction
echo "out" > /sys/class/gpio/gpio18/direction
echo "out" > /sys/class/gpio/gpio21/direction
echo "out" > /sys/class/gpio/gpio22/direction
echo "out" > /sys/class/gpio/gpio23/direction
echo "out" > /sys/class/gpio/gpio24/direction
echo "out" > /sys/class/gpio/gpio25/direction
chmod 666 /sys/class/gpio/gpio17/value
chmod 666 /sys/class/gpio/gpio18/value
chmod 666 /sys/class/gpio/gpio21/value
chmod 666 /sys/class/gpio/gpio22/value
chmod 666 /sys/class/gpio/gpio23/value
chmod 666 /sys/class/gpio/gpio24/value
chmod 666 /sys/class/gpio/gpio25/value
chmod 666 /sys/class/gpio/gpio17/direction
chmod 666 /sys/class/gpio/gpio18/direction
chmod 666 /sys/class/gpio/gpio21/direction
chmod 666 /sys/class/gpio/gpio22/direction
chmod 666 /sys/class/gpio/gpio23/direction
chmod 666 /sys/class/gpio/gpio24/direction
chmod 666 /sys/class/gpio/gpio25/direction
不幸的是,我无法在子页面上使用它。我认为post_parent属性似乎有问题。我也尝试将get_posts更改为
<?php
$attachments = get_posts(array(
'post_type' => 'attachment',
'numberposts' => -1,
'orderby' => 'menu_order',
"order" => "ASC"
));
if ($attachments) :
$i = 0;
foreach ($attachments as $attachment) :
$attachment = get_post($attachment->ID);
$i++;
if ($i > 1)
break;
if ($attachment->post_mime_type != "video/mp4")
continue;
else {
?>
<video autoplay loop onclick="location.href='<?php the_permalink(); ?>'" muted>
<source src="<?php echo $attachment->guid; ?>" type="video/mp4">
</video>
<?php
}
?>
<?php
endforeach;
endif;
?>
,但没有成功。
关于如何解决这个问题的任何想法?
欢呼p