** 这是我的密码**
<?php echo get_avatar( get_the_ID() ); ?>
<a href="<?php echo get_author_posts_url( get_the_author_meta( \'ID\' ) ); ?>">
<h4><?php echo get_the_author_meta(\'display_name\', $author_id); ?></h4>
</a>
<!-- end author name and image -->
<p class="p-text">
<?php the_author_description(); ?>
</p>
<!-- end author description -->
<ul class="social-links">
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-dribbble"></i></a></li>
<li><a href="#"><i class="fa fa-behance"></i></a></li>
</ul>
<!-- end author social media icons -->
<img src="<?php echo get_post_meta( get_the_ID(), \'author_sign\', true) ?>" alt="">
<p><?php echo get_post_meta( get_the_ID(), \'author_text\', true ) ?></p>
<!-- end author sign here -->
</div>
<!-- end author information -->
**这是我的cmb2代码**
$author_data = new_cmb2_box( array(
\'id\' => \'author_metabox\',
\'title\' => __( \'Custom Author Information\', \'bounty\' ),
\'object_types\' => array( \'user\' ),
) );
$author_data->add_field( array(
\'id\' => \'author_sign\',
\'type\' => \'file\',
\'name\' => __( \'Upload Author Sign: \', \'bounty\' ),
\'options\' => array(
\'url\' => false
)
) );
SO网友:Ivan Shatsky
根据CMB2 documentation, 而不是
<img src="<?php echo get_post_meta( get_the_ID(), \'author_sign\', true) ?>" alt="">
你应该使用
<?php echo wp_get_attachment_image( get_post_meta( get_the_ID(), \'author_sign\', true ), \'medium\' ); ?>
或
<img src="<?php echo wp_get_attachment_image_url( get_post_meta( get_the_ID(), \'author_sign\', true ), \'medium\' ); ?>" alt="">