Despite the general awesomeness of WordPress plugins there is a common situation when plugins are an unnecessary headache for the web masters. The point is any plugin brings a series of updates that can crash your WordPress website functionality in some cases.
So if you have some basic PHP skills (we mean really really basic - like being able to copy and paste the pieces of code) or web development experience you might be interested in making some little changes to your WordPress website with your own hands. With this in mind we have prepared for you some short and interesting WordPress hacks that would improve your WP-based without involving any third-party software. There are many simple functions that actually don't need being plugin-powered. These are pagination, contact forms, social media buttons etc. Anyways, just know that this post isn't meant to criticize the existence and usage of WordPress plugins - it's just an alternate point of view so you could have choice. This post is meant for those seeking souls that are looking for simple and interesting solutions to improve their WordPress themes functionality.
* * *
* * *
* * *
* * *
<!--?php
function the_breadcrumb() {
echo '
* * *
function top_comment_authors($amount = 5){
global $wpdb;
$results = $wpdb->get_results('
SELECT
COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
FROM
'.$wpdb->comments.'
WHERE
comment_author_email != "" AND comment_type = "" AND comment_approved = 1
GROUP BY
comment_author_email
ORDER BY
comments_count DESC, comment_author ASC
LIMIT '.$amount
);
$output = "
"; } $output .= "
"; echo $output; }
* * *
function remove_menus()
{
global $menu;
global $current_user;
get_currentuserinfo();
if($current_user->user_login == 'username')
{
$restricted = array(__('Posts'),
__('Media'),
__('Links'),
__('Pages'),
__('Comments'),
__('Appearance'),
__('Plugins'),
__('Users'),
__('Tools'),
__('Settings')
);
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}// end while
}// end if
}
add_action('admin_menu', 'remove_menus');
* * *
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-] )?/?$ http://feeds.feedburner.com/wpbeginner [R=302,NC,L]
* * *
function my_admin_bar_link() {
global $wp_admin_bar;
if ( !is_super_admin() || !is_admin_bar_showing() )
return;
$wp_admin_bar->add_menu( array(
'id' => 'diww',
'parent' => 'my-blogs',
'title' => __( 'Do It With WordPress'),
'href' => admin_url( 'http://www.doitwithwp.com/wp-admin.php' )
) );
}
add_action('admin_bar_menu', 'my_admin_bar_link');
* * *
//Google Maps Shortcode
function do_googleMaps($atts, $content = null) {
extract(shortcode_atts(array(
"width" => '640',
"height" => '480',
"src" => ''
), $atts));
return '';
}
add_shortcode("googlemap", "do_googleMaps");
* * *
* * *
function remove_post_columns($defaults) {
unset($defaults['comments']);
return $defaults;
}
add_filter('manage_posts_columns', 'remove_post_columns');
* * *
* * *
* * *
* * *
Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.
Leave a Reply
You must be logged in to post a comment.