Adrian Callaghan`s Blog

wordpress

wordpress comment count as a button

by Adrian on Jul.30, 2009, under Programming, Work, wordpress

Styling the wordpress comment count as a button/icon etc can be tricky because the normal call to the comments

1
comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'));

formats the output as an anchor point with the correct link, alt tags etc already set up.

So in order to intercept this and then add you own anchor point with divs/imagery etc you need to make a custom request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
// SQL
$SQL = "SELECT COUNT(*) AS Count FROM $wpdb->comments WHERE comment_approved='1'";
$SQL.= "AND comment_post_ID='".intval($post->ID)."'";
 
// Sort the array into a string prefixed with 'Comments '
list($comments) = $wpdb->get_results($SQL, ARRAY_A); 	
$comments='Comments ('.$comments['Count'].')';
 
// generate the alt and title tags
$alt = 'Comment on '.$post->post_title;
 
// echo the button if this is not a single and not a page
if (!is_single() && !is_page()) {
 
// anchor open
echo '<a href="'.get_permalink($post->ID).'" alt="'.$alt.'" title="'.$alt.'">';
 
// complex formatting rules for the comment pop up, go here
echo $comments;
 
// anchor close
echo '</a>';
}

The above does exactly the same, formats the link etc, but now you can access the anchor point directly and format it your own way.

1 Comment more...

WordPress blog to MU

by Adrian on Apr.16, 2009, under Programming, wordpress

Upgrading to wordpress MU manually from an old blog.

At work I had to update an old wordpress installation from 2.3.2 all the way up to the latest version of WordPress Mu (Multi User).

I documented the method I used and placed it below here.
If you do decide to do this it is done entirely at your own risk.
ALWAYS MAKE A BACKUP FIRST

Stage 1

Install Mu on its own database alongside your existing installation and database, within its own directory in the normal way.

Stage 2

Move the data across from Mu performing an upgrade, keeping all the data intact and wordpress Mu functioning correctly.

How this is done

(continue reading…)

5 Comments more...

clikStats

by Adrian on Dec.29, 2008, under Programming, wordpress

clikStats is a wordpress plugin that automatically detects the current links within each post.

ClikStats is retrofitable, and requires no special provision from any classes or code.

Once activated, clikStats will compile who, when, what data which can be viewed through the back office.

The beauty of this plugin is in its portability, it can be used straight out of the box, and provide usefull visitor information, without the need to reverse engineer your posts.

Download the latest version (v0.7) of clikStats from here

Simply add the unzipped folder to your pluggins folder, and make it active to start logging clicks.

Have fun

RELEASE NOTES
v0.3 04.01.09 Provision for pagenation, deletion and better url parsing
v0.4 05.01.09 Required update, due to a naming convention issue
v0.5 18.01.09 Fixed security issues, enhanced UI, extra pages
Big thankyou to Alexandre Araújo for his testing
v0.6 15.02.09 Added search and some nice aesthetics
v0.7 09.05.09 Added clik page/post sourcename, improved date filter system

Some of the best reviews

VanSantos
Daily Seo Blog
Haunting thunder
Tech Ravings
THUK Media

34 Comments more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!