我該如何將代碼合併到「我的代碼」部分的php中?部分代碼到變量中
$out.= '<li class="portfolio_item overlayed_animated_highlight portfolio_item_4' . $slugs . '">
<div class="overlayed">
' . get_the_post_thumbnail() . '
<div class="overlay">
<p>
<a href="'.get_permalink().'"><i class="icon-share"></i></a>
<a href="'.$thumbnail_src.'" class="fancybox" data-fancybox-group="portfolio"><i class="icon-search"></i></a>
</p>
</div>
</div>
/** my code **/
<h4><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>
<span>' . get_the_date() . ' // ' . $in_category . '</span>
</li>';
/**我的代碼**/
<?php if(get_field('field_name')): ?>
<div><?php the_field('field_name'); ?></p></div>
<?php endif; ?>
你應該閱讀這些:http://www.w3schools.com/php/php_syntax.asp,http: //php.net/manual/en/language.operators.string.php和http://www.w3schools.com/php/php_if_else.asp –