Showing posts from December, 2016

Change wordpress logo in admin login or register page

We can easily change WordPress logo on the Admin Login or Register page using below PHP function. Copy the given code in your active themesfunctions.php file. Do note forgot to change logo url with your logo having correct path, and store logo accordingly :
function custom_admin_login_logo() { ?> <style type="text/css"> body.login div#login h1 a { background-image: url(; //Add your logo image path withthis url padding-bottom: 12px; height: auto !important; background-size:130px; width: 100%; } </style> <?php } add_action( 'login_enqueue_scripts', 'custom_admin_login_logo' );

Get custom Taxonomy with empty also in wordpress

<?php $terms = get_terms( array( 'taxonomy' => 'vehicle_type', 'hide_empty' => false, ) ); $count = count( $terms ); if ( $count > 0 ) { echo '<h3>Total Projects: '. $count . '</h3>'; echo '<ul>'; foreach ( $terms as $term ) { echo '<li>' . $term->name . '</li>'; } echo '</ul>'; } ?>OR

$terms = get_terms( 'post_tag', array( 'hide_empty' => false, ) );

Get custom taxonomy link in wordpres

Try below code, i hope it would helpful for you. <?php $args = array('taxonomy' => 'news'); ?> <?php $tax_menu_items = get_categories( $args ); foreach ( $tax_menu_items as $tax_menu_item ):?> <li> <a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>"> <?php echo $tax_menu_item->name; ?> </a> </li> <?php endforeach; ?> </ul>

Disable plugin update notification in wordpress

Add below code on your current theme's functions.php and add plugin base file name under unset.
function remove_update_notifications( $value ) { if ( isset( $value ) && is_object( $value ) ) { unset( $value->response[ 'hello.php' ] ); unset( $value->response[ 'js_composer/js_composer.php' ] ); } return $value; } add_filter( 'site_transient_update_plugins', 'remove_update_notifications' );

Add custom user filds on admin users panel in Wordpress

Add below code on your current theme's functions.php
add_filter('manage_users_columns', 'add_refer_domain_column'); add_action('manage_users_custom_column','show_refer_domain_columns',10,3); function add_refer_domain_column($columns) { $columns['refer_domain'] = 'Refer'; return $columns; } function show_refer_domain_columns($custom_column,$column_name,$user_id) { if ($column_name=='refer_domain') { $user_info = get_userdata($user_id); $rDomain = $user_info->refer_domain; $custom_column = "\t{$rDomain}\n"; } return $custom_column; }

Shortcode output appearing on top of content in WordPress

The problem is actually very simple. The function executed by shortcode should return the output instead of echoing it.
Example of a shortcode using echo to display output:

function bad_shortcode_function($atts, $content = null) {
    echo '<p>This is the output of shortcode</p>';
add_shortcode('bad-shortcode', 'bad_shortcode_function');

The correct way to use shortcodes is to use return. Like this:
function good_shortcode_function($atts, $content = null) {
    $string = '<p>This is the output of shortcode</p>';
    return $string;
add_shortcode('good-shortcode', 'good_shortcode_function');  

To view more Visit: