Reduce spam by using .htaccess
Adding the following shortcode will let you reduce spam on your WordPress blog by using .htaccess. Simply paste the following lines into your .htaccess file but also make a note that you do make a backup
Adding the following shortcode will let you reduce spam on your WordPress blog by using .htaccess. Simply paste the following lines into your .htaccess file but also make a note that you do make a backup
The following snippet will let you remove as well as hide admin menu links for certain users or role.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if (current_user_can('hide_jobs')) { add_action( 'admin_menu', 'my_remove_menu_jobs' ); function my_remove_menu_jobs() { remove_menu_page('edit.php?post_type=job'); remove_menu_page('edit.php?post_type=solution'); remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // right now } } |
Source: Snipplr
The following snippet will allow you to get all
Using the code will change the text in the bottom of the WP admin pages.
1 2 3 4 5 6 7 8 9 10 11 |
<?php function remove_footer_admin () { echo 'My footer text. Thank you <a href="http://wordpress.org">Wordpress</a> for giving me this filter.'; } add_filter('admin_footer_text', 'remove_footer_admin'); ?> |
Adding the snippet to your theme’s functions.php file will let you appear your future
Adding the following snippet to function.php file will let you update WordPress URL
1 2 3 4 5 6 7 |
<?php update_option('siteurl','http://EURE-SITE.de/'); update_option('home','http://EURE-SITE.de/'); ?> |
Source: Snipplr
The snippet let you set some WordPress directories / paths directly
The following snippet will allow you to load all the posts from the current week.
1 2 3 4 5 6 7 8 9 |
$query_args = array( 'w' => date( 'W' ), 'year' => date( 'Y' ), ); $posts = get_posts( $query_args ); |
Source: MarketPress – Christian Brückner
While there are numbers of plugins available
The snippet below will let you have the author bio excerpt.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?php // Paste the code below to the functions.php file inside the theme directory you're using. function author_excerpt (){ $word_limit = 20; // Limit the number of words $more_txt = 'read more about:'; // The read more text $txt_end = '...'; // Display text end $authorName = get_the_author(); $authorUrl = get_author_posts_url( get_the_author_meta('ID')); $authorDescription = explode(" ", get_the_author_meta('description')); $displayAuthorPageLink = count($authorDescription) > $word_limit ? $txt_end.' '.$more_txt.' <a href="'.$authorUrl.'">'.$authorName.'</a>' : '' ; $authorDescriptionShort = array_slice($authorDescription, 0, ($word_limit)); return (implode($authorDescriptionShort, ' ')).$displayAuthorPageLink; } ?> <?php // Add this code snippet to the single.php file where you like to display the author bio excerpt. if (function_exists('author_excerpt')){echo author_excerpt();} ?> |
The following snippet will let you disable self trackbacks.
1 2 3 4 5 6 7 8 |
<?php function disable_self_ping( &$links ) { foreach ( $links as $l => $link ) if ( 0 === strpos( $link, get_option( 'home' ) ) ) unset($links[$l]); } add_action( 'pre_ping', 'disable_self_ping' ); ?> |
The following
The snippet below will allow you to disable plugin updates.
1 2 3 4 |
<?php remove_action( 'load-update-core.php', 'wp_update_plugins' ); add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) ); ?> |
The snippet below will let you list all categories with posts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<?php //for each category, show all posts $cat_args=array( 'orderby' => 'name', 'order' => 'ASC' ); $categories=get_categories($cat_args); foreach($categories as $category) { $args=array( 'showposts' => -1, 'category__in' => array($category->term_id), 'caller_get_posts'=>1 ); $posts=get_posts($args); if ($posts) { echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> '; foreach($posts as $post) { setup_postdata($post); ?> <p><a href=" <?php the_permalink() ?> " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?> "> <?php the_title(); ?> </a></p> <?php } // foreach($posts } // if ($posts } // foreach($categories ?> |
The following
The following snippet will let you redirect your author archive link to your website’s about us page.
1 2 3 4 |
add_filter( 'author_link', 'my_author_link'); function my_author_link() { return home_url( 'about' ); } |
The following snippet will let you change image path only.
The following snippet will let you temporarily close down your site for visits while your website can still be accessed by admins resulting in letting you do the changes that you are planning for
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; } |
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> |
The following
Powered by WordPress & Theme by Anders Norén