0

独自の author.php テンプレートを作成しました。作成者のカスタム メタ フィールドを表示したい コード サンプルは次の画像にあります: http://prntscr.com/wsdsa

しかし、Wordpressは何も表示しませんか? 私は何をすべきか ?

                <div class="BCol">
                    <?php echo keepAuthorImage(); ?>
                </div>
                <div class="ACol">
                    <div class="A1"><?php echo get_the_author_meta('first_name') ?> <?php echo get_the_author_meta('last_name') ?></div>
                    <div class="A2"><?php echo the_author_meta('job') ?></div>
                    <div class="A3"><?php echo get_the_author_meta('location') ?></div>
                    <div class="A5">
                        <a href="<?php echo get_the_author_meta('userwebpages') ?>" target="_blank"><img src="<?php echo THEME; ?>/_assets/_img/websiteicon.png" alt=""></a>
                        <a href="http://twitter.com/<?php echo get_the_author_meta('twitter') ?>" target="_blank"><img src="<?php echo THEME; ?>/_assets/_img/twitteric.png" alt=""></a>
                        <a href="http://instagram.com/<?php echo get_the_author_meta('instagram') ?>" target="_blank"><img src="<?php echo THEME; ?>/_assets/_img/instagramic.png" alt=""></a>
                    </div>
                    <div class="A4"><?php echo get_the_author_meta('aboute') ?></div>
                </div>

何か役に立ちますか?ありがとう。

4

2 に答える 2

1

Wordpressには、変数が事前に定義されています。

$猫

$タグ

など、使用する必要があります

$著者

あなたのプロセスを作るために。

于 2013-03-18T09:22:20.287 に答える
0

間違っているのは、ループ内でget_the_author_meta()関数を使用していないため、作成者IDを指定する必要があることです。

ループ内で関数を使用するか、以下のコードのように単純なものを使用してください

<?php 
global $current_user;
$current_user = wp_get_current_user();
$uid=$current_user->ID;
?>

関数の作成者メタを次のように変更します

<?php echo get_the_author_meta('first_name',$uid) ?>

すべての作成者メタについては、参照コードhttp://codex.wordpress.org/Function_Reference/get_the_author_metaを確認してください。

于 2013-03-18T07:22:26.050 に答える