php - Part of code into variable -
how can incorporate code in php in "my code" part?
$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> /** code **/ <h4><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4> <span>' . get_the_date() . ' // ' . $in_category . '</span> </li>';
/** code**/
<?php if( get_field('field_name') ): ?> <div><?php the_field('field_name'); ?></p></div> <?php endif; ?>
check out:
$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>'; if( get_field('field_name') ) { $out .= '<div><p>' . the_field('field_name') . '</p></div>'; } $out .= '<h4><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4> <span>' . get_the_date() . ' // ' . $in_category . '</span> </li>';
Comments
Post a Comment