Saturday, 15 February 2014

Add Custom Logo in Wp-admin Screen via Snippet

Hi There,

Some time our clients want's own logo on admin panel login screen then there are bunch of plugins available now a days, wanna try some codex ??

Then use below listed Snippet!!


Add this code to your theme's functions.php

<?php
// CUSTOM ADMIN LOGIN HEADER LOGO

function my_custom_login_logo()
{
    echo '<style  type="text/css"> h1 a {  background-image:url(' . get_bloginfo('template_directory') . '/images/logo_admin.png)  !important; } </style>';
}
add_action('login_head',  'my_custom_login_logo');
?>

Above mentioned GREEN COLOR's code showing you path from theme's images folder you can append it as you want...

That's all!!

Happy Programing :-)

Activate Plugin Without Wordpress Admin Panel

Hi There,

Some time we have some restrictions in wordpress admin panel or some time wordpress's instillation  is not proper working and we are hurry to do some work.

So here is the best example you can use this example.

All you have to Add this code to your theme's function.php and there you have to mention plugin name and plugin's installation file.

<? php
function run_activate_plugin_noidex( $plugin ) {
    $current = get_option( 'active_plugins' );
    $plugin = plugin_basename( trim( $plugin ) );

    if ( !in_array( $plugin, $current ) ) {
        $current[] = $plugin;
        sort( $current );
        do_action( 'activate_plugin', trim( $plugin ) );
        update_option( 'active_plugins', $current );
        do_action( 'activate_' . trim( $plugin ) );
        do_action( 'activated_plugin', trim( $plugin) );
    }
    return null;
}
run_activate_plugin_noidex( 'ultimate-noindex-nofollow-tool-ii/ultimate-noindex.php' );
?>

So in above function I am taking an example to NO-INDEX, NO-FOLLOW plugin, you can see above GREEN COLOR line .

Here this is plugin folder "ultimate-noindex-nofollow-tool-ii" and this is installation file "ultimate-noindex.php"

You can use any plugin you want just replace the plugin name and installation file.

That's all!!

Happy Programing :-)