我正在使用WordPress,我正在尝试将foreach写入get\\u the\\u author\\u meta here href和<i class="fa fa-facebook"></i>
动态进行我应该如何在循环中编写这是我的代码
echo \'<ul class="at__social">\';
if ( get_the_author_meta( \'google\' ) ) :
echo \'<li><a target="_blank" class="author__social" href="http://plus.google.com/\' . esc_url( get_the_author_meta( \'google\' ) ) . \'?rel=author"><i class="fa fa-google-plus"></i></a></li>\';
endif;
if ( get_the_author_meta( \'pinterest\' ) ) :
echo \'<li><a target="_blank" class="author__social" href="http://pinterest.com/\' . esc_url( get_the_author_meta( \'pinterest\' ) ) . \'"><i class="fa fa-pinterest"></i></a></li>\';
endif;
if ( get_the_author_meta( \'tumblr\' ) ) :
echo \'<li><a target="_blank" class="author__social" href="http://\' . esc_url( get_the_author_meta( \'tumblr\' ) ) . \'.tumblr.com/"><i class="fa fa-tumblr"></i></a></li>\';
endif;*/
echo \'</ul>\';
到目前为止,我已经这样试过了<?php
$at_social = \'<ul class="at__social">\';
if(!empty($at_social)){
echo $at_social;
$author_sociables = array(
\'facebook\',
\'twitter\',
\'instagram\',
\'google\',
\'pinterest\',
\'tumblr\'
);
//$at_link = ;
//$at_icon = ;
foreach($author_sociables as $value){
if ( get_the_author_meta( $value ) ) :
echo \'<li><a target="_blank" class="author__social" href=" . $at_link . \' . esc_url( get_the_author_meta( $value ) ) . \'"><i class="fa fa-facebook"></i></a></li>\';
endif;
}
echo \'</ul>\';
}