出于某种原因,我完全被这个问题难住了。
我的头中有一块代码。php
<?php
if ( is_page("Home") ) {
if( have_rows(\'slider\') ): ?>
<div class="my-slider"><ul >
<?php
// loop through the rows of data
while ( have_rows(\'slider\') ) : the_row();
// display a sub field value
$image=get_sub_field(\'image\');
$title= get_sub_field(\'title\');
$byline= get_sub_field(\'byline\');
$link= get_sub_field(\'link\');
?>
<li>
<div style="background-image: url(<?php echo $image; ?>); min-height: 600px; background-repeat: no-repeat; background-size: cover">
<h2><?php echo $title; ?></h2>
</h3><?php echo $byline; ?><h3>
<a href="<?php echo $link ?>"></a>
</li>
<?php endwhile ?>
</div>
<?php
else :
// no rows found ?>
<?php
endif;
} else {
// This is not the blog posts index
}
?>
<div>
这正是我所需要的。然而,我需要能够将其调用到特定的位置,并想我可以将其转换为一个短代码?或者插件会更好?不知道如何开始,感谢您的帮助。