'It is Ajax Archive Calendar', 'text_domain') // Args ); } /********************** It will be sow home page**************** */ function widget($args, $instance) { global $wp_locale,$m, $monthnum, $year; extract($args); $title = apply_filters('widget_title', $instance['title']); $bengali=$instance['bangla']; /* Before widget (defined by themes). */ echo $before_widget; /* $title define by from */ if ($title) /* after title and before title defince by thime */ echo $before_title . $title . $after_title; /* end title */ /* now start your degine */ ?>
'Archive Calendar'); $instance = wp_parse_args((array) $instance, $defaults); ?>

get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1"); if (!$gotsome) { $cache[$key] = ''; wp_cache_set('get_calendar', $cache, 'calendar'); return; } } if (isset($_GET['w'])) $w = '' . intval($_GET['w']); // week_begins = 0 stands for Sunday $week_begins = intval(get_option('start_of_week')); // Let's figure out when we are if (!empty($monthnum) && !empty($year)) { $thismonth = '' . zeroise(intval($monthnum), 2); $thisyear = '' . intval($year); } elseif (!empty($w)) { // We need to get the month from MySQL $thisyear = '' . intval(substr($m, 0, 4)); $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')"); } elseif (!empty($m)) { $thisyear = '' . intval(substr($m, 0, 4)); if (strlen($m) < 6) $thismonth = '01'; else $thismonth = '' . zeroise(intval(substr($m, 4, 2)), 2); } else { $thisyear = gmdate('Y', current_time('timestamp')); $thismonth = gmdate('m', current_time('timestamp')); } $unixmonth = mktime(0, 0, 0, $thismonth, 1, $thisyear); $last_day = date('t', $unixmonth); $calendar_output = ''; $myweek = array(); for ($wdcount = 0; $wdcount <= 6; $wdcount++) { $myweek[] = $wp_locale->get_weekday(($wdcount + $week_begins) % 7); } $barr = array('Saturday' => 'শনি', 'Sunday' => 'রবি', 'Monday' => 'সোম', 'Tuesday' => 'মঙ্গল', 'Wednesday' => 'বুধ', 'Thursday' => 'বৃহ', 'Friday' => 'শুক্র'); foreach ($myweek as $wd) { if ('bn' === substr(get_locale(), 0, 2) || $bn==1) { $day_name = $barr[$wd]; } else { $day_name = $wp_locale->get_weekday_abbrev($wd); } $wd = esc_attr($wd); $calendar_output .= "\n\t\t"; } $calendar_output .= ' '; // Get days with posts $dayswithposts = get_posts(array( 'suppress_filters' => false, 'post_type' => 'post', 'post_status' => 'publish', 'monthnum' => $thismonth, 'year' => $thisyear, 'numberposts' => -1, )); if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false) $ak_title_separator = "\n"; else $ak_title_separator = ', '; $daywithpost = array(); $ak_titles_for_day = array(); if ($dayswithposts) { foreach ((array) $dayswithposts as $ak_post) { $daywith = date('d', strtotime($ak_post->post_date)); if (!in_array($daywith, $daywithpost)) { $daywithpost[] = $daywith; } $post_title = esc_attr(get_the_title($ak_post)); if (empty($ak_titles_for_day[$daywith])) // first one $ak_titles_for_day[$daywith] = $post_title; else $ak_titles_for_day[$daywith] .= $ak_title_separator . $post_title; } } //print_r($daywithpost); //print_r($ak_titles_for_day); // See how much we should pad in the beginning $pad = calendar_week_mod(date('w', $unixmonth) - $week_begins); if (0 != $pad) $calendar_output .= "\n\t\t" . ''; $daysinmonth = intval(date('t', $unixmonth)); for ($day = 1; $day <= $daysinmonth; ++$day) { if ('bn' === substr(get_locale(), 0, 2) || $bn==1) { $dayrrr = array( '1' => '১', '2' => '২', '3' => '৩', '4' => '৪', '5' => '৫', '6' => '৬', '7' => '৭', '8' => '৮', '9' => '৯', '10' => '১০', '11' => '১১', '12' => '১২', '13' => '১৩', '14' => '১৪', '15' => '১৫', '16' => '১৬', '17' => '১৭', '18' => '১৮', '19' => '১৯', '20' => '২০', '21' => '২১', '22' => '২২', '23' => '২৩', '24' => '২৪', '25' => '২৫', '26' => '২৬', '27' => '২৭', '28' => '২৮', '29' => '২৯', '30' => '৩০', '31' => '৩১', ); } else { $dayrrr = array( '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30', '31' => '31', ); } $addzeor=array( '1' => '01', '2' => '02', '3' => '03', '4' => '04', '5' => '05', '6' => '06', '7' => '07', '8' => '08', '9' => '09', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30', '31' => '31', ); if (isset($newrow) && $newrow) $calendar_output .= "\n\t\n\t\n\t\t"; $newrow = false; if ($day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp'))) $calendar_output .= ''; if (6 == calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins)) $newrow = true; } $pad = 7 - calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins); if ($pad != 0 && $pad != 7) $calendar_output .= "\n\t\t" . ''; $calendar_output .= "\n\t\n\t\n\t
$day_name
 
'; else $calendar_output .= ''; if (in_array($day, $daywithpost)) // any posts today? $calendar_output .= '$dayrrr[$day]"; else $calendar_output .= '' . $dayrrr[$day] . ''; $calendar_output .= ' 
"; $cache[$key] = $calendar_output; wp_cache_set('get_calendar', $cache, 'calendar'); if ($echo) echo apply_filters('get_calendar', $calendar_output); else return apply_filters('get_calendar', $calendar_output); } function ajax_ac_head() { ?>