「wordpress」カテゴリーアーカイブ

 コメント (comments.php)

受信したコメントがある時だけ見出しを表示

<?php if(have_comments()): ?>

<?php endif; ?>

受信したコメント表示 + 受信したコメントの出力をカスタマイズ

<?php wp_list_comments(‘callback=mydesign‘); ?>

受信したコメントの出力をカスタマイズ(functions.phpに記載)

function mydesign($comment, $args, $depth){

$GLOBALS[‘comment’] = $comment; ?>

<?php

}

投稿フォーム表示(index.phpに記載(comments.phpを読みこむ)

<?php comments_template(); ?>

/*コメントRSSへのリンクを追加*/

<?php post_comments_feed_link(); ?>

/*トラックバックURL追加*/

<strong>トラックバックURL:</strong>

<?php trackback_url(); ?>

/*トラックバック送信を許可したときだけ表示*/

<?php if(pings_open()): ?>

<?php endif; ?>

よく使う一覧 functions.php

<?php

//ここに書く

?>

//ウィジェット呼び出し(2つ使うときは2つ書く)

register_sidebar();

register_sidebar();

//カスタムメニュー(メニュー2つのとき)メニュー>ナビゲーションバー。サブロケーションを選択

register_nav_menus(array(‘navigation’=>’ナビゲーションバー’,’sublocation’=>’サブロケーション’));

ナビゲーションバー表示(index.phpに記入)

<?php wp_nav_menu(array(‘theme_location’ => ‘navigation’)); ?>

サブロケーションの表示(index.phpに記入)

<?php wp_nav_menu(array(‘theme_location’ => ‘sublocation’)); ?>

//コメントの本文を表示|

<li class=”compost”>

<?php comment_text(); ?>

//コメントの投稿日時を表示|投稿者名を表示

<?php comment_date(); ?><?php comment_time(); ?>|

<?php comment_author_link(); ?>

//カスタム背景機能を有効にする

add_custom_background();

背景を表示する(index.php or header.phpに記載)

<?php wp_head(); ?> </head>内に記載