Webウォーカーのブログ -2ページ目

Webウォーカーのブログ

ブログの説明を入力します。

最近、太陽光発電を導入しようか考えています。

太陽光発電を導入すると、月々の電気代は安くなるし、

自家発電で安心だと思います。


太陽光発電を関西で設置してくれる会社で調べていると、この会社を見つけたのでメモ。

http://www.top-eco.co.jp/


社員の顔も載せているので安心して頼めるかなと思いました。

http://www.top-eco.co.jp/company.html

<ul>
<?php query_posts('posts_per_page=5&cat=4'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"> <span class="date">
<?php the_time('Y年n月j日'); ?>
<?php
$days=30;
$today=date('U'); $entry=get_the_time('U');
$diff1=date('U',($today - $entry))/86400;
?>
</span>
<?php the_title();?></a>
</li>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
</ul>



◆投稿のカテゴリ指定表示◆

「posts_per_page=5」は最新5件表示ってこと

「cat=4」は投稿のカテゴリID4の記事を表示ってこと





◆カスタム投稿の場合◆

「cat=4」を「post_type=info」とかに変更

「post_type」はカスタム投稿のこと

「info」は自分で付けたカスタム投稿名



◆同じ意味でこんな書き方も出来る↓◆


<?php
$args = array(
'post_type' => 'info', // 表示するカスタム投稿名
'posts_per_page' => 5, // 表示する件数
);
?>


<ul>
<?php query_posts( $args ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"> <span class="date">
<?php the_time('Y年n月j日'); ?>
<?php
$days=30;
$today=date('U'); $entry=get_the_time('U');
$diff1=date('U',($today - $entry))/86400;
?>
</span>
<?php the_title();?></a>
</li>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
</ul>

参考:http://hijiriworld.com/web/wordpress-admin-customize/


//ダッシュボードのカスタマイズ
function example_remove_dashboard_widgets() {
global $wp_meta_boxes;
//unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); // 現在の状況
//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_recent_drafts']); // 最近の下書き
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); // 最近のコメント
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); // クイック投稿
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');