Wednesday, March 26, 2014

Change the Wordpress Logo in wp-admin login page

User hook login_head

Example

function custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image: url('/images/cutompath.png') !important; background-size:100% !important;width:100% !important;}

</style>';
}
add_action('login_head', 'custom_login_logo');


Friday, March 21, 2014

New Function in wordpress 3.8 (wp star rating)

Description
____________________________________

Outputs a HTML element with the star rating exposed on a 0-5 scale in half star increments (i.e. 1, 1.5, 2 stars). Optionally, if specified, the number of ratings may also be displayed in the title attribute by passing the $number parameter.

By default, only works in admin screens.

<?php wp_star_rating( $args ); ?>

 $args
    (array) (optional) array of arguments
Default: 0 stars

Example
_______________________________________

<?php
$args = array(
  'rating' => 3.5,
  'type' => 'rating',
  'number' => 1234,
);
wp_star_rating( $args );
?>


In order to use this function on the front end, your template must include the wp-admin/includes/template.php file and enqueue the appropriate dashicons CSS font information. Example CSS: 

@font-face {
font-family: "dashicons";
src: url("../fonts/dashicons.eot");
}

@font-face {
font-family: "dashicons";
src: url(data:application/x-font-woff;charset=utf-8;base64,/* !! Large amount of data removed, see wp-includes/css/dashicons.css for complete data !! */) format("woff"),
url("../fonts/dashicons.ttf") format("truetype"),
url("../fonts/dashicons.svg#dashicons") format("svg");
font-weight: normal;
font-style: normal;
}

.star-rating .star-full:before {
    content: "\f155";
}

.star-rating .star-half:before {
    content: "\f459";
}

.star-rating .star-empty:before {
    content: "\f154";
}

.star-rating .star {
    color: #0074A2;
    display: inline-block;
    font-family: dashicons;
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    height: 20px;
    line-height: 1;
    text-align: center;
    text-decoration: inherit;
    vertical-align: top;
    width: 20px;
}

Note the font data in the above CSS has been omitted for clarity. This data must be included in working code. Refer to wp-admin/css/dashicons.css

Thursday, March 20, 2014

Adding Payment Method To Order Email In WooCommerce

This is the method I would use since it doesn’t require editing any of WooCommerce e-mail templates, all you have to do is add a few lines of code to your functions.php file.

add_action( 'woocommerce_email_after_order_table', 'iwc_display_payment_method_email_order' );
function iwc_display_payment_method_email_order( $order, $is_administrator_email ) {
    if( $is_administrator_email ) {
        echo '<h3>Payment Method:</h3><p>' . $order->payment_method_title . '</p>';
    }
}

Try removing the if ( $is_admin_email ) { check, and the corresponding }. That if statement was limiting the output to the admin emails only, removing it should add the content to all emails.

Tuesday, March 18, 2014

Levels and Users for WordPress

The WordPress User Levels range from 0 to 10. A User Level 0 (zero) is the lowest possible Level and User Level 10 is the highest Level--meaning User Level 10 has absolute authority (highest permission level). Generally, a given User Level allows the user to edit or modify postings for users that are at a "lower" User Level than themselves. Some User Levels can also add, delete, edit, and change the User Levels of other "lower" Level users. For discussion purposes, all visitors who register and login to a WordPress blog are called users.

The user assigned User Level 10 is the administrative user and is referred to as the admin user in this article. During the WordPress installation process, the install script automatically creates the admin user and assigns User Level 10. Normally, only one user should be permitted the User Level 10 privilege since that Level grants absolute power to control all others.