0, ), $atts, 'author_box' ); $author_id = intval($atts['author_id']); // 著者データを取得 $author_data = get_userdata($author_id); if (!$author_data) return ''; // ユーザーデータ $author_name = $author_data->display_name; $description = $author_data->description; $the_user_link_url = $author_data->user_url; ob_start(); ?>
0, ), $atts, 'author_box' ); $author_id = intval($atts['author_id']); // 著者データを取得 $author_data = get_userdata($author_id); if (!$author_data) return ''; // ユーザーデータ $author_name = $author_data->display_name; $description = $author_data->description; $the_user_link_url = $author_data->user_url; ob_start(); ?>
0, ), $atts, 'author_box' ); $author_id = intval($atts['author_id']); // 著者データを取得 $author_data = get_userdata($author_id); if (!$author_data) return ''; // ユーザーデータ $author_name = $author_data->display_name; $description = $author_data->description; $the_user_link_url = $author_data->user_url; ob_start(); ?>
/**
 * 著者情報を出力するショートコード
 * 使用方法: [author_box author_id="1"]
 */
function arkhe_author_box_shortcode($atts) {
    // ショートコードの属性を取得
    $atts = shortcode_atts(
        array(
            'author_id' => 0,
        ),
        $atts,
        'author_box'
    );

    $author_id = intval($atts['author_id']);

    // 著者データを取得
    $author_data = get_userdata($author_id);
    if (!$author_data) return '';

    // ユーザーデータ
    $author_name = $author_data->display_name;
    $description = $author_data->description;
    $the_user_link_url = $author_data->user_url;

    ob_start();
    ?>
    <div class="p-authorBox">
        <figure class="p-authorBox__avatar">
            <?php echo get_avatar($author_id, 100, '', $author_name); ?>
        </figure>
        <div class="p-authorBox__body">
            <?php if (!is_author()) : ?>
                <span class="p-authorBox__name"><?php echo esc_html($author_name); ?></span>
            <?php endif; ?>
            <?php do_action('arkhe_after_author_name', $author_id); // 役職表示用 ?>
            <?php if ($description) : ?>
                <p class="p-authorBox__description u-color-thin">
                    <?php echo wp_kses(nl2br($description), Arkhe::$allowed_text_html); ?>
                </p>
            <?php endif; ?>

            <div class="p-authorBox__footer">
                <div class="p-authorBox__links">
                    <?php if ($the_user_link_url) : ?>
                        <div class="p-authorBox__weblink u-flex--aic">
                            <?php Arkhe::the_svg('link'); ?>
                            <a href="<?php echo esc_url($the_user_link_url); ?>" target="_blank" rel="noopener" class=""><?php echo esc_html($the_user_link_url); ?></a>
                        </div>
                    <?php endif; ?>
                    <?php do_action('arkhe_author_links', $author_id); // アイコンリスト表示用 ?>
                </div>
<a href="<https://twitter.com/seri_nonnon?ref_src=twsrc%5Etfw>" class="twitter-follow-button" data-size="large" data-show-screen-name="false" data-show-count="false">Follow @seri_nonnon</a><script async src="<https://platform.twitter.com/widgets.js>" charset="utf-8"></script>
            </div>
        </div>
    </div>
    <?php
    return ob_get_clean();
}
add_shortcode('author_box', 'arkhe_author_box_shortcode');