Add logo to wordpress dashboard login without plugin

If you want to change the WordPress dashboard login logo then this piece of code can meet your requirement.

Just paste this code in the your theme functions.php

function custom_login_logo() {
    echo '<style type="text/css">
        h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.png) !important; }
    </style>';
}

add_action('login_head', 'custom_login_logo');

Some useful wordpress functions

Here is a list of some useful WordPress functions.This may reduce your development time.

wp_mail()

Some time we need to send email to the user.We can use this wordpress function wp_mail() to send email.It works just like the php email function but have better functionality.

wp_loginout()

Displays a login link, or if a user is logged in, displays a logout link.You can even give the redirect url here.SO user will redirect to that url.

esc_url()

This function ejects URLs that do not have one of the provided whitelisted protocols (defaulting to http, https, ftp, ftps, mailto, news, irc, gopher, nntp, feed, and telnet), eliminates invalid characters, and removes dangerous characters.

is_page()

With this function you can check if that particular page is being load.Very handy if you want to load a script only a specific page

Disable Commenting on Posts Older Than 1 Month:

<?php

		function close_comments( $posts ) {

			if ( !is_single() ) { return $posts; }

			if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( 30 * 24 * 60 * 60 ) ) {
			$posts[0]->comment_status = 'closed';
			$posts[0]->ping_status    = 'closed';
			}

		return $posts;
		}
		add_filter( 'the_posts', 'close_comments' );

		?>

Custom Excerpt Length:

function new_excerpt_length($length) {
return 100;
}
add_filter('excerpt_length', 'new_excerpt_length');

Enable excerpts in wordpress page

WordPress in default does not have the excerpt feature on Page.But you can enable this by entering a few lines of code in Theme functions.php of your template.If your theme doesn’t have function.php then please create one.
[highlight]NOTE: Please take a backup of your theme before doing this theme hack.[/highlight]

Here is the code :

// Enable excerpt for wordpress pages
function enable_wp_page_excerpt()
{
    add_post_type_support('page', 'excerpt');
}
add_action('init', 'enable_wp_page_excerpt');

WordPress Blank HTML5 theme

HTML5 comes with a lots of feature! Soon we need to use them in WordPress projects.So i think its better to make a blank HTML5 theme to make my development time shorter.

Here is the screenshot of my Blank HTML5 theme

Wordpress Blank HTML5 theme

Download :

Add floating social icons to Thesis WordPress

In this tutorial i will show you how to add floating social icons to Thesis WordPress .Copy and paste this code for the floating social icons into your Custom Functions.

Note: Always take a backup before any type of modification.

// Make the URL to share
if( is_singular() ) {
$url = get_permalink();
$text = the_title('', '', false);
} else if ( is_category() || is_tag() ) {
if(is_category() ) {
$cat = get_query_var('cat');
$url = get_category_link($cat);
} else {
$tag = get_query_var('tag_id');
$url = get_tag_link($tag);
}
$text = single_cat_title('', false) . ' on ' . get_bloginfo('name');
} else {
$url = get_bloginfo('url');
$text = get_bloginfo('name') . ' - ' . get_bloginfo('description');
}

// Add social buttons to the theme using thesis hook

add_action('thesis_hook_after_content', 'show_social_buttons', 99);

// Add google plus js to the head section of the theme

function google_plus_one_integration() {
?>
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
<?php
}
add_action('wp_head', 'google_plus_one_integration');

// this creates your social icons

function show_social_buttons() {

// I want to show social icons in post and not in homepage

if ( is_singular() ){
?>

<div id="social-float-wrapper" >

<div class="smf-twitter">
<!-- Twitter Code Goes Here -->
<a href="http://twitter.com/share" data-count="vertical" data-via="problogdesign" data-url="<?php echo $url; ?>" data-text="<?php echo $text; ?>">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>

<div class="smf-facebook">
<!-- Facebook Code Goes Here -->
<iframe src="http://www.facebook.com/plugins/like.php?app_id=186708408052490&amp;href=<?php echo urlencode($url); ?>&amp;send=false&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=62" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:62px;" allowTransparency="true"></iframe>
</div>

<div class="smf-plusone">
<!-- Google +1 Code Goes Here -->
<!-- Place this tag where you want the +1 button to render -->
<g:plusone size="medium" href="<?php echo $url; ?>"></g:plusone>
</div>

<div class="smf-stumbleupon">
<!-- stumbleupon Code Goes Here -->
<script src="http://www.stumbleupon.com/hostedbadge.php?s=5"></script>
</div>

<div class="smf-linkedin">
<!-- linkedin Code Goes Here -->
<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share" data-url="<?php the_permalink(); ?>" data-counter="top"></script>
</div>

</div><!-- /social-float -->

<?php } }

Now its time to do some css to float this social icons left of the website.Add this css to your custom.css

/**

* Floating Social Buttons

*/

#social-float-wrapper {
background-color: #FFFFFF;
border: 5px solid rgba(180, 180, 180, 0.7);
border-radius: 8px 8px 8px 8px;
left: 50px;
padding: 10px 5px;
position: fixed;
text-align: center;
top: 50px;
width: 55px;
}

.smf-twitter {
height: 62px;
margin-bottom: 10px;
}

.smf-facebook {
height: 60px;
margin-bottom: 10px;
}

.smf-plusone {
height: 60px;
margin-bottom: 10px;
}
.smf-stumbleupon {
height: 60px;
margin-bottom: 10px;
}
.smf-linkedin {
height: 60px;
margin-bottom: 10px;
}

So now you are ready to add this nice social panel to your website.

Using Loops and Pagination in WordPress

Using loops you can show wordpress content.If you want to show the full content for the first two posts and then just the excerpt for the rest then this code is for you.

<?php
      $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("paged=$page&posts_per_page=5"); ?>

	<?php $count = 1; // Sets count to 1 on first output post ?>

		<?php while (have_posts()) : the_post(); ?>

     <?php if ((!is_paged()) && ($count == 1 || $count == 2)){ // THIS STARTS FULL CONTENT IF IS FIRST POST AND NOT PAGED, THE OR OTHER COUNT ALLOWS FOR SHOWING MORE THAN ONE OF THE FULL CONTENT POSTS BEFORE GOING TO EXCERPTS ?>

                    <?php the_content(); ?>

                    <?php } else { // THIS ends FULL CONTENT and SHOWS FOLLOWING POSTS ELSE ?>

                    <?php the_excerpt(); ?>

<?php } $count++; // THIS IS the END of ELSE and sets count one up ?>


	<?php endwhile; ?>
?>

WP Turbo Autoblogging Premium WordPress Plugin

WP Turbo is a brand new wordpress auto blogging software. Install wpturbo plugin in your wordpress, sit back and relax to see the revenue growth in your ad campaigns. WP Turbo is an auto blogging plugin for WordPress, Create niche blogs on any subject you can think of, mix in videos, music, affiliate products and more.

WPTurbo is a new premium plugin for WordPress that allows you to create powerful nice sites which create content, update themselves automatically and earn you income each month by various affiliate programs.

Read more

How to Add Facebook Like Button in WordPress

Facebook button is very useful and it help you to grow website visitor. First open your single.php or post.php file in your theme’s folder. Then paste the following code before or after the_content() inside your post loop:

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe>

If you want to show the friend icons under the button, then you should use the parameter:

show_face=true

If you want to display the simple button with only the count and nothing else, then you want to use the parameter:

layout=button_count

If you want a darker color scheme for your button, then you need to use the parameter:

colorscheme=dark

If you want to change the text from Like to Recommend, then use the parameter:

action=recommend

Best plugin collection for wordpress template developer

Akismet

Possibly the best way in the world to protect you from web spam.

All In One SEO Pack

Optimizes your WordPress blog for Search Engines.

Inline PHP

The plugin can execute php string in posts/pages, and display the output as the contents of posts/pages.

PHP Code Widget

The normal Text widget allows you to insert arbitrary Text and/or HTML code. This allows that too, but also parses any inserted PHP code and executes it.
Read more

Blank WordPress Theme

The main purpose of this Blank WordPress Theme to make your WordPress theme development time shorter.

The main features of Blank WordPress Theme (version 1) are:

  • The sidebar is widget-ready.
  • Loads google hosted jQuery.
  • Registers the sidebar widget area.
  • Has CSS reset.
  • Theme option page.
  • Post Thumbnail support.
  • Lightweight only 15KB.

The new version 1.5 have the following features:

  • Register navigation menu
  • Better theme option panel

Read more