This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function additional_post_classes( $classes ) { | |
| global $wp_query; | |
| if( $wp_query->found_posts < 1 ) { | |
| return $classes; | |
| } | |
| if( $wp_query->current_post == 0 ) { | |
| $classes[] = 'post-first';//ループ内の最初の投稿にpost-firstというclass名を与える |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function future_posts_in_feed($query) { | |
| if ($query->is_feed) { | |
| $query->set('post_status','publish,future'); | |
| } | |
| return $query; | |
| } | |
| add_filter('pre_get_posts','future_posts_in_feed'); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'init', 'my_custom_menus' ); | |
| function my_custom_menus() { | |
| register_nav_menus( | |
| array( | |
| 'primary-menu' => __( 'Primary Menu' ), | |
| 'secondary-menu' => __( 'Secondary Menu' ) | |
| ) | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function oddeven_post_class ( $classes ) { | |
| global $current_class; | |
| $classes[] = $current_class; | |
| $current_class = ($current_class == 'odd') ? 'even' : 'odd'; | |
| return $classes; | |
| } | |
| add_filter ( 'post_class' , 'oddeven_post_class' ); | |
| global $current_class; | |
| $current_class = 'odd'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| query_posts('showposts=5&category_name=foo'); | |
| if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
| <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> | |
| <?php the_content(); ?> | |
| <?php | |
| endwhile; else: | |
| // No posts. | |
| endif; | |
| wp_reset_query(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (strpos($_SERVER[HTTP_REFERER], "twitter.com") == true) { | |
| echo "Hello Twitter User!"; | |
| } | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php add_filter('login_errors', create_function('$a', "return null;")); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php define('EMPTY_TRASH_DAYS', 5 ); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ul> | |
| <li><h2>ランダム記事</h2> | |
| <ul> | |
| <?php | |
| $rand_posts = get_posts('numberposts=5&orderby=rand'); | |
| foreach( $rand_posts as $post ) : | |
| ?> | |
| <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> | |
| <?php endforeach; ?> | |
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-count="vertical" data-via="<?php bloginfo('name') ?>">Tweet</a> | |
| <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> |