Remove URL from Comment Form
The following snippet will let you remove URL from comment form.
1 2 3 4 5 6 |
add_filter('comment_form_default_fields', 'unset_url_field'); function unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; } |
Display a Random Post
The snippet below will let you display some random post.
1 2 3 4 5 6 7 8 |
<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> |
Customize the Default Avatar
The following snippet will let you customize the default avatar.
1 2 3 4 5 6 7 8 9 |
<?php // Create a new options in the WordPress admin function newgravatar ($avatar_defaults) { $myavatar = get_bloginfo('template_directory') . '/images/avatary.jpg'; $avatar_defaults[$myavatar] = "Avatary"; return $avatar_defaults; } add_filter( 'avatar_defaults', 'newgravatar' ); ?> |
Create a Custom Post Template
The snippet below will let you create a custom post template.
1 2 3 4 5 6 |
<?php /* Single Post Template: [New Template Name] Description: You always want to include a description. Be organized! */ ?> |
Limit Number of Post Revisions
The snippet below will let you limit number of post revisions.
1 2 3 4 5 6 |
<?php // Maximum of 3 revisions define('WP_POST_REVISIONS', 3); // Disable revisions define('WP_POST_REVISIONS', false); ?> |