Some people asked me about changing the default wordpress comment template and comment count text. If you are wordpress developer than it is easy.
customize Comment Count Text in wordpress
You can customize the text for displaying comments number or count inside loop. This is just a simple template edit however it is extremely useful if you are creating a theme that is not a traditional theme or you wanted to inject a little bit of personality into the site.
You just need to copy and paste following code into comments.php file.
Using following code you can change:
<?php
echo get_comments_number_text( "No thoughts, yet", "One Thought only", "% thoughts");
?>
wp user want to use other url for admin user. You can easily change using wordpress hook. you can change author url in wordpress without wordpress plugin. using code you can do this. wordpress developer can use this code.
change author url without wordpress plugin
There is default username in wordpress. admin is default username in wordpress but many times user want to use other wordpress user url for admin user. You can easily do this by using following wordpress hook.
You just need to place following code in functions.php file which is your theme folder.
add_action('init', 'change_wordpress_author_url');
function change_wordpress_author_url() {
global $wp_rewrite;
$author_slug = 'new_author_url';
$wp_rewrite->author_base = $author_slug;
}
You need to choose your author url. Just replace the “new_author_url” word and put in functions.php file.
WordPress hack, In this wordpress tutorial we given code and shown, how to get post data outside loop in wordpress. In wordpress theme you can get post data.
how to get post data outside loop in wordpress
Outside the loop you can get the a post data. you just need to copy paste following code in your theme file.
There are many wordpress plugins which using the shortcode. But you easily create custom shortcode for wordpress site. there is no need of external plugin.
custom shortcode for wordpress
Since Version 2.5 WordPress support so called Shortcodes. They have been introduced for creating macros to be use in a posts content. Many people looking for how to create the shortcode in wordpress using theme. It is very easy to build shortcode in wordpress. I given very simple code sample for creating the custom shortcode.
For more information visit following page.
For creating the custom shortcodes you need add following method in functions.php file which is located in your theme folder.
function myshortcode(){
return '<img src="http://images.purabtech.in/How-to-make-empty-the-wordpress-trash-automatically.png">';
}
add_shortcode('myshortcode', 'myshortcode');
you can change the return text or shortcode name aslo.
Many wordpress developers want to remove the theme editor option from wordpress appearance settings menu. Due to security reason removing theme editor from wordpress admin section is really great idea.
In this tutorial I given simple steps to remove theme editor option from your wordpress admin section.
You just need to copy and paste following code into your functions.php file. That will hide the theme editor menu from settings page.
Using following code you can easily remove editor.
function wpapi_remove_editor_menu() {
remove_action('admin_menu', '_add_themes_utility_last', 101);
}
global $remove_submenu_page, $current_user;
get_currentuserinfo();
if($current_user->user_login == 'admin') { //Specify admin name here
add_action('admin_menu', 'wpapi_remove_editor_menu', 1);
}
Jquery lightbox is mostly used for slideshows in web based project. In wordpress that is most favorite. Here I collected some nice wordpress lightbox plugins.
Lightbox Plus ColorBox implements ColorBox as a lightbox image overlay tool for WordPress. ColorBox was created by Jack Moore and is licensed under the MIT License. Lightbox Plus ColorBox for WordPress implements ColorBox as a lightbox image overlay tool for WordPress. ColorBox was created by Jack Moore and is licensed under the MIT License. Lightbox Plus ColorBox permits users to view larger versions of images without having to leave the current page. Lightbox is able to add a lightbox to WordPress gallery images, display simple slide shows, video, forms and external content in overlays. The use of the dark or light background, which dims the page over which the image has been overlaid, also serves to highlight the image or video being viewed. Lightbox Plus ColorBox captures the image title for display in the overlay.
The next generation of Simple Lightbox is here and ready for brave beta testers. Sign up for SLB 2.0 beta now while there’s still space available!
Simple Lightbox is a very simple and highly customizable lightbox that is easy to add to your WordPress website. It also supports skins, so it can be fully integrated with your site’s theme.
From 2.1, the default view changed to Colorbox due to the license regulation by the plugin directory. This plugin used to add the lightbox (overlay) effect to the current page images on your WordPress blog. Used to overlay images on the current page. Extension of wp-jquery-lightbox.
Just install and sit back. This plugin enable image overlay lighbox effect for all the post images in your wordpress plugin. No configuration required.
This plugin lets you keep the awesome Lightbox 2-functionality, but sheds the bulk of the Prototype Framework and Scriptaculous Effects Library.
Warren Krewenki ported Lightbox to jQuery and this plugin is mostly a wrapper to his work: providing localization support, an admin panel for configuration, (optional) auto-boxing of your image links and support for WordPress galleries, including media library titles and captions.
the default view changed to Colorbox due to the license regulation by the plugin directory. If you would prefer the prior Lightbox to Colorbox, you need to get the script from the setting page.
Clifton’s Lightbox implements a lightbox subscription form overlay. Features a title, list, call-to-action, and image or YouTube video. Users can embed their subscription form into the lightbox and use the call-to-action area to encourage new subscribers.
Clifton’s Lightbox Demo
http://cliftonhatfield.com/cliftons-lightbox/
This plugin allows you to create a lightbox popup with custom contents. You can customize the popup display by configuring various settings such as position settings (height, width, top,left), display logic settings (time delay after page load, number of pages to browse, lightbox repeat interval) and style settings(z-index, overlay opacity, color, border etc). You can use the plugin to display any type of contents such as special promotions, subscription forms, social media icons, feedback forms, video presentations and much more.
Makes the native WordPress galleries use a lightbox script called ColorBox to display the fullsize images right there in the page. No modifications required.
Frndzk photo lightbox plugin adds lightbox effect to all photos of every post and pages. it also shows photos in a group of a post like a photo album. it has next and previous to navigate photos. Just install the plugin and see your photos! no setup or configuration needed
demo
http://bitto.us/wp/fpgdemo
In wordpress theming is very important. Developers know the importance of functions.php file. Here we given most used wordpress functions in theme which will be useful for wordpress developer. I always written some very nice code snippets in functions.php file.
most used wordpress functions in theme
I found very useful codes which is very helpful for very wordpress designer and developers.
Here is very useful code snippets. Enable Hidden Admin Feature displaying ALL Site Settings
// CUSTOM ADMIN MENU LINK FOR ALL SETTINGS
function all_settings_link() {
add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php');
}
add_action('admin_menu', 'all_settings_link');
Remove Update Notification for all users except ADMIN User
// REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
global $user_login;
get_currentuserinfo();
if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}
Include custom post types in the search results.
// MAKE CUSTOM POST TYPES SEARCHABLE
function searchAll( $query ) {
if ( $query->is_search ) { $query->set( 'post_type', array( 'site','plugin', 'theme','person' )); }
return $query;
}
add_filter( 'the_search_query', 'searchAll' );
Add your custom post types to your sites main RSS feed by default.
// ADD CUSTOM POST TYPES TO THE DEFAULT RSS FEED
function custom_feed_request( $vars ) {
if (isset($vars['feed']) && !isset($vars['post_type']))
$vars['post_type'] = array( 'post', 'site', 'plugin', 'theme', 'person' );
return $vars;
}
add_filter( 'request', 'custom_feed_request' );
Modify the Login Logo & Image URL Link
add_filter( 'login_headerurl', 'namespace_login_headerurl' );
/**
* Replaces the login header logo URL
*
* @param $url
*/
function namespace_login_headerurl( $url ) {
$url = home_url( '/' );
return $url;
}
add_filter( 'login_headertitle', 'namespace_login_headertitle' );
/**
* Replaces the login header logo title
*
* @param $title
*/
function namespace_login_headertitle( $title ) {
$title = get_bloginfo( 'name' );
return $title;
}
add_action( 'login_head', 'namespace_login_style' );
/**
* Replaces the login header logo
*/
function namespace_login_style() {
echo '<style>.login h1 a { background-image: url( ' . get_template_directory_uri() . '/images/logo.png ) !important; }</style>';
}
Loading jQuery from the Google CDN
// even more smart jquery inclusion :)
add_action( 'init', 'jquery_register' );
// register from google and for footer
function jquery_register() {
if ( !is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', ( 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' ), false, null, true );
wp_enqueue_script( 'jquery' );
}
}
Remove the WordPress Version Info for Security
// remove version info from head and feeds
function complete_version_removal() {
return '';
}
add_filter('the_generator', 'complete_version_removal');
Add Spam & Delete Links to Comments on Front End
// spam & delete links for all versions of wordpress
function delete_comment_link($id) {
if (current_user_can('edit_post')) {
echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&c='.$id.'">del</a> ';
echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&dt=spam&c='.$id.'">spam</a>';
}
}
When you creating site in wordpress, I created unique checklist for self hosted wordpress sites. checklist for self hosted wordpress sites is very important.
checklist for self hosted wordpress sites
When you creating the website in wordpress that time you need to be very careful and you need think and check about following things. I created the checklist for wordpress sites.
About Theme
Use the Minimum images
You should use the sprite image in wordpress theme. That will reduce the webpage loading time.
Use proper and optimized CSS properties
You should use the proper CSS. Dont repeat CSS code. like float, color, margin.
Test the Theme in IE7, IE8 ,Firefox, Safari and Google Chrome
Your theme need to be cross browser compatible.
Use only External CSS
Dont use the inline CSS in Theme.
Use Jquery
Jquery is very popular and simple and seo friendly for wordpress site.
Use the Sidebars in your theme
In sidebar you mostly put the links and ads. That is very important for SEO.
Put the Tag and category links
You should put the tags and category links in theme.
Make Mobile friendly
You theme should viewable in iPhone, iPad, Blackberry mobile devices.
Check in WordPress site
Check Robots.txt file
Put Site title
Get some good Tagline for the site
Create contact us email address
Put Share links ie. Twitter, Facebook, MySpace, RSS, LinkedIn etc.
Create Author’s profile: Email, Website, AIM, Biographical Info
Put the Google Analytics code in your site
Do web master varification
Use the SEO Meta Tags (Use the SEO Meta Tags plugin)
Submit your site to to Yahoo, Google, Bing
Use good wordpress plugins
Use the Permalinks (date and name. if do not want to show category in url then use ‘No Category Base’ plugin)
All Posts and Pages with genuine and useful articles
Create nice Categories and their structure (parent-child)
Remove broken urls (if urls not provided use ‘javascript:;’ in anchor’s href)
Use the Widgets and Menus with their urls
Put Akismet API key -For Spam protection.
Do setting for Media sizes (thumbnail, medium, large)
Uncheck the “Organize my uploads into month- and year-based folders” setting in media setting.
Use the SEO ultimate plugin.
Dont use the plugin for contact form
Here are some useful links which will be helpful to you