Read below about related content about wp+get+recent+comments+2010, You can contact us to improve our contents and site quality

Read below about related content about wp+get+recent+comments+2010, You can contact us to improve our contents and site quality

The Right Way Highlight Author Comments in WordPress

March 27th, 2010 By WP Tricks Posted in Tricks

This Tricks original written by AEXT.net and we only share and to make it more clearly, especially for me. How To Highlight Author Comments in WordPress in the right way.

Highlight Author Comments in WordPress

Highlight Author Comments in WordPress

This code is better for the future and better for scalability such as, if you has more than one author in your WordPress site.

Write down Highlight Author Comments Code below

<li class="comment-container
    <?php
        $authID=get_the_author_meta('ID');
        if($authID == $comment->user_id)
            $oddcomment = 'authcomment';
        echo $oddcomment;
    ?>"  id="comment-<?php comment_ID(); ?>">
        ...

</li>

Read the rest of this entry »

Amazing Touch

Get Recent Comment with Gravatar without plugin

January 24th, 2010 By WP Tricks Posted in Tips

Many WordPress User need to display Recent Comment on the sidebar or footer with Gravatar, most of them using plugin, right now I will show you how to Get Recent Comment with Gravatar without plugin. All need to do just write little bit of code and modified as many you want and you need.

On our recent article, I was cover tips to display most commented post with gravatar without plugin, and I hope you’ll enjoy this tricks too, because this trick also simple and of course useful.

Let’s get started, open your sidebar.php or footer.php or whatever files you need to display recent comment and add this code

<?php
$query = "SELECT * from $wpdb->comments WHERE comment_approved= '1'
ORDER BY comment_date DESC LIMIT 0 ,5";
$comments = $wpdb->get_results($query);

if ($comments) {
    echo '<ul>';
    foreach ($comments as $comment) {
        $url = '<a href="'. get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID).'">';
        echo '<li>';
        echo '<div class="img">';
        echo $url;
        echo get_avatar( $comment->comment_author_email, $img_w);
        echo '</a></div>';

        echo '<div class="txt">Par: ';
        echo $url;
        echo $comment->comment_author;
        echo '</a></div>';
        echo '</li>';
    }
    echo '</ul>';
}
?>

Read the rest of this entry »

Amazing Touch

Added Permalinks Shortcode on WordPress

February 20th, 2010 By WP Tricks Posted in Tips

WordPress is: Themes, Plugins, Widget, Shortcode, PHP and GPL Licensed. Did you know that, beside Widgets, Another useful WordPress API is shortcode, and now I will show you how to added permalinks shortcode into our WordPress site. Why this shortcode is useful? because with permalinks shortcode The generated URL will be updated automatically, when original permalinks on page or post change.

How To Added Permalinks Shortcode

How To Added Permalinks Shortcode

Let’s get started, write down permalinks shortcode functions on your functions.php in your current theme

function do_permalink($atts) {
	extract(shortcode_atts(array(
		'id' => 1,
		'text' => ""  // default value if none supplied
    ), $atts));

    if ($text) {
        $url = get_permalink($id);
        return "<a href='$url'>$text</a>";
    } else {
	   return get_permalink($id);
	}
}
add_shortcode('permalink', 'do_permalink');

Read the rest of this entry »

Amazing Touch

The Right Way to Change The Default Gravatar in WordPress

March 28th, 2010 By WP Tricks Posted in Tricks

I will show you How to Change the Default Gravatar in WordPress, why? Because one of my favourite WordPress Comment enhancement is added Gravatar, after Gravatar become Automattic Family, Gravatar become more and more better. Especially integrated with many many Automattic Family, and of course WordPresss too.

The Right Way to Change The Default Gravatar in WordPress

The Right Way to Change The Default Gravatar in WordPress

Why changed the default (Misery Man) Gravatar? For me, it’s will make our website more unique and of course we can added extra banner or something in our Default Gravatar. Let’s get started, write down tiny code below in your theme functions.php

Change The Default Gravatar Code

add_filter( 'avatar_defaults', 'customgravatar' );

function customgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo('template_directory') . '/images/custom-gravatar.jpg';
    $avatar_defaults[$myavatar] = "WP Tricks & Tips";
    return $avatar_defaults;
}

Read the rest of this entry »

Amazing Touch

Download Gravatar Widget Plugin

April 5th, 2010 By WP Tricks Posted in Plugins

I love and really enjoy Gravatar, we can simply display our avatar or photos in our site and of course on WordPress. Download Gravatar Widget plugin for WordPress. This plugin is the easiest ways to diplay our gravatar on our sidebar or whatever widget. It’s look like WordPress.com.

The question is, why we recommended this Gravatar Widget Plugin? This is some reason we do it.

  • Email address of Gravatar taken from a user on the blog, or any address
  • Change size of Gravatar
  • Image alignment
  • URL for Gravatar (when someone clicks on the image)
  • Add arbitrary text to your widget
  • Fully localized

Read the rest of this entry »

Amazing Touch