1.29.2014

wordpress 個別ページで自分のカテゴリ名、スラッグ取得

個別ページでカテゴリ名、スラッグ取得
<?php $cat = get_the_category(); $cat = $cat[0]; {echo "$cat->cat_name" ;} ?>
<?php $cat = get_the_category(); $cat = $cat[0]; {echo "$cat->category_nicename" ;} ?>

1.27.2014

wordpress 固定ページのスラッグを指定して子ページを取得

$parentPage = get_page_by_path('treadmill');
$parentId = $parentPage->ID;
?>
<h2><a href="">TREADMILL</a></h2>
<ul>
<?php $lastposts = get_posts('post_type=page&posts_per_page=-1&post_parent=' . $parentId); ?>
<?php foreach($lastposts as $post) : setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>

1.26.2014

css transition hover

transitionでhoverアクションを指定する場合、 同じ要素が存在する必要がある。 例) hoverしてborderをつける場合、hover前にもborder: 0を指定

カテゴリ名で指定する

category_name=news
<?php query_posts("category_name=news&showposts=10"); ?>
<?php if(have_posts()): while(have_posts()): the_post(); ?>
    <?php get_template_part('content','excerpt'); ?>
<?php endwhile; endif; ?>