esearing
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Month without year archiveI created my own hack to the archives widget in order to get month only without year. You have to modify wp-includes/general-template.php and link-template.php. Here is my hack.
FIND in wp-includes/general-template.php
if ( ‘monthly’ == $type ) {INSERT ABOVE
//MONTHONLY CUSTOM TYPE $type = 'monthonly'; if ( 'monthonly' == $type ) { $query = "SELECT MONTH(post_date) AS <code>month</code>, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY MONTH(post_date) ORDER BY MONTH(post_date) $limit "; $key = md5($query); $cache = wp_cache_get( 'wp_get_archives' , 'general'); if ( !isset( $cache[ $key ] ) ) { $arcresults = $wpdb->get_results($query); $cache[ $key ] = $arcresults; wp_cache_add( 'wp_get_archives', $cache, 'general' ); } else { $arcresults = $cache[ $key ]; } if ( $arcresults ) { $afterafter = $after; foreach ( (array) $arcresults as $arcresult ) { /* NOTICE BELOW IS GET_MONTHONLY_LINK FOUND IN link-template.php*/ $url = get_monthonly_link( $arcresult->month); /* translators: 1: month name,*/ $text = sprintf(__('%1$s'), $wp_locale->get_month($arcresult->month) ); if ( $show_post_count ) $after = ' ('.$arcresult->posts.')' . $afterafter; $output .= get_archives_link($url, $text, $format, $before, $after); } } } //END MONTHONLY CUSTOM TYPE
FIND
if ( ” == $type )
$type = ‘monthly’;
CHANGE TO
if ( ” == $type )
$type = ‘monthonly’;FIND IN link-template.php
function get_monthonly_link($year $month) {
INSERT ABOVE//GET_MONTHONLY_LINK function get_monthonly_link($month) { global $wp_rewrite; if ( !$month ) $month = gmdate('m', time()+(get_option('gmt_offset') * 3600)); $monthlink = ''; if ( !empty($monthlink) ) { $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); return apply_filters('monthonly_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $month); } else { return apply_filters('monthonly_link', trailingslashit(get_option('home')) . zeroise($month, 2), $month); } } //END GET_MONTHONLY_LINK
Forum: Fixing WordPress
In reply to: Month without year archiveI can hard code it using sitename/mm where mm is monthnum 01-12 but that does not quite do it since I may not have posts in March.
Can anyone point me to the query for the monthly Archive and its output values.I may be able to modify that.
Forum: Plugins
In reply to: New Plugin: WP-PostRatingsFor POST Ratings –
I am getting the same issue of the database not being created.It might be helpful if you give us the Create table SQL as a separate item so we can add the table via myPHPAdmin. Else I’ll have to dig it out of your code.
Also where do we put the “get highest” code? “Outside the wp-loop” is not very descriptive for those of us not familiar with all lines of code in WP.