Category: wordpress

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

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

ধাপ একঃ প্রথমে আপনার থীমের functions.php ফাইলে এ ২টি ফাংশন লিখতে হবে। মনে রাখবেন প্লাগিন এর কোডগুলো চাইলে functions.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;
    }

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

<?php comments_template( '', true ); ?

But how about we put

<?php if($post->comment_status == "open"){comments_template( '', true );} ?>

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

WP Photo Album Plus Plus: WordPress Image Gallery

Most of the wordpress image gallery plugins can not make me happy. NExtgen is too much heavy, then I got another wordpress plugin “WP Photo Album Plus” developed by J.N. Breetvelt, a.k.a. (OpaJaap). R.J. Kaplan developed WP Photo Album 1.5.1 and then J.N. Breetvelt extended it with new features. Really I like this simple but powerfull gallery plugin. But something I didn’t like which I am trying to modify and releasing for every body so that I can get more ideas from other and even this modification can be done to main plugin too. Though my modification is not done yet! But why not I share my last modification and explain what I have done upto now 🙂
Continue reading

Adding vertical fixed feedback button

update: 06.09.2010
Wana use as wordpress or joomla plugin ? then buy from my official website

Downloads

For Joomla
For WordPress

The Story

If you still didn’t notice, please check again there is a vertical feedback button in my blog , right side. So, sometimes people asks me how to do that ,,, any one can read the source code or having debug tool like firebug for firefox can see the source code and add in his own site. But max time, it’s true that we don’t want to learn by reading or google about any problem, we just ask other to get ready made solution. Even we don’t write in forums about our problems …. grr…

So here is answer of the those question, “How I added the vertical feedback button?”

I know how html works and how css works , I know where to edit in wordpress theme. So many days ago I saw that in a site and copied the source code and image and added in my site 😛
I am showing for default wordpress theme tweentyten and all paths shown bellow are windows style as windows is my primary os.

Step1: Copy this image to your wp-contentthemestwentytenimages folder first.

Step2: Open style.css file from wp-contentthemestwentyten dir and ready to add some css code 🙂
Step3: In the file style.css file at last line add the following css codes
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

edit.php?post_type=post&all_posts=1

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.

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());
    }
}

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.

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');

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