個別投稿ページ <?php is_single() ?> <?php else: //それ以外だったら?> <?php endif; ?> 個別投稿のページ(または添付ファイルページ・カスタム投稿タイプの個別ページ)が表示されている場合。固定ページには適用されない。 is_single( '17' ) ID 17の投稿が表示されている場合。 is_single( 'Irish Stew' ) "Irish Stew" というタイトルの投稿が表示されている場合。 is_single( 'beef-stew' ) "beef-stew" という投稿スラッグの投稿が表示されている場合。 is_single( array( 17, 'beef-stew', 'Irish Stew' ) ) ID が 17、投稿スラッグが "beef-stew"、またはタイトルが "Irish Stew" のいずれかにあてはまる投稿が表示されている場合。 is_single( array( 17, 19, 1, 11 ) ) Returns true when the single post being displayed is either post ID 17, post ID 19, post ID 1, or post ID 11. is_single( array( 'beef-stew', 'pea-soup', 'chili' ) ) Returns true when the single post being displayed is either the post_name "beef-stew", post_name "pea-soup" or post_name "chili". is_single( array( 'Beef Stew', 'Pea Soup', 'Chili' ) ) Returns true when the single post being displayed is either the post_title "Beef Stew", post_title "Pea Soup" or post_title "Chili". 注: この関数は投稿 ID、投稿タイトル、または投稿名を区別しません。投稿 ID が「17」の投稿をリクエストした場合、タイトルや投稿スラッグが「17」の投稿が表示されることがあります。
日: 2013年12月20日
ページだったら
<?php if(is_page()): ?> <?php else: //それ以外だったら?> <?php endif; ?>
is_page() 固定ページが表示されている場合。 is_page( '42' ) ID 42の固定ページが表示されている場合。 is_page( 'About Me And Joe' ) "About Me And Joe"というタイトルの固定ページが表示されている場合。 is_page( 'about-me' ) "about-me"という投稿スラッグの固定ページが表示されている場合。 is_page( array( 42, 'about-me', 'About Me And Joe' ) ) ID が 42、投稿スラッグが "about-me"、またはタイトルが "About Me And Joe" のいずれかにあてはまる固定ページが表示されている場合。 is_page( array( 42, 54, 6 ) ) ID が 42、54、または6のいずれかの固定ページが表示されている場合。
TOP スライダー 改ページフェード出ない様に
<div id="main_contents_top_fade"> <div id="main_contents_top"> <img src="img/top/jc_top2-04.jpg" width="1000" height="343"> <img src="img/top/jc_top2-01.jpg" width="1000" height="343"> <img src="img/top/jc_top2-03.jpg" width="1000" height="343"> <img src="img/top/jc_top2-02.jpg" width="1000" height="343"> <img src="img/top/jc_top2-05.jpg" width="1000" height="343"> <img src="img/top/jc_top2-08.jpg" width="1000" height="343"> <img src="img/top/jc_top2-07.jpg" width="1000" height="343"> <img src="img/top/jc_top2-06.jpg" width="1000" height="343"> </div id="main_contents_top"> </div id="main_contents_top">
#main_contents_top_fade { width: 1000px; height: 343px; margin-bottom: 20px; } #main_contents_top { width: 1000px; margin-bottom: 20px; position: relative; overflow: hidden; height: 343px; /*display: none;*/ background-color: #FFF; display: none; } #main_contents_top img { top: 0; left: 0; position: absolute; }
<!--TOPフェード--> <script type="text/javascript"> $(function(){ var setImg = '#main_contents_top'; var fadeSpeed = 1500; var switchDelay = 5000; $(setImg).children('img').css({opacity:'0'}); $(setImg + ' img:first').stop().animate({opacity:'1',zIndex:'20'},fadeSpeed); setInterval(function(){ $(setImg + ' :first-child').animate({opacity:'0'},fadeSpeed).next('img').animate({opacity:'1'},fadeSpeed).end().appendTo(setImg); },switchDelay); }); </script> <!--フェードイン--> <script type="text/javascript"> $(document).ready(function() { $('#main_contents_top').fadeIn(0); }); </script>
アドミンバー 管理画面 お客さん
ファンクションへ
アドミンバー
//オリジナルアドミンバーメニュー add_action('admin_bar_menu', 'customize_admin_bar_menu', 9999); function customize_admin_bar_menu($wp_admin_bar){ $title = sprintf( '瀬戸青年会議所' ); $wp_admin_bar->add_menu(array( 'id' => 'bookpress-app', 'meta' => array(), 'title' => $title, 'href' => home_url() )); $wp_admin_bar->add_menu(array( 'parent' => 'bookpress-app', // 親メニューのIDを指定する 'id' => 'bookpress-app-sub4', 'meta' => array(), 'title' => '管理画面へ', 'href' => home_url('/wp-admin/') )); $wp_admin_bar->add_menu(array( 'parent' => 'bookpress-app', // 親メニューのIDを指定する 'id' => 'bookpress-app-sub', 'meta' => array(), 'title' => 'JC NEWSを書く', 'href' => home_url('/wp-admin/post-new.php') )); $wp_admin_bar->add_menu(array( 'parent' => 'bookpress-app', // 親メニューのIDを指定する 'id' => 'bookpress-app-sub2', 'meta' => array(), 'title' => 'ファイルをアップロード', 'href' => home_url('/wp-admin/post-new.php?post_type=member_only') )); $wp_admin_bar->add_menu(array( 'parent' => 'bookpress-app', // 親メニューのIDを指定する 'id' => 'bookpress-app-sub3', 'meta' => array(), 'title' => 'ログアウト', 'href' => wp_logout_url(home_url()) )); } //アドミンバー内容消す add_action('admin_bar_menu', 'customize_admin_bar_menu2', 9999); // 優先順位は大きめで! function customize_admin_bar_menu2($wp_admin_bar){ // Adminバー左側 $wp_admin_bar->remove_node('wp-logo'); // 一番左のWordPressのロゴを消す。 $wp_admin_bar->remove_node('site-name'); // 左から2番めのサイト名を消す。 $wp_admin_bar->remove_node('new-content'); // 「+ 新規」ってメニューを消す。 // Adminバー右側 $wp_admin_bar->remove_node('my-account'); // アカウントのメニューを消す。 $wp_admin_bar->remove_node('search'); // 検索のメニューを消す。 }
ダッシュボード
// ダッシュボードウィジェット非表示 function example_remove_dashboard_widgets() { if (!current_user_can('level_10')) { //level10以下のユーザーの場合ウィジェットをunsetする global $wp_meta_boxes; unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); // 現在の状況 unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); // 最近のコメント unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); // 被リンク unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); // プラグイン unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); // クイック投稿 unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); // 最近の下書き unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); // WordPressブログ unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); // WordPressフォーラム } } add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets'); //☆--オリジナルメニューを追加 function example_dashboard_widget_function() { echo ' <div class="da d1"><a href="./post-new.php">新規 JC NEWS</a></div> <div class="da d1"><a href="edit.php?post_type=member_only">新規 ファイルアップロード</a></div> <div class="da d6"><a href="post-new.php?post_type=public_information">新規 公開情報</a></div> <div style="clear:both"></div> '; } function example_add_dashboard_widgets() { wp_add_dashboard_widget('example_dashboard_widget', '更新', 'example_dashboard_widget_function'); } add_action('wp_dashboard_setup', 'example_add_dashboard_widgets' ); //オリジナルメニューを追加--☆
/*ダッシュボードメニューcss*/ .da{ float: left; padding-top: 10px; padding-right: 5px; padding-bottom: 10px; padding-left: 5px; } .da a{ padding: 15px; background-color: #4091B4; color: #FFF; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; -moz-border-radius-bottomright: 5px; -moz-border-radius-bottomleft: 5px;