JavaScript – Change Background Color to Any Random Colors on Button Click

In this JavaScript tutorial we will create a button that will change the background color of body to any random color on a button click. We will use just plain JavaScript, No JavaScript Library, No JavaScript Framework.

Create a Button

Let’s first create a button with ID color-button that will call a JavaScript function changeBg() on click.

Tags

Animated Border Bottom From Center on Hover Using CSS

In this CSS tutorial we will create a region / box that will have animated border bottom on mouse hover. The animation will start from center and will move to left and right directions. And when the mouse hover is removed the border will shrink back to center in the same way.

You can use this technique to style your services, projects, features etc. boxes.

Create a box

Let's first create a simple box using HTML and basic CSS.

HTML

Tags

Register New Image Size in WordPress

In this WordPress tutorial we will learn how to register a new image size in WordPress.

Why we need a new image size

WordPress has few default sizes for images, like thumbnail, medium, large, full. When you upload an image, it will automatically create additional images to these sizes.

You can create additional image size as per your need. Like you may need new image size to use as featured image on homepage.

Follow below steps to create a new image size and use it as featured image.

Tags

WordPress – Include Custom Category in url of Custom Post Type

In this WordPress tutorial we will learn how to include custom category or taxonomy term in url of custom post type.

Let's say we have a custom post type course. And we also have a custom taxonomy subject for this post type.

Step 1: Create A Custom Content Type

Let's create a custom content type course. Add below codes in functions.php file of your theme.

Tags

Python Small Game – Guess The Right Number

In this python tutorial, we will create a small game. User will be asked to guess a single digit number (0-9). User will be allowed to guess maximum 3 times.

If the guessed number is correct, it will show congratulation message. If user failed to guess the right number in maximum 3 tries, he will get message that he has guessed maximum times and will also show the right number.

Tags