【发布时间】:2016-10-27 21:32:15
【问题描述】:
我想在 wordpress 中创建一个投资组合。 它工作正常,但我想在 h2 标题下查看 h3 中的投资组合类别。
其他问题。
现在链接只能在标题 h2 上使用,我希望它在标题中作为链接。
欢迎对代码提出任何建议!非常感谢你
<?php
$args = array( 'post_type' => 'portfolio', 'posts_per_page' => -1 );
$loop = new WP_Query( $args );
$terms = get_the_terms( $post->ID, 'portfolio-categories' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term ) {
$links[] = $term->name;
}
$tax_links = join( " ", str_replace(' ', '-', $links));
$tax = strtolower($tax_links);
else :
$tax = '';
endif;
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="row-masonry">';
echo '<div class="item">';
echo '<div class="well portfolio-item no-gutter">';
echo '<div class="thumbnail no-gutter">'. get_the_post_thumbnail() .'</div>';
echo '<div class="caption">';
echo '<div class="vertical-align">';
$link = get_the_permalink();
echo "<a href=$link>";
echo '<h2>'. get_the_title() .'</h2>';
I want to see here the portfolio image category in h3
echo "</a>";
echo '</div>'; /*close caption*/
echo '</div>'; /*close caption*/
echo '</div>';
echo '</div>';
endwhile;
echo '</div>';
echo '</div>';
echo '</div>';
?>
</div><!-- #page -->
【问题讨论】: