简体   繁体   English

WordPress AuthorBox自定义无效。 我究竟做错了什么?

[英]WordPress AuthorBox customization not working. What am I doing wrong?

I have an interesting setup with my author box code and I can't figure out why the short code isn't displaying. 我的作者框代码有一个有趣的设置,但我不知道为什么短代码没有显示。 This is displaying on a custom post type, not a normal post (not sure if that makes a difference). 这是在自定义帖子类型上显示的,而不是在普通帖子上显示(不确定是否有所不同)。 The shortcode is the only part of the code not working. 短代码是代码中唯一不起作用的部分。 Everything else is just fine. 其他一切都很好。

    function my_genesis_author_box( $output, $context, $pattern, $gravatar, $title, $description ) {

  $twitter = get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) );

  $author_id=get_the_author_meta('ID');

  $description = '<br/><a href="' . $twitter . '">More Mixes</a><br/>' . do_shortcode( '[mycred_my_rank user_id=$author_id]' );

  $output = sprintf( $pattern, $gravatar, $title, $description );

  return $output;
}

Ugh. 啊。 Figured it out. 弄清楚了。 Just had to use \\"$author_id\\" instead. 只需使用\\“ $ author_id \\”代替。 Sorry 抱歉

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM