ওয়ার্ডপ্রেসে পোষ্টের আর্কাইভকে উলম্ব বারে প্রর্দশন করা!!

ওয়ার্ডপ্রেসে ডিফল্ট আর্কাইভ উইজেটস এবং ক্যালেন্ডারের উইজেটস এর মাধ্যমে মাস হিসাবে আর্কাইভ দেখানো যায়। আমরা দেখাবো কিভাবে আর্কাইভ বছর/মাসের...

ওয়ার্ডপ্রেসে ডিফল্ট আর্কাইভ উইজেটস এবং ক্যালেন্ডারের উইজেটস এর মাধ্যমে মাস হিসাবে আর্কাইভ দেখানো যায়। আমরা দেখাবো কিভাবে আর্কাইভ বছর/মাসের পোস্টের সংখ্যাকে উলম্ব বার আকারে প্রদর্শণ করা যায়। ফলে প্রতিটি বছর এক একটি রো হিসাবে দেখাবে এবং প্রতিটি রো তে ১২টি মাস থাকবে। যে মাসে কোন পোস্ট থাকেবে না যেই মাসের উলম্ব বার শুন্য থাকবে।



যখন কোন বছরের রো এর উপরে মাউস রাখবেন তখন উক্ত বছরের মোট পোষ্টের সংখ্যা দেখাবে এবং যখন কোন মাসের উপরে মাউস রাখবেন তখন উক্ত মাসের পোষ্টের সংখ্যা দেখাবে।
নিচেন ফাংশনটি functions.php এ লিখুন।


function royal_bar_month_archives() {
global $wpdb;
$where = "WHERE post_type = 'post' AND post_status = 'publish'";
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY YEAR DESC, MONTH ASC";
$_archive = $wpdb->get_results( $query );

$last_year = (int) $_archive[0]->year;
$first_year = (int) $_archive[ count( $_archive ) - 1 ]->year;

$archive = array();
$max = 0;
$year_total = array();

foreach( $_archive as $data ) {
if( !isset( $year_total[ $data->year ] ) ) {
$year_total[ $data->year ] = 0;
}
$archive[ $data->year ][ $data->month ] = $data->posts;
$year_total[ $data->year ] += $data->posts;
$max = max( $max, $data->posts );
}
unset( $_archive );

for ( $year = $last_year; $year >= $first_year; $year-- ) {
echo '<div class="archive_year">';
echo '<span class="archive_year_label">' . $year;
if( isset( $year_total[$year] ) ) {
echo '<span class="archive_year_count">' . $year_total[$year] . ' posts</span>';
}
echo '</span>';
echo '<ol>';
for ( $month = 1; $month <= 12; $month++ ) {
$num = isset( $archive[ $year ][ $month ] ) ? $archive[ $year ][ $month ] : 0;
$empty = $num ? 'not_empty' : 'empty';
echo "<li class='$empty'>";
$height = 100 - max( floor( $num / $max * 100 ), 20 );
if( $num ) {
$url = get_month_link( $year, $month );
$m = str_pad( $month, 2, "0", STR_PAD_LEFT);
echo "<a href='$url' title='$m/$year : $num posts'><span class='bar_wrap'><span class='bar' style='height:$height%'></span></span>";
echo "<span class='label'>" . $m . "</span>";
echo "</a>";
}
echo '</li>';
}
echo '</ol>';
echo "</div>";
}
}

 নিচের সিএসএস css.php লিখুন


/* Bar Archive */
#archives ol {
margin:-3px 0 5px;
padding:0;
list-style:none;
overflow:hidden;
width:100%;
}
#archives ol li {
display:inline-block;
float:left;
width:8%;
height:30px;
margin-left:.33333%;
background:#D6E685;
}
#archives ol li.empty {
background:rgba(246, 248, 231, 0.5);
}
#archives ol li a {
display:inline-block;
width:100%;
height:20px;
background:none;
padding:0;
}
#archives ol li a:hover {
border-radius:0;
background:inherit;
}
#archives span.bar_wrap {
width:100%;
height:100%;
zbackground:#F6F8E8;
display:block;
}
#archives span.bar {
width:100%;
background:#F6F8E8;
display:block;
}
#archives ol li.not_empty:hover {
background:#44A340;
}
#archives span.label {
display:block;
width:100%;
height:10px;
font-size:10px;
text-align:center;
line-height:2px;
color:transparent;
padding:2px 0px;
}
#archives ol li.not_empty:hover span.label {
color:white;
}
#archives .archive_year_label {
font-size:12px;
font-weight:bold;
color:#1E6823;
padding-left:2px;
}
#archives .archive_year:hover .archive_year_label {
color:#333;
}
#archives .archive_year_count {
display:none;
}
#archives .archive_year:hover .archive_year_count {
display:inline;
margin-left:30px;
color:#8CC665;
}

 এবার যেখানে আর্কাইভ দেখাতে চান সেখানে নিচের ফংশনটি কল করুন?


<div id='archives'>
<?php royal_bar_month_archives(); ?>
</div>


ফলাফল নিচের স্ক্রিনশেটর মত দেখাবে
বার আর্কাইভ

COMMENTS

Name

Blogger,1,Blogger Tips,1,Book,1,Computer Tips,4,facebook,7,featured,9,Freelancing,1,Internet,1,linux-লিনাক্স,2,Mobile,2,News & Offer,2,Other,2,SEO,3,Tips & Tricks,9,Toturial,1,Windows,2,Youtube,1,অনলাইন আয়,3,অ্যালেক্সা র‌্যাকিং,1,আউটসোসিং,5,ই-বুক,7,ইউটিউব,1,ইন্টারনেট,19,উইন্ডোজ,17,এইচটিএমএল,6,এন্ট্রিভাইরাস,3,এন্ড্রোয়েড,12,এসইও,11,ওপেন সোর্স,3,ওয়ার্ডপ্রেস,6,ওয়ার্ডপ্রেস এসইও,1,ওয়ার্ডপ্রেস টিপস,4,ওয়ার্ডপ্রেস প্লাগিন্স,2,ওয়েডগেট,28,ওয়েব ডিজাইন,5,ওয়েব ব্রাউজার,1,ক্র্যাক,3,খবর,24,গুগল,6,গেমস,4,টিউটোরিয়াল,17,টিপস এন্ড টিকস,10,টিপস এন্ড ট্রিকস,50,টুইটার,2,টেম্পেলেট,9,ডাউনলোড,32,নোটপ্যাড,1,পিসি টিপস,1,পোর্টেবল,1,ফেসবুক,21,বিজ্ঞান ও প্রযুক্তি,5,বিনোদন,12,ব্লগার,51,ব্লগার টিপস,53,মাইক্রোসফট,1,মিউজিক-MP3,3,মোবাইল,7,মোবাইল অ্যাপস,9,রিভিউ,5,সফটওয়্যার,18,সিএসএস,5,সিকিউরিটি,2,সোস্যাল মিডিয়া,5,
ltr
item
Projuktie Mela | The World's Learge Comunity Bnagla IT Blogging Platform (প্রযুক্তির মেলা): ওয়ার্ডপ্রেসে পোষ্টের আর্কাইভকে উলম্ব বারে প্রর্দশন করা!!
ওয়ার্ডপ্রেসে পোষ্টের আর্কাইভকে উলম্ব বারে প্রর্দশন করা!!
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg6ypO_dfpNrbXcfJYb7nUzNBMahoBgDgWIrlk81tActCkN0UtG5m4rbnhYtFZreCtZalEWizAAotjKm4Yx5v_8grKPljrj6dqIETj5Zu3oBWYaBrXbxfUSGYaEEHXEAE0dR-bVWWKhpg/s1600/index.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg6ypO_dfpNrbXcfJYb7nUzNBMahoBgDgWIrlk81tActCkN0UtG5m4rbnhYtFZreCtZalEWizAAotjKm4Yx5v_8grKPljrj6dqIETj5Zu3oBWYaBrXbxfUSGYaEEHXEAE0dR-bVWWKhpg/s72-c/index.jpg
Projuktie Mela | The World's Learge Comunity Bnagla IT Blogging Platform (প্রযুক্তির মেলা)
https://projuktiemela.blogspot.com/2015/06/blog-post_29.html
https://projuktiemela.blogspot.com/
https://projuktiemela.blogspot.com/
https://projuktiemela.blogspot.com/2015/06/blog-post_29.html
true
2949705361236741623
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy