Archive for July, 2009
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.
ftp open in explorer by default in windows
by Adrian on Jul.27, 2009, under Programming, Work
How to make explorer open by default when opening an ftp connection, I found can be easy..
I needed to make IE6 style FTP access without the extra pop up step, from a desktop shortcut at work and after much googling, and messing with the registery, attempting to make an ftp site open immediatly in explorer without the main browser opening (pre IE7), I found it can be simply done like this.
1. create a bat file (open notepad, save the file with the affix .bat, making sure .txt is not selected in the dropdown)
2. in the batch file add
1 | start explorer ftp://USERNAME:PASSWORD@FTP_SERVER_ADDRESS |
3. add the shortcut to the desktop, and style the icon
Now when the user clicks the shortcut, voila IE6 style FTP access without the extra step, much easier than poking around with the registery
General discussion RSS Feed