Break long url or word using css to prevent overflow of div container

First of all I am not design expert, not a designer but I learnt many thing about design I mean css, html while working with website projects. Something gave me pain when I found a long url is getting outside of a box(div) in google chrome. After a google search I found a solution… need to use word break though it doesn’t support all browser.

See how a long url go outside of a div box

I found a solution
[code language=”css”]
.box{
white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;
}
[/code]

thanks

আসুন ওয়ার্ডপ্রেসের ড্যাশ বোর্ড পরিস্কার করি

ওয়ার্ডপ্রেসের এডমিন প্যানেলে লগিন করলেই একগাদা বক্স এসে হাজির হয়। যদিও স্ক্রিন অপশন থেকে সেগুলো সহজে তাড়ানো যায় কিন্তু যদি এমন হয় এডমিন নিজেই ড্যাশবোর্ড পরিস্কার করে রেখে দিলেন নতুন সদস্যের জন্য। তবে এই পরিস্কার এর কাজটা আমরা করবো সামান্য কিছু পিএইচপি কোডিং করে।

ধাপ একঃ প্রথমে আপনার থীমের functions.php ফাইলে এ ২টি ফাংশন লিখতে হবে। মনে রাখবেন প্লাগিন এর কোডগুলো চাইলে functions.php ফাইলেও লেখা যায়। তাহলে শুরু করা যাকঃ
[code language=”php”]
//Define the function which unsets the boxes
function remove_dashboard_widgets() {
global $wp_meta_boxes;
myprint_r($wp_meta_boxes);
/*
//unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_right_now’]);
# Remove plugins feed
unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_plugins’]);
unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_plugins’]);
# Remove "WordPress News"
unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_primary’]);
unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_primary’]);
unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_secondary’]);
unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_secondary’]);
# Remove incoming links feed
unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_incoming_links’]);
unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_incoming_links’]);

unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_recent_drafts’]);
unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_recent_comments’]);
unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_quick_press’]);
unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘events_dashboard_window’]);
*/
}
// Now hook in to the action
add_action(‘wp_dashboard_setup’, ‘remove_dashboard_widgets’, 20, 0);

//better print_r function taken from
//http://stackoverflow.com/questions/1386331/php-print-r-nice-table
function myprint_r($my_array) {
if (is_array($my_array)) {
echo "<table border=1 cellspacing=0 cellpadding=3 width=100%>";
echo ‘<tr><td colspan=2 style="background-color:#333333;"><strong><font color=white>ARRAY</font></strong></td></tr>’;
foreach ($my_array as $k => $v) {
echo ‘<tr><td valign="top" style="width:40px;background-color:#F0F0F0;">’;
echo ‘<strong>’ . $k . "</strong></td><td>";
myprint_r($v);
echo "</td></tr>";
}
echo "</table>";
return;
}
echo $my_array;
}

[/code]
Continue reading

Show/Hide comment status text in wordpress

I am again confused if my post title is perfect or not 🙁 So let me explain, sometimes we disable comment for any post or page and at last the text shows “Comments are closed” or something else in different ways. But in commercial projects we need to follow some good design where in some posts or pages we may need to enable comment or not. So, let’s put a trick in theme to show the comment text(comment status in more smart way)

In latest wordpress version the loop is in the loop.php file in the theme folder. So for comment we will get this line

[code language=”php”]
<?php comments_template( ”, true ); ?
[/code]

But how about we put

[code language=”php”]
<?php if($post->comment_status == "open"){comments_template( ”, true );} ?>
[/code]

That means if comment is off then we will not show any text like “Comments are closed” . I strongly believe this trick will make the design clean in some condition 😛

Thank you

How to Insert custom Quicktags into the WordPress Editor

WordPress has two type of editor, one is visual/wysiwyw that is tinymce or replace with other such editors and another is HTML editor that is we call quick tag editor. Today, I want to write something about how to add custom quick tags or custom buttons. I search about it in google and most guides to edit core quick tag javascript file. But I don’t like that and I made my own hack in my own way, though experts may think it’s childish 😛

So let come to point, I wanted to add some buttons that will give me option to add custom class name so that I can format the text well. Same thing can be done via Visual editor but you have to use a plugin named “Tinymce Advanced” which helps to add more advance buttons like styles(class lists) and so on. But for HTML mode or for quick tags editor I didn’t such plugins.
Continue reading

Adding My posts sub menu for posts section in wordpress

Let me explain the situation. Suppose you have contributor access to wordpress. If you go to posts page in admin panel that list all posts   and here you are not author of all posts.  you will see the url like
[code language=”php”]edit.php?post_type=post&all_posts=1[/code] and All( total post number here). There will be another menu named Mine(Current user post number). All link is default. So we can make nother submenu of posts in admin section for Mine link directly. Let me show you the few lines code.
[code language=”php”]add_action(‘admin_menu’, ‘manchu_myposts’);
function manchu_myposts()
{
if (function_exists(‘add_submenu_page’))
{
//$parent, $page_title, $menu_title, $access_level, $file, $function = ”
add_submenu_page(‘edit.php’,’My Posts’,’My posts’, 1, ‘edit.php?post_type=post&author=’.get_current_user_id());
}
}[/code]
You can copy-paste above code in your theme functions.php file and it will show a new sub menu in posts ectin as My posts. Multi user blog users can get easily link for his/her posts.
myposts
it’s just a easy way to make personal posts link for any user have access at leas contributor. Access level 1 belongs to contributor..

Update: 15-09-2011

While working on a project I got a tips from stackoverflow wordpress site about showing only specific author’s posts in author mode.
[code language=”php”]
function cb_posts_for_current_author($query) {
global $pagenow;

if( ‘edit.php’ != $pagenow || !$query->is_admin )
return $query;

if( !current_user_can( ‘manage_options’ ) ) {
global $user_ID;
$query->set(‘author’, $user_ID );
}
return $query;
}
add_filter(‘pre_get_posts’, ‘cb_posts_for_current_author’);
[/code]

thank you

Stuck in wordpress Maintenance Mode?

Are you Stuck in wordpress Maintenance Mode?  I was in that situation and thought to write about my pain and findings so that it may be help to reduce pain in the ass when u are crazy to do some upgrade for plugins and themes and you are stuck  in maintenance mode for “something wrong” in upgrade/upadte process .

This tip is for wordpress3.0+, don’t  know what to do for lower version.  The thing is when wordpress takes the site maintenace mode it creates a file in the site root dir named .maintenance  and when done remove that… 🙂

So, now you know what to do if u are stuck in maintenance mode. I wish I am going to sleep well tonight.

note: check the dicussion in wordpress forum about this issue.

btw, let me show you a sample screenshot about how the error msg look for upgrade failure

failure

জুমলাতে নেটিভ টুলটিপ এর ব্যবহার

Hei! it’s bengali unicode text, This post is wrriten for amaderprojukti forum.
অনেক দিন বাংলায় ব্লগ বা টিপ্স কিছু লেখা হয় না। আজকের বিষয় আমার অনেক গুলো গার্লফ্রেন্ড এর ভেতর অন্যতম “জুমলা”। যদিও আজকের লেখাটা জুমলার একটি গোপন সুন্দর দিক নিয়ে আর তা হলো জুমলা ১.৫ এর নেটিভ টুলটিপ।
প্রথম একটি ছবি দেখায়ঃ
tooltip
এডমিন প্যানেলে কোন কিছু কনফিগারেশনে ঢুকলে বা অনেক সময় কোন লিঙ্কএ মাউস হোভার করলে উপরের মতো টুলটিপ দেখায়। একই রকম টুপটিপ চাইলে আমরা ফ্রন্ট এন্ড এ ব্যবহার করতে পারি আর তার জন্য এক্টিভ টেমপ্লেটে দরকার সামান্য পরিবর্তন, সেই পরিবর্তন কিভাবে করা যায় তা নিয়েই আজকের আলোচনা। পরের ছবিটি ফ্রন্ট এন্ড এর।
tootip

কিভাবে ফ্রন্ট এন্ডে টুলটিপ ফিচার যুক্ত করবেনঃ
টুলটিপ ফিচার যুক্ত করার জন্য আপনাকে প্রথম টেমপ্লেটের ইন্ডেক্স ফাইল(index.php) এ একটি লাইন যুক্ত করতে হবে। যদি আপনি ডিফল্ট টেমপ্লেট ব্যবহার করেন তাহলে rhuk_milkyway হচ্ছে আপনার টেমপ্লেট এর নাম, এর ভেতর index.php ফাইলটি ওপেন করুন কোন এডিটরে, এখন হেড ট্যাগ() এর আগে

Continue reading