WordPress dashboard CSS add in the functions.php file

add_action(‘admin_head’, ‘my_custom_fonts’);

function my_custom_fonts() {

echo ‘<style> body, td, textarea, input, select {

fontfamily: “Lucida Grande”; fontsize: 12px;

}

</style>;

}

Advertisements

How to redirect to cart after clicking Add to Cart button in Woo-commerce

Please follow below steps

  1. Go to Woo-commerce settings -> Products Tab -> display tab
  2. See “Add to cart behaviour” check ” Redirect to the cart page after successful addition”.
  3. Save changes.

Now will successfully redirect to cart page after adding product to cart.

 

How to change WordPress dashboard icons

“Dashicons” is the official icon font of the WordPress admin as of 3.8.

Please find below link to check dashboard icons to use and change.

Goto Dashboard icons

Use below code to set icons for wordpress custom post types.

Use below code in functions.php

function wpdocs_create_post_type() {
register_post_type( ‘acme_product’,
array(
‘labels’ => array(
‘name’ => __( ‘Products’, ‘textdomain’ ),
‘singular_name’ => __( ‘Product’, ‘textdomain’ )
),
‘public’ => true,
‘has_archive’ => true,
‘menu_icon’ => ‘dashicons-products’, // Here change Icon
)
);
}
add_action( ‘init’, ‘wpdocs_create_post_type’ );

WordPress site will slow because of sessions in some cases

Yes some times WordPress will slow because of sessions

In some cases we have started session in functions.php and header.php.

When we place session_start() in header.php site will slow down at that time we need to use cookies like below

Set cookie 

<?php setcookie(“CookieData”, $value, time() + (86400 * 30), “/”);  ?>

Get cookie

<?php echo $_COOKIE[“CookieData”]; ?>