Blog Archives

The Right Way To Load CSS On WordPress Login Pages

/** * Custom Login CSS * * @refer  https://millionclues.com/wordpress-tips/right-way-load-login-css-wordpress/ */ function mc_load_custom_login_css() {      wp_enqueue_style( ‘login-css’, get_template_directory_uri() . ‘/assets/css/login-page.css’ ); } add_filter( ‘login_enqueue_scripts’ , ‘mc_load_custom_login_css’ ); Or you can use the Custom Login Admin Front-end CSS Plugin.

Posted in WordPress Tagged with:

Make A Div Stick To Bottom Of Parent Div

Here is the HTML Markup <div class="parent">      <div class="child">     <?php echo "Hello"; ?>   </div>    </div> And the CSS .parent {   position: relative; }    .child {   position: absolute;   bottom: 0px; }

Posted in WordPress Tagged with: ,

Using Google Fonts In WordPress – The Right Way

Add this in functions.php replacing the font of course. /** * Adding Goolge Fonts To WordPress – The Right Way * * @refer  https://wp-mix.com/right-way-include-google-fonts-wordpress/ */ function right_way_to_include_google_fonts() {   if (!is_admin()) {     wp_register_style(‘google’, ‘https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700’, array(), null, ‘all’);     wp_enqueue_style(‘google’);   } } add_action(‘wp_enqueue_scripts’, ‘right_way_to_include_google_fonts’);

Posted in WordPress Tagged with:

Remove Website/URL From WordPress Comment Form

Add this to the active theme’s functions.php. /** * Remove Website From Comments Form * * @since 1.0 * @refer https://millionclues.com/wordpress-tips/remove-websiteurl-from-wordpress-comment-form/ */ function mc_disable_comment_url ($fields) {   unset($fields[‘url’]);   return $fields; } add_filter(‘comment_form_default_fields’,’mc_disable_comment_url’);

Posted in WordPress Tagged with:

Get First Category By Post ID In WordPress (Outside The Loop)

Use this code snippet to display the first category of a WordPress post. <?php $smello = (array) get_the_category($post_ID])[0]; echo $smello[‘cat_name’]; ?> where $post_ID is the ID of the post whose category is required. Change [0] to [1] to get the

Posted in WordPress Tagged with: