Quantcast
Channel: Envato Tuts+ Code
Viewing all 5160 articles
Browse latest View live

How to Use Map, Filter and Reduce in JavaScript

$
0
0

Functional programming has been making quite a splash in the development world these days. And for good reason: Functional techniques can help you write more declarative code that is easier to understand at a glance, refactor, and test.

One of the cornerstones of functional programming is its special use of lists and list operations. And those things are exactly what the sound like they are: arrays of things, and the stuff you do to them. But the functional mindset treats them a bit differently than you might expect.

This article will take a close look at what I like to call the "big three" list operations: map, filter, and reduce. Wrapping your head around these three functions is an important step towards being able to write clean functional code, and opens the doors to the vastly powerful techniques of functional and reactive programming.

Curious? Let's dive in.

A Map From List to List

Often, we find ourselves needing to take an array and modify every element in it in exactly the same way. Typical examples of this are squaring every element in an array of numbers, retrieving the name from a list of users, or running a regex against an array of strings.

map is a method built to do exactly that. It's defined on Array.prototype, so you can call it on any array, and it accepts a callback as its first argument. 

The syntax for map is as shown below.

When you call map on an array, it executes that callback on every element within it, returning a new array with all of the values that the callback returned.

Under the hood, map passes three arguments to your callback:

  1. The current item in the array
  2. The array index of the current item
  3. The entire array you called map on 

Let's look at some code.

map in Practice

Suppose we have an app that maintains an array of your tasks for the day. Each task is an object, each with a name and duration property:

Let's say we want to create a new array with just the name of each task, so we can take a look at everything we've gotten done today. Using a for loop, we'd write something like this:

JavaScript also offers a forEach loop. It functions like a for loop, but manages all the messiness of checking our loop index against the array length for us:

Using map, we can simply write:

Here I included the index and  array parameters to remind you that they're there if you need them. Since I didn't use them here, though, you could leave them out, and the code would run just fine.

An even more succinct way of writing map in modern JavaScript is with arrow functions.

Arrow functions are a short form for one line functions that just have a return statement. It doesn't get much more readable than that.

There are a few important differences between the different approaches:

  1. Using map, you don't have to manage the state of the for loop yourself.
  2. With map you can operate on the element directly, rather than having to index into the array.
  3. You don't have to create a new array and push into it. map returns the finished product all in one go, so we can simply assign the return value to a new variable.
  4. You do have to remember to include a return statement in your callback. If you don't, you'll get a new array filled with undefined

Turns out, all of the functions we'll look at today share these characteristics.

The fact that we don't have to manually manage the state of the loop makes our code simpler and more maintainable. The fact that we can operate directly on the element instead of having to index into the array makes things more readable. 

Using a forEach loop solves both of these problems for us. But map still has at least two distinct advantages:

  1. forEach returns undefined, so it doesn't chain with other array methods. map returns an array, so you can chain it with other array methods.
  2. map returns an array with the finished product, rather than requiring us to mutate an array inside the loop. 

Keeping the number of places where you modify state to an absolute minimum is an important tenet of functional programming. It makes for safer and more intelligible code.

Gotchas

The callback you pass to map must have an explicit return statement, or map will spit out an array full of undefined. It's not hard to remember to include a return value, but it's not hard to forget. 

If you do forget, map won't complain. Instead, it'll quietly hand back an array full of nothing. Silent errors like that can be surprisingly hard to debug. 

Fortunately, this is the only gotcha with map. But it's a common enough pitfall that I'm obliged to emphasize: Always make sure your callback contains a return statement!

Implementation

Reading implementations is an important part of understanding. So, let's write our own lightweight map to better understand what's going on under the hood. If you want to see a production-quality implementation, check out Mozilla's polyfill at MDN.

This code accepts an array and a callback function as arguments. It then creates a new array; executes the callback on each element on the array we passed in; pushes the results into the new array; and returns the new array. If you run this in your console, you'll get the same result as before. 

While we're using a for loop under the hood, wrapping it up into a function hides the details and lets us work with the abstraction instead. 

That makes our code more declarative—it says what to do, not how to do it. You'll appreciate how much more readable, maintainable, and, erm, debuggable this can make your code.

Filter Out the Noise

The next of our array operations is filter. It does exactly what it sounds like: It takes an array, and filters out unwanted elements.

The sytnax for filter is:

Just like map, filter passes your callback three arguments:

  1. The current item 
  2. The current index
  3. The array you called filter on

Consider the following example which filters out any string which is less than 8 characters.

The expected result will be:

Let's revisit our task example. Instead of pulling out the names of each task, let's say I want to get a list of just the tasks that took me two hours or more to get done.

Using forEach, we'd write:

With filter we can simply write:

Just like map, filter lets us:

  • avoid mutating an array inside a forEach or for loop
  • assign its result directly to a new variable, rather than push into an array we defined elsewhere

Gotchas

The callback you pass to map has to include a return statement if you want it to function properly. With filter, you also have to include a return statement (unless you're using arrow functions), and you must make sure it returns a boolean value.

If you forget your return statement, your callback will return undefined, which filter will unhelpfully coerce to false. Instead of throwing an error, it will silently return an empty array! 

f you go the other route, and return something that's isn't explicitly true or false, then filter will try to figure out what you meant by applying JavaScript's coercion rules. More often than not, this is a bug. And, just like forgetting your return statement, it'll be a silent one. 

Always make sure your callbacks include an explicit return statement. And always make sure your callbacks in filter return true or false. Your sanity will thank you.

Implementation

Once again, the best way to understand a piece of code is... well, to write it. Let's roll our own lightweight filter. The good folks at Mozilla have an industrial-strength polyfill for you to read, too.

Reduce Method

The syntax for  reduce array method in JavaScript is:

map creates a new array by transforming every element in an array, individually. filter creates a new array by removing elements that don't belong. reduce, on the other hand, takes all of the elements in an array, and reduces them into a single value.

Just like map and filterreduce is defined on Array.prototype and so available on any array, and you pass a callback as its first argument. But it also takes a second argument: the value to start combining all your array elements into. 

reduce passes your callback four arguments:

  1. The current value
  2. The previous value 
  3. The current index
  4. The array you called reduce on

Notice that the callback gets a previous value on each iteration. On the first iteration, there is no previous value. This is why you have the option to pass reduce an initial value: It acts as the "previous value" for the first iteration, when there otherwise wouldn't be one.

Finally, bear in mind that reduce returns a single value, not an array containing a single item. This is more important than it might seem, and I'll come back to it in the examples.

reduce in Practice

Let's say you want to find the sum of a list of numbers. Using a loop, it would look like this:

While this isn't a bad use case for forEachreduce still has the advantage of allowing us to avoid mutation. With reduce, we would write:

First, we call reduce on our list of numbers. We pass it a callback, which accepts the previous value and current value as arguments, and returns the result of adding them together.  Since we passed 0 as a second argument to reduce, it'll use that as the value of previous on the first iteration.

With arrow functions, we would write it like this:

If we take it step by step, it looks like this:

Iteration PreviousCurrentTotal
1011
2123
3336
46410
510515

If you're not a fan of tables, run this snippet in the console:

To recap: reduce iterates over all the elements of an array, combining them however you specify in your callback. On every iteration, your callback has access to the previous value, which is the total-so-far, or accumulated value; the current value; the current index; and the entire array, if you need them.

Let's turn back to our tasks example. We've gotten a list of task names from map, and a filtered list of tasks that took a long time with... well, filter

What if we wanted to know the total amount of time we spent working today?

Using a forEach loop, you'd write:

With reduce, that becomes:

That's almost all there is to it. Almost, because JavaScript provides us with one more little-known method, called reduceRight. In the examples above, reduce started at the first item in the array, iterating from left to right:

reduceRight does the same thing, but in the opposite direction:

I use reduce every day, but I've never needed reduceRight. I reckon you probably won't, either. But in the event you ever do, now you know it's there.

Gotchas

The three big gotchas with reduce are:

  1. Forgetting to return
  2. Forgetting an initial value
  3. Expecting an array when reduce returns a single value

Fortunately, the first two are easy to avoid. Deciding what your initial value should be depends on what you're doing, but you'll get the hang of it quickly.

The last one might seem a bit strange. If reduce only ever returns a single value, why would you expect an array?

There are a few good reasons for that. First, reduce always returns a single value, not always a single number. If you reduce an array of arrays, for instance, it will return a single array. If you're in the habit or reducing arrays, it would be fair to expect that an array containing a single item wouldn't be a special case.

Second, if reducedid return an array with a single value, it would naturally play nice with map and filter, and other functions on arrays that you're likely to be using with it. 

Implementation

Time for our last look under the hood. As usual, Mozilla has a bulletproof polyfill for reduce if you want to check it out.

Two things to note, here:

  1. This time, I used the name accumulator instead of previous. This is what you'll usually see in the wild.
  2. I assign accumulator an initial value, if a user provides one, and default to 0, if not. This is how the real reduce behaves, as well.

Putting It Together: Map, Filter, Reduce, and Chainability

At this point, you might not be that impressed. 

Fair enough: map, filter, and reduce, on their own, aren't awfully interesting. 

After all, their true power lies in their chainability. 

Let's say I want to do the following:

  1. Collect two days' worth of tasks.
  2. Convert the task durations to hours, instead of minutes.
  3. Filter out everything that took two hours or more.
  4. Sum it all up.
  5. Multiply the result by a per-hour rate for billing.
  6. Output a formatted dollar amount.

First, let's define our tasks for Monday and Tuesday:

And now, our lovely-looking transformation:

If you've made it this far, this should be pretty straightforward. There are two bits of weirdness to explain, though. 

First, on line 10, I have to write:

Two things to explain here:

  1. The plus signs in front of accumulator and current coerce their values to numbers. If you don't do this, the return value will be the rather useless string, "12510075100".
  2. If don't wrap that sum in brackets, reduce will spit out a single value, not an array. That would end up throwing a TypeError, because you can only use map on an array! 

The second bit that might make you a bit uncomfortable is the last reduce, namely:

That call to map returns an array containing a single value. Here, we call reduce to pull out that value.

Finally, let's see how our friend the forEach loop would get it done:

Tolerable, but noisy.

Conclusion and Next Steps

In this tutorial, you've learned how mapfilter, and reduce work; how to use them; and roughly how they're implemented. You've seen that they all allow you to avoid mutating state, which using for and forEach loops requires, and you should now have a good idea of how to chain them all together. 

By now, I'm sure you're eager for practice and further reading. For a masterclass in functional programming in JavaScript, check out our online course.

Questions, comments, or confusions? Leave them in the comment section.



Why You Should Be Using PHP's PDO for Database Access

$
0
0

Many PHP programmers learned how to access databases by using either the MySQL or MySQLi extensions. As of PHP 5.1, there's a better way. PHP Data Objects (PDO) provide methods for prepared statements and working with objects that will make you far more productive!

CRUD Generators and Frameworks

Database code is repetitive, but very important to get right. That's where PHP CRUD generators and frameworks come in—they save you time by automatically generating all this repetitive code so you can focus on other parts of the app. 

On CodeCanyon you will find CRUD generators and frameworks that will help you deliver outstanding quality products on time. (CRUD is an acronym for create, read, update, and delete—the basic manipulations for a database.)

Sximo6 - Laravel Multipurpose Application CRUD

Introduction to PDO

PDO—PHP Data Objects—are a database access layer providing a uniform method of access to multiple databases.

It doesn't account for database-specific syntax, but can allow for the process of switching databases and platforms to be fairly painless, simply by switching the connection string in many instances.

PDO to PHP

This tutorial isn't meant to be a complete how-to on SQL. It's written primarily for people currently using the mysql or mysqli extension to help them make the jump to the more portable and powerful PDO.

When it comes to database operations in PHP, PDO provides a lot of advantages over the raw syntax. Let's quickly list out a few:

  • abstraction layer
  • object oriented syntax
  • support for prepared statements
  • better exception handling
  • secure and reusable APIs
  • support for all popular databases

Database Support

The extension can support any database that a PDO driver has been written for. At the time of this writing, the following database drivers are available:

  • PDO_DBLIB ( FreeTDS / Microsoft SQL Server / Sybase )
  • PDO_FIREBIRD ( Firebird/Interbase 6 )
  • PDO_IBM ( IBM DB2 )
  • PDO_INFORMIX ( IBM Informix Dynamic Server )
  • PDO_MYSQL ( MySQL 3.x/4.x/5.x )
  • PDO_OCI ( Oracle Call Interface )
  • PDO_ODBC ( ODBC v3 (IBM DB2, unixODBC and win32 ODBC) )
  • PDO_PGSQL ( PostgreSQL )
  • PDO_SQLITE ( SQLite 3 and SQLite 2 )
  • PDO_4D ( 4D )

All of these drivers are not necessarily available on your system; here's a quick way to find out which drivers you have:

Connecting

Different databases may have slightly different connection methods. Below, the method to connect to some of the most popular databases are shown. You'll notice that the first three are identical, other then the database type - and then SQLite has its own syntax.

Connection String

Please take note of the try/catch block—you should always wrap your PDO operations in a try/catch, and use the exception mechanism—more on this shortly. Typically you're only going to make a single connection—there are several listed to show you the syntax. $DBH stands for 'database handle' and will be used throughout this tutorial.

You can close any connection by setting the handle to null.

You can get more information on database specific options and/or connection strings for other databases from PHP.net.

Exceptions and PDO

PDO can use exceptions to handle errors, which means anything you do with PDO should be wrapped in a try/catch block. You can force PDO into one of three error modes by setting the error mode attribute on your newly created database handle. Here's the syntax:

No matter what error mode you set, an error connecting will always produce an exception, and creating a connection should always be contained in a try/catch block.

PDO::ERRMODE_SILENT

This is the default error mode. If you leave it in this mode, you'll have to check for errors in the way you're probably used to if you used the mysql or mysqli extensions. The other two methods are more ideal for DRY programming.

PDO::ERRMODE_WARNING

This mode will issue a standard PHP warning, and allow the program to continue execution. It's useful for debugging.

PDO::ERRMODE_EXCEPTION

This is the mode you should want in most situations. It fires an exception, allowing you to handle errors gracefully and hide data that might help someone exploit your system. Here's an example of taking advantage of exceptions:

There's an intentional error in the select statement; this will cause an exception. The exception sends the details of the error to a log file, and displays a friendly (or not so friendly) message to the user.

Insert and Update

Inserting new data, or updating existing data is one of the more common database operations. Using PDO, this is normally a two-step process. Everything covered in this section applies equally to both UPDATE and INSERT operations.

Prepare Bind and Execute

Here's an example of the most basic type of insert:

You could also accomplish the same operation by using the exec() method, with one less call. In most situations, you're going to use the longer method so you can take advantage of prepared statements. Even if you're only going to use it once, using prepared statements will help protect you from SQL injection attacks.

Prepared Statements

Using prepared statements will help protect you from SQL injection.

A prepared statement is a pre-compiled SQL statement that can be executed multiple times by sending just the data to the server. It has the added advantage of automatically making the data used in the placeholders safe from SQL injection attacks.

You use a prepared statement by including placeholders in your SQL. Here's three examples: one without placeholders, one with unnamed placeholders, and one with named placeholders.

You want to avoid the first method; it's here for comparison. The choice of using named or unnamed placeholders will affect how you set data for those statements.

Unnamed Placeholders

There are two steps here. First, we assign variables to the various placeholders (lines 2-4). Then, we assign values to those placeholders and execute the statement. To send another set of data, just change the values of those variables and execute the statement again.

Does this seem a bit unwieldy for statements with a lot of parameters? It is. However, if your data is stored in an array, there's an easy shortcut:

That's easy!

The data in the array applies to the placeholders in order. $data[0] goes into the first placeholder, $data[1] the second, etc. However, if your array indexes are not in order, this won't work properly, and you'll need to re-index the array.

Named Placeholders

You could probably guess the syntax, but here's an example:

You can use a shortcut here as well, but it works with associative arrays. Here's an example:

The keys of your array do not need to start with a colon, but otherwise need to match the named placeholders. If you have an array of arrays you can iterate over them, and simply call the execute with each array of data.

Another nice feature of named placeholders is the ability to insert objects directly into your database, assuming the properties match the named fields. Here's an example object, and how you'd perform your insert:

By casting the object to an array in the execute, the properties are treated as array keys.

Selecting Data

Selecting Data

Data is obtained via the ->fetch(), a method of your statement handle. Before calling fetch, it's best to tell PDO how you'd like the data to be fetched. You have the following options:

  • PDO::FETCH_ASSOC: returns an array indexed by column name
  • PDO::FETCH_BOTH (default): returns an array indexed by both column name and number
  • PDO::FETCH_BOUND: Assigns the values of your columns to the variables set with the ->bindColumn() method
  • PDO::FETCH_CLASS: Assigns the values of your columns to properties of the named class. It will create the properties if matching properties do not exist
  • PDO::FETCH_INTO: Updates an existing instance of the named class
  • PDO::FETCH_LAZY: Combines PDO::FETCH_BOTH/PDO::FETCH_OBJ, creating the object variable names as they are used
  • PDO::FETCH_NUM: returns an array indexed by column number
  • PDO::FETCH_OBJ: returns an anonymous object with property names that correspond to the column names

In reality, there are three which will cover most situations: FETCH_ASSOCFETCH_CLASS, and FETCH_OBJ. In order to set the fetch method, the following syntax is used:

You can also set the fetch type directly within the ->fetch() method call.

FETCH_ASSOC

This fetch type creates an associative array, indexed by column name. This should be quite familiar to anyone who has used the mysql/mysqli extensions. Here's an example of selecting data with this method:

The while loop will continue to go through the result set one row at a time until complete.

FETCH_OBJ

This fetch type creates an object of std class for each row of fetched data. Here's an example:

FETCH_CLASS

The properties of your object are set BEFORE the constructor is called. This is important.

This fetch method allows you to fetch data directly into a class of your choosing. When you use FETCH_CLASS, the properties of your object are set BEFORE the constructor is called. Read that again, it's important. If properties matching the column names don't exist, those properties will be created (as public) for you.

This means if your data needs any transformation after it comes out of the database, it can be done automatically by your object as each object is created.

As an example, imagine a situation where the address needs to be partially obscured for each record. We could do this by operating on that property in the constructor. Here's an example:

As data is fetched into this class, the address has all its lowercase a-z letters replaced by the letter x. Now, using the class and having that data transform occur is completely transparent:

If the address was '5 Rosebud,' you'd see '5 Rxxxxxx' as your output. Of course, there may be situations where you want the constructor called before the data is assigned. PDO has you covered for this, too.

Now, when you repeat the previous example with this fetch mode (PDO::FETCH_PROPS_LATE) the address will NOT be obscured, since the constructor was called and the properties were assigned.

Finally, if you really need to, you can pass arguments to the constructor when fetching data into objects with PDO:

If you need to pass different data to the constructor for each object, you can set the fetch mode inside the fetch method:

Some Other Helpful Methods

While this isn't meant to cover everything in PDO (it's a huge extension!) there are a few more methods you'll want to know in order to do basic things with PDO.

The ->lastInsertId() method is always called on the database handle, not statement handle, and will return the auto incremented id of the last inserted row by that connection.

The ->exec() method is used for operations that can not return data other then the affected rows. The above are two examples of using the exec method.

The ->quote() method quotes strings so they are safe to use in queries. This is your fallback if you're not using prepared statements.

The ->rowCount() method returns an integer indicating the number of rows affected by an operation. In at least one known version of PDO, the method was not working with select statements. However, it does work properly post PHP 5.1.6 versions.

If you're having this problem, and can't upgrade PHP, you could get the number of rows with the following:

Conclusion

I hope this helps some of you migrate away from the mysql and mysqli extensions. What do you think? Are there any of you out there who might make the switch?

If you would like to build a quick CRUD interface with PHP and PDO, take a look at the following posts!


Generate Random Alphanumeric Strings in PHP

$
0
0

Let me begin this post by saying that almost no event is truly random. Even the outcome of a classic coin toss could in theory be predicted if we knew the effect of every factor involved, like air friction, gravity, and initial force.

The same thing is applicable to the generation of random numbers and alphanumeric strings. The best we can hope for is to generate numbers and strings that don't seem to follow a pattern and can't be practically predicted by an attacker.

In this tutorial, we will cover different techniques for generating random numbers and alphanumeric strings in PHP. Some of them will be cryptographically secure, while others are meant only for casual use, like assigning pseudo-random file names or creating URLs and suggesting usernames.

Learn PHP With a Free Online Course

If you want to learn PHP, check out our free online course on PHP fundamentals!

 

In this course, you'll learn the fundamentals of PHP programming. You'll start with the basics, learning how PHP works and writing simple PHP loops and functions. Then you'll build up to coding classes for simple object-oriented programming (OOP). Along the way, you'll learn all the most important skills for writing apps for the web: you'll get a chance to practice responding to GET and POST requests, parsing JSON, authenticating users, and using a MySQL database.

Generating Random Numbers in PHP

There are three different functions for generating random numbers in PHP. All of them will accept a minimum and maximum possible value for the random numbers and output a random number for you. These are rand($min, $max)mt_rand($min, $max), and random_int($min, $max).

With rand(), the minimum and maximum values of integers you can generate lie between 0 and the value returned by getrandmax(). Before PHP 7.1.0, this function was about four times slower than mt_rand(). However, starting from PHP 7.1.0, it has been made an alias of mt_rand(). Unlike mt_rand(), though, you can set the value of $max to be lower than $min without causing an error.

With mt_rand(), the minimum and maximum values of integers you can generate lie between 0 and the value returned by mt_getrandmax(). It relies on an implementation of the Mersenne Twister to generate random numbers. Watch out, though—prior to PHP 7.1.0, this function implemented an incorrect version of the algorithm to generate the numbers. However, it has been fixed in newer versions.

The function became even better in PHP 7.2.0 by getting rid of a modulo bias bug. This means that for some particular seeds, your sequence of random numbers will now be slightly better compared to older versions. Some specialized code might actually rely on this bias, though. If so, you can use the older seed algorithm by calling the mt_srand() function to seed the random number generator and passing MT_RAND_PHP as the value of the second parameter.

The mt_rand() function has a period of 219937−1, which basically means that in best case scenarios you get as many as 219937−1 random numbers before the sequence starts repeating. You should note that repetition of a sequence is not the same as repetition of a particular number. In other words, you might get the same random number twice, but that does not mean that the sequence itself has started repeating. The following sequence is an example:

In the above sequence, we had 1267 twice in the output, but that does not mean that the whole sequence started repeating after that. It's unlikely to get the same number repeated so soon in a random sequence, but it is possible!

Cryptographically Secure Random Integers

If you want cryptographically secure pseudo-random numbers, the random_int() function in PHP is your best bet. It will generate random numbers between the provided $min and $max values, which default to PHP_INT_MIN and PHP_INT_MAX. Unfortunately, this function is only available starting from PHP 7.0. For versions before that, you can use this polyfill on GitHub.

Random Floats

Instead of generating random integers, you might also want to generate floats. This can be done effortlessly by simply dividing a random number with a value returned by mt_getrandmax(). The following example will illustrate how to generate a random float between 0 and 1 or between any other minimum and maximum limits.

When generating a random float between given limits, we make sure that the random integer numbers do not go above $max - 1. This way, we can be sure that adding the float part will not take the number above the maximum limit.

Seeding the Random Number Generators

One concept that needs a little bit of explanation is seeds. Put simply, these are just numbers that can be used to initialize the rand() and mt_rand() functions before generating any random numbers. The function which seeds rand() is called srand($seed), and the function which seeds mt_rand() is called mt_srand($seed, $mode).

It's important to remember that providing an initial seed value every single time before calling rand() and mt_rand() won't necessarily produce better random numbers. In fact, using the same seed each time will give you the same random number as well!

Seeding a random number is useful in situations where you want to generate a random but reproducible sequence. The following code snippet generates the same sequence of random numbers when run twice.

Generating reproducible random sequences this way can help debug programs which were being tested using random data—if you keep track of the seed, you can reproduce the same input to figure out what went wrong.

Generating Random Alphanumeric Strings in PHP

There are many ways to generate random alphanumeric strings, and what you use will depend on your needs.

Generate a Unique ID

If you simply want to generate a unique string and it does not have to be cryptographically secure, then consider using the uniqid() function. It returns a unique identifier based on the current timestamp.

The function also accepts two parameters to add a prefix or increase the entropy of the generated string. Here are some of its examples:

Generate Shuffled Strings

If you want to generate random alphanumeric strings from a fixed set of characters, you can use the str_shuffle($string) function. This function will provide you a randomly shuffled string. Starting from PHP 7.1, the algorithm which determines the random order of characters in the output string has been changed to the Mersenne Twister.

Remember that the random string generated this way is not cryptographically secure. However, the string will still be pretty unpredictable for common use like generating random file names or URLs. Here are a few examples:

Your output will most probably be different in both cases. In the first case, we just shuffled the permitted characters string and then took the first 10 characters of it. In the second case, we added "video" at the beginning of the generated string and ".mp4" at the end.

This method of generating random alphanumeric strings is very easy, but it has a couple of issues. For example, you will never get the same characters in your random string twice. Also, the length of the random output string can only be as long as the input string.

Generate Random Strings

If the problems I listed above are a deal breaker, you might want to look at some other implementations. The following code will solve both these problems.

You can modify it to add particular suffixes and prefixes to the generated random string. People who are using PHP 7 can improve the string generation further by using the cryptographically secure function random_int() instead of mt_rand().

Generate Random Hexadecimal Strings

If you want to generate random hexadecimal strings in PHP, you can also use either the md5($string, $raw_output) or the sha1($string, $raw_output) function. Both of them will generate hashes of a given input string.

You will keep getting unique hashes as long as the input is unique. This could be achieved by using the output of a function like time() as the input. By default, md5() will return a 32-character hexadecimal string, and sha1() will return a 40-character hexadecimal string. These can be trimmed to a specific length using the substr() function.

Here is an example of the output returned by these functions:

As you can see, generating random and unique hexadecimal strings up to 40 characters long is very easy in PHP.

Generate Cryptographically Secure Random Strings

The three functions to generate random alphanumeric strings that we have discussed so far are not cryptographically secure. Luckily, PHP also has a function called random_bytes($length) to generate cryptographically secure pseudo-random bytes. The $length parameter determines how long the output string should be.

Once you have the output in terms of random bytes, you can use the bin2hex() function to convert them to hexadecimal values. This will double the length of the string.

Another function that you can use to generate cryptographically secure random bytes is openssl_random_pseudo_bytes($length, &$crypto_strong). The value of the second parameter can be used to determine if the output string will be generated using a cryptographically secure algorithm or not.

In the above examples, using the bin2hex() function gives us the final value as a hexadecimal string. If for some reason, you want a cryptographically secure random alphanumeric string that utilizes all characters from a to z, you should consider using the following function.

The secure_random_string() function we wrote above accepts a single parameter that determines the length of the string we would like it to return. We run a for loop that generates a random integer in the range 0 to 36. After that, we convert our number from base 10 to base 36 using the base_convert() function. The resulting character could be anything from digits 0 to 9 and characters a to z. We append it at the end of our random string. In the end, we return our full string.

Final Thoughts

In this tutorial, we looked at the generation of random numbers and alphanumeric strings in PHP. Generating random numbers can be useful in a variety of situations, like in games where you have to spawn enemy players or randomly give users some clues about letters so they can form a whole word.

Just like random numbers, the generation of random alphanumeric strings can also be pretty helpful in many circumstances. With the help of str_shuffle(), you can choose which set of characters appear in your random strings. With sha1() and md5(), you can easily generate random hexadecimal sequences, and with random_bytes() you can generate cryptographically secure strings. This will allow you to generate meaningful yet randomized filenames and usernames that are hard to guess.

I hope you enjoyed this tutorial. If you have any questions, feel free to ask them in the comments.

22 Best Android App Templates for 2021

$
0
0

Using app templates allows you to meet your client deadlines faster because all the programming work has been done for you. All you need to do is build the app according to your client's needs. 

City Guide
One of the many Android app templates available on  CodeCanyon 

Top-Selling Android App Templates for 2021 on CodeCanyon

For a productive app development journey in the year 2021, grab one of these popular Android app templates. We've combed through the thousands of Android app templates available at CodeCanyon to find the 20 best available this year.

Top Selling Android App 2020

These Android app templates are made in Android Studio, use Material Design, and come with step-by-step instructions or video tutorials on how to configure the templates from scratch. They also usually support AdMob, with the option of removing banners and interstitial ads. 

22 Best Android App Templates for 2021

In this roundup, I'll highlight the best Android app templates available right now at CodeCanyon, so you can build your ideal Android app in 2021. 

Best Universal App Templates

1. Bestseller: Universal Android App

Universal Android App

Hands down one of the best and most popular Android app templates is  Universal Android App. This awesome app lets users create just about any app they want by pulling in unlimited content from sources such as blogs, timelines, feeds, channels, playlists, or webpages, and easily combining them into one customisable app. The template supports the most popular web content sources, like WordPress, YouTube, Facebook, and RSS.

2. Material Design UI 

Material Design UI

Material Design UI is a cool and stylish Android UI template with five gorgeous themes that can be used to make any app project you’re working on more aesthetically appealing. The template themes target social, travel, media, and shopping apps, and there is a universal theme that can be used with a wider variety of apps. The template uses hundreds of Android UI themes and elements that can be recombined endlessly to create a beautiful and unique-looking app.

3. Universal Android WebView App

Universal Android WebView App

Convert your mobile and responsive websites into a beautiful app using  Universal Android WebView App. It is compatible with WordPress and other web frameworks, is highly customisable and packed with features, and it supports HTML5, CSS3, JavaScript, jQuery, Bootstrap, and other web technologies.

4.  MaterialX

MaterialX

MaterialX is a UI template that can support any app project you want to develop. It is specifically designed to make your apps look amazing by providing you with beautiful, ready-to-use Android Studio UI design templates and materials, so that no matter what app you’re creating, you can implement it in the code. Features include grid, list, and tab views, media player, social media timeline, e-commerce shopping, and more.

Best Social Network App Templates

5.  Bestseller: WoWonder Android Messenger

WoWonder Android Messenger

Looking for a messenger app template to create your own Android messenger? Look no further than the  WoWonder Android Messenger app template. Designed specifically as an Android chat application for the  WoWonder social network, WoWonder Mobile Messenger allows users to chat together on their mobile phones. Features include the ability to make both audio and video calls, send and receive messages, share and upload images, make sound recordings, and so much more.

6. My Social Network

My Social Network

Built in Android Studio,  My Social Network allows you to create your own personal social network app where you can publish posts, read the posts of friends, have a personal conversation with friends in real time, and more.

7. Dating App

Dating App

The  Dating App template is just what you need if you want to try your hand at creating your own online dating app. Built with Android Studio, the template's notable features include a beautiful gallery and user profiles. Users have the ability to comment, like, reply and send gifts, see potential dates that are nearby, make in-app purchases, send real-time direct messages with photos, and of course they can block other users.

Best Locator and Map App Templates

8. Bestseller: The City

The City

Cities are complex spaces, and any app that helps locals and visitors alike navigate is bound to be a hit.  The City is a great Android app development template for developers who want to create an app for their city featuring the most interesting sights and the best restaurants, cafés, bars, shops, and more.

All the app data is stored in a local SQLite database, so the app works in offline mode. The template has great features like MapView to show locations, a featured category for recommended places, the ability to filter searches, a saved history of searches, and much more.

9. Store Finder

Store Finder

Having a store finder app on your mobile phone is non-negotiable. This kind of indispensability has made the  Store Finder app template popular among developers. Made with Android Studio and material design, the app features a long list of must-have features like email and SMS integration, user ratings and reviews, Google directions, and social media logins. Users can also draw on the map, use map pins, share to Facebook and Twitter, and more.

10.  City Guide

City Guide

Create your own handy travel guide app for the city of your choice with the  City Guide Android app template. Developed in Android Studio and styled with Material Design, this template is easy to configure and customise. It doesn’t require programming skills to use.

You can organise your chosen city highlights into categories like attractions, sports, hotels, and nightlife. These chosen highlights can also be viewed as clickable spots on an interactive map which uses geolocation to identify your phone’s current position and distance from each highlight.

Best Music and Video App Templates

11.  Bestseller: Android Live TV

Android Live TV

The  Android Live TV app template helps developers create apps that allow end users to watch live TV on their Android devices. The app offers a registration/login screen, a home screen, and a navigation screen which shows all sections of the app. Channels are organised by categories, and users can comment on channels or report issues with channels. The app is easy to configure, and detailed documentation is provided.

12. Your Radio App

Your Radio App

Hands down the best radio app template to be found at CodeCanyon,  Your Radio App is perfect for developers who want to create their own mobile Internet radio-streaming app. With a powerful admin panel, the app can manage unlimited radio stations and categories and supports many formats.

13. Your Videos Channel

Your Videos Channel

If you are a YouTuber, a videographer, or a developer with clients who are videographers,  Your Videos Channel app template may appeal to you because it essentially allows you to create an app dedicated to showing off your videos or a video collection of your choosing. The app, which has YouTube integration, uses PHP MySQL for the admin side and can manage unlimited categories and video uploads.

14. xMusic

xMusic

xMusic will appeal to Android developers who are looking for a template to help them create an online-offline music player app. This app plays millions of free songs from SoundCloud via the SoundCloud API, but can switch to music from the user’s own library if they prefer. 

Some of the great features the template offers are a powerful equalizer with many preset music styles, support for sleep mode and a number of playlists, a powerful search, and much more.

Best Food Delivery Apps

15. Bestseller: Food Delivery

This food delivery app provides a lot of functionality for people who want to create a food delivery app.  Food Delivery is based on the Flutter framework developed by Google for cross-platform mobile apps and relies on the PHP-based Laravel framework for the back-end heavy lifting.

Food Delivery

You can use the app for managing multiple restaurants and integrate Google maps to show users directions to reach a specific restaurant within the app. It's also easy to restyle the app so that its theme matches your own brand.

Another app called Delivery Boy For Multi-Restaurants Flutter App by the same developer works very well with this food delivery app. You can use it to manage all the people who make deliveries. This includes things like orders assigned to different employees and their delivery status and history.

16. Grocery, Food, Pharmacy, Store Delivery

This  Grocery and Pharmacy delivery app is similar in functionality to the food delivery app. However, it has a more general-purpose UI. Both this app and the food delivery app were created by the same developer, so they use the same underlying technology.

Grocery Delivery

The app looks great in light mode as well as dark mode. It offers a set of ready-to-use animations like parallax, sliding, and swiping animations. It also supports different payment methods and cash on delivery.

Its companion app called  Delivery Boy for Groceries, Foods, Pharmacies can be used to track the delivery status of different items by your employees.

Best Special-Purpose App Templates

17. Bestseller: Android News App

Android News App

The  Android News App template is the go-to template for those looking to create a mobile news app for Android devices. Users can view the latest news in different categories, save articles as favourites, get notified about the latest articles, and more. It comes with an easy-to-use admin dashboard for modifying the news categories and other details.

18. Android Wallpapers App

HD Wallpaper

The  HD Wallpaper app template allows developers to create an Android app which delivers gorgeous wallpapers and backgrounds to the user’s Android device. The app features multiple galleries of high-resolution images, easy tap, swipe and scroll functions, and offline caching of wallpapers.

19.  AdForest

AdForest

AdForest is the perfect classified ad Android app template if you want to build an app to manage product listings for an ad posting business. The template has a built-in text messaging system for easy communication between buyers and sellers. It comes with push notifications to alert users when there’s a message on an ad, and the Google Maps integration allows users to get directions to the seller.

20.  E-Commerce

E-Commerce

If you're looking to set up an online e-commerce business and need the perfect Android mobile app template for your business, check out the E-Commerce app template. It's designed to help you create your own mobile e-commerce app quickly and easily. The template provides a powerful admin panel so that you can set up everything exactly as you want it, including adding currencies and taxes. You'll also be able to create categories and product menus and manage orders effectively. 

21. Quizix

Quizix

Quizix is a fabulous Android quiz app template that uses maths, text, and/or photo questions, and has space for two to four answer options. Developers simply add their categories, sub-categories, and questions in the back end, and the app formulates the quiz. You get full Android app template source code, full PHP source code for the backend, and full documentation to guide you through all the steps. This template also comes with AdMob banners and interstitials.

22. Cookbook Recipe App

Cookbook Recipe App

Create your own recipe application with the  Cookbook Recipe App template. This native Android app template doesn’t require programming skills, and the code is easy to configure and customise. It also stores recipes in a local SQLite database so users can run the app without an Internet connection. Other great built-in features include a drawer menu with categories, shopping list, favourites, a powerful search, Google Analytics, various animations and effects, and more.

Free Android App Templates

The premium mobile app templates available on CodeCanyon will undoubtedly give you the most advanced features and the best possible user experience. They are complete apps with full Android app source code—in many cases you can customize them to create your own working app, without any coding. However, if you're on a tight budget, you might not want to use a paid template. The good news is that there are free alternatives to these premium mobile app templates.

Many mobile app design templates or UI kits have been created by designers and are free to download and use in your own project. To create an app from one of these free app design templates, you will need to do all the coding yourself, though. The UI kit or design template will only include the layout and graphics for your app—you'll have to figure out how to turn this design into a real app.

Below are a collection of five great free mobile app design templates that you can download for free in 2020.

1.  Travel App Screen

Travel App Screen

This is a basic Android UI template for a travel app which lets users see information about nearby hotels such as their ratings, booking options, and photos.

2.  Messenger UI Kit

Messenger UI Kit

This Android UI kit was developed to create UI elements that look very similar to the Facebook messenger. It contains a variety of icons, color and spacing elements, etc.

3.  Gossip Chat App

Gossip Chat App

This app template provides a UI for a chat app concept where co-passengers can chat with each other through a shared network while traveling. The design is based on Material Design guidelines.

4.  User Profile Screen

Plaster - User Profile Screen

The UI of this user profile screen was built using Plaster components. All the components have their own attributes and styles to make it easier for you to customize the UI and make it unique for your app.

5.  Android TV UI

Android TV App UI

This Android app template serves a different segment. Its UI is designed based on guidelines that are necessary for it to qualify as an Android TV app. The user interface is created in a way that helps users discover the content they're looking for quickly.

Launch Your Android App With a Great Template

These 20 best Android app templates of 2020 are just a small selection of the hundreds of  Android app templates we have available at CodeCanyon, so if none of them quite fits your needs, there are plenty of other great options to choose from. 

bestselling Android apps 2020

More Android App Template Resources on Envato Tuts+

And if you want to improve your skills building Android apps and templates, then check out some of the ever-so-useful  Android tutorials we have on offer.

The following articles can help you zero in on specific app categories.

How to Use PHP in HTML

$
0
0

In this article, I'll show you how to use PHP code in your HTML pages. It’s aimed at PHP beginners who are trying to strengthen their grip on the world's most popular server-side scripting language.

Again, PHP is a server-side scripting language. That means a PHP script is executed on the server, the output is built on the server, and the result is sent as HTML to the client browser for rendering. It's natural to mix PHP and HTML in a script, but as a beginner, it’s tricky to know how to combine the PHP code with the HTML code.

Learn PHP With a Free Online Course

If you want to learn PHP, check out our free online course on PHP fundamentals! In this course, you'll learn the fundamentals of PHP programming. You'll start with the basics, learning how PHP works and writing simple PHP loops and functions. Then you'll build up to coding classes for simple object-oriented programming (OOP). Along the way, you'll learn all the most important skills for writing apps for the web: you'll get a chance to practice responding to GET and POST requests, parsing JSON, authenticating users, and using a MySQL database.

Today, we’re going to discuss a couple of different ways you could choose from when you want to use PHP in HTML. I assume that you have a working installation of PHP so that you can run the examples provided in this article.

Different Ways to Combine PHP and HTML

Broadly speaking, when it comes to using PHP in HTML, there are two different approaches. The first is to embed the PHP code in your HTML file itself with the .html extension—this requires a special consideration which we’ll discuss in a moment. The other option, the preferred way, is to combine PHP and HTML tags in .php files.

Since PHP is a server-side scripting language, the code is interpreted and run on the server side. For example, if you add the following code in your index.html file, it won’t run out of the box.

First of all, don’t worry if you haven’t seen this kind of mixed PHP and HTML code before, as we’ll discuss it in detail throughout this article. The above example outputs following in your browser:

So as you can see, by default, PHP tags in your .html document are not detected, and they're just considered plain-text, outputting without parsing. That's because the server is usually configured to run PHP only for files with the .php extension.

If you want to run your HTML files as PHP, you can tell the server to run your .html files as PHP files, but it's a much better idea to put your mixed PHP and HTML code into a file with the .php extension.

That's what I'll show you in this tutorial.

How to Add PHP Tags in Your HTML Page

When it comes to integrating PHP code with HTML content, you need to enclose the PHP code with the PHP start tag <?php and the PHP end tag ?>. The code wrapped between these two tags is considered to be PHP code, and thus it'll be executed on the server side before the requested file is sent to the client browser.

Let’s have a look at a very simple example which displays a message using PHP code. Create the index.php file with the following contents under your document root.

The important thing in the above example is that the PHP code is wrapped by the PHP tags.

The output of the above example looks like this:

Example Output

And, if you look at the page source, it should look like this:

page source code

As you can see, the PHP code is parsed and executed on the server side, and it's merged with HTML before the page is sent to the client browser.

Let’s have a look at another example:

This will output the current date and time, so you can use PHP code between the HTML tags to produce dynamic output from the server. It’s important to remember that whenever the page is executed on the server side, all the code between the <?php and ?> tags will be interpreted as PHP, and the output will be embedded with the HTML tags.

In fact, there’s another way you could write the above example, as shown in the following snippet.

In the above example, we’ve used the concatenation feature of PHP, which allows you to join different strings into one string. And finally, we’ve used the echo construct to display the concatenated string.

The output is the same irrespective of the method you use, as shown in the following screenshot.

Text output of the PHP code

And that brings another question: which is the best way? Should you use the concatenation feature or insert separate PHP tags between the HTML tags? I would say it really depends—there’s no strict rule that forces you to use one of these methods. Personally, I feel that the placeholder method is more readable compared to the concatenation method.

The overall structure of the PHP page combined with HTML and PHP code should look like this:

In the next section, we’ll see how you could use PHP loops with HTML.

How to Use PHP Loops in Your HTML Page

Iterating through the arrays to produce HTML content is one of the most common tasks you'll encounter while writing PHP scripts. In this section, we’ll see how you could iterate through an array of items and generate output.

In most cases, you’ll need to display array content which you’ve populated from the database or some other sources. In this example, for the sake of simplicity, we’ll initialize the array with different values at the beginning of the script itself.

Go ahead and create a PHP file with the following contents.

Firstly, we’ve initialized the array at the beginning of our script. Next, we’ve used the foreach construct to iterate through the array values. And finally, we’ve used the echo construct to display the array element value.

And the output should look like this:

Output showing a list of employeesThe same example with a while loop looks like this:

And the output will be the same. So that’s how you can use foreach and while loops to generate HTML content based on PHP arrays.

In the next section, we’ll see how you could use PHP short tags syntax.

How to Use PHP Short Tags

In the examples we’ve discussed so far, we’ve used the <?php as a starting tag everywhere. In fact, PHP comes with a variation, <?=, which you could use as a short-hand syntax when you want to display a string or value of the variable.

Let’s revise the example with the short-hand syntax which we discussed earlier.

As you can see, we can omit the echo or print construct while displaying a value by using the shorthand syntax. The shorthand syntax is short and readable when you want to display something with echo or print.

So these are different ways you can use to add PHP in HTML content. As a beginner, you can learn from trying different ways to do things, and it's fun too!

Including Code from Different Files

There are a lot of situations where you need to use the same code on multiple pages of a website. One such example would be the header and footer section of a website. These sections usually contain the same HTML throughout the website.

Think of this like moving the common CSS rules of a website into a stylesheet instead of placing them inside the style tags on individual pages.

There are four functions available in PHP to help you include other files within a PHP file. These are include()include_once()require() and require_once().

The function include() will include and evaluate the specified file and give you a warning if it cannot find the file. The require() function does the same thing but it gives you an error instead of a warning if the file cannot be found.

When working on big projects, it is possible that you might unintentionally include the same file multiple times. This could cause problems like function redifinition. One way to avoid these issues is to use the include_once() and require_once() functions in PHP.

Lets use code from a previous section to show you how to use these functions. I will be using include() in this example. Create a file called header.php and place the following code inside it.

Create another file called date.php and place the following code in it.

Create one more file called day.php and place the following code in it.

Notice that we have included the path to header.php at the top of both day.php and date.php. Make sure that the three files are in the same directory. Opening up date.php in browser should now show you the following output.

PHP Date Include

Opening up day.php should show you the following output.

PHP Day Include

As you can see, the code we put inside header.php was included in both our files. This makes web development a lot easier when you are working with a lot files. Just make the changes at one place and they will be reflected everywhere.

Conclusion

Today we discussed how you can mix PHP and HTML to create dynamic HTML. We discussed different methods with a handful of examples to see how things work.

The Best PHP Scripts on CodeCanyon

Explore thousands of the   best PHP scripts ever created on CodeCanyon. With a low-cost one-time payment, you can purchase one of these high-quality PHP scripts and improve your website experience for you and your visitors. 

Here are a few of the best-selling and up-and-coming PHP scripts available from CodeCanyon for 2020.


How to Add Meta Tags in WordPress

$
0
0

In this tutorial, I'll show you how to add meta tags to your WordPress website. By default, WordPress doesn’t support meta tags, but with a few easy steps you can add support for meta tags in your WordPress website.

Meta tags are important when it comes to making your website SEO-friendly. When search engine crawlers visit your website, they fetch metadata information in the form of meta tags in addition to fetching actual content of that page. In fact, meta tags allow us to inform crawlers about the specifics of the web pages.

There are certain keyword meta tags that don’t contribute to search engine ranking of your website, although some meta tags like meta description can significantly improve search results.

WordPress doesn’t come with built-in support for meta tags, and thus, you need to do a bit of extra work if you want to take advantage of meta tags. Broadly speaking, when it comes to providing meta tags support in WordPress, there are two ways: either you need to edit the WordPress code files or you need to install a third-party plugin. In this article, we’ll discuss both ways.

How to Add Meta Tags to WordPress Without a Plugin

In this section, we’ll discuss how you could enable meta tags support in your WordPress website without any plugins.

To enable meta tags support, we’ll have to add a code snippet in the functions.php file of your active theme. If you're using your own custom theme, you can edit the functions.php file directly. However, if you're using a third-party theme like Twenty Twenty, you should create a child theme before you make any changes.

You can learn how to create a child theme here:

 

In this example, I'll show you the code for a Twenty Twenty child theme. Go ahead and open the wp-content/themes/{YOUR_THEME}/functions.php file and add the following snippet at the end. 

In the above snippet, we’ve added the twentytwenty_add_meta_tags custom function which will be used to add meta tags to the different pages of your website. We’ve then used the wp_head hook to add meta tags in your pages. Of course, if you're using a different theme, replace twentytwenty_add_meta_tags with the name of your own theme. 

As you can see, we’ve implemented meta tags support for the home page, single post page and category pages. Of course, you could go ahead and modify this code as per your needs. You could add support for other types of pages similarly.

In the next section, we’ll see how you could add meta tags by using third party plugins.

How to Add Meta Tags With Third Party Plugins

In this section, we’ll see how you to add meta tags to your website with the help of the Meta Tag Manager plugin. You can install it with from the WordPress admin sidebar with Plugins > Add New, or you can download and install it manually to your wp-content/plugins directory.

Finally, activate the plugin in the Plugins section of the admin sidebar.

Once the plugin is installed, you can access the plugin UI at Settings > Meta Tag Manager.

Meta Tag Manager UI

There are two ways you could use this plugin. You can add custom meta tags for specific pages or you could enable meta tags for specific content types like post, page and media. So it depends on how you would like to configure meta tags in your website.

How to Add the Meta Description Tag for the Front Page

In this section, we’ll see how you could add the meta description tag only on the homepage. Head over to the Settings > Meta Tag Manager > Custom Meta Tags section, click on the + Add Meta Tag button and configure the meta description tag as shown in the following screenshot.

Frontpage Meta Description Tag

Click on the Save Changes button to save your changes.

Meta Tags Listing

Go ahead and check the source code of your front page ( Ctrl + U in Chrome), and you will see the following meta tag added by the Meta Tag Manager plugin!

In this way, you can add as many tags as you want to add to your pages.

How to Enable the Meta Tag Builder for the Post Content Type

The other option is to enable the meta tag builder for specific content types. For example, if you want to enable the meta tag builder for the Post content type, go to the Settings > Meta Tag Manager > General Options section. Select the Posts content type as shown in the following screenshot and hit the Save Changes button to save changes.

General Options

Now, go ahead and create a new post, and you would notice that the meta tag builder is added to it as shown in the following screenshot.

Post Content Type

You would use it in the same way as we discussed in the previous section. In this way, you can enable the meta tag builder for different content types,

Conclusion

Today, we discussed different ways you could use to enable meta tags support in your WordPress website. 

If you want to learn how to make a WordPress site from A to Z, be sure to check out our complete guide.

You can also learn how to use WordPress with our free online course.

 

 

13 Cost, Quote, and Estimate Calculators for WooCommerce for 2021

$
0
0

Do you want to make it easier for customers to get a quote or an estimate? Adding quote or estimate calculator plugins to your website helps customers make quick decisions and brings you fast business.

WordPress calculator plugins make it easy to create quote and estimate forms so visitors can get instant cost estimates. That way they can decide whether to commit to a project or not.

Request a Quote - WooCommerce Request a Quote

Cost calculators give you the option of using simple or complex formulas to build your quote and estimate forms.

In addition, WordPress calculator plugins are also a great source of lead generation for businesses because it connects the customer contact info with information about the project they want to carry out.

Bestselling Cost, Quote, and Estimate Calculators for WordPress and WooCommerce

Make it easy for your website visitors to get quotes and estimates! Grab one of these bestselling cost, quote, and estimate calculators for WordPress on CodeCanyon and improve the user experience on your website!

Bestselling Cost, Quote, Estimate Calculators for WordPress and WooCommerce

 

Here are 13 of the top-rated premium quote, estimate, and cost calculator plugins for WordPress that are available for you to download on CodeCanyon.

1. Bestselling: WP Cost Estimation and Payment Forms Builder

WP Cost Estimation & Payment Form Builder

The WP Cost Estimation and Payment Forms Builder helps clients to easily get estimates on your website.  It comes with a range of impressive features including:

  • powerful calculation system
  • form designer tools
  • drag-and-drop builder.

You can easily build customized cost estimation forms using a drag-and-drop builder. Customers can select from different services indicated on the form and see how much they cost. You can do popup estimate and payment forms too! Customers can then get an accurate estimate of their request sent by email. You can also make it easy for them to make payments by building payment forms where they can pay directly through Paypal, Razorpay, or Stripe. 

 

This website cost estimator WordPress plugin works with WooCommerce and Easy Digital Downloads. So you can sell applications, websites, graphics, and services too! 

 

Other awesome features of this plugin include: 

  • estimates and payments work with subscriptions
  • forms can generate a single price and a subscription price at same time
  • integrate your forms in your pages using shortcodes
  • option to create popup forms

2. Bestselling: Table Rate Shipping for WooCommerce

Table Rate Shipping for WooCommerce

Shipping rates get complicated fast. Having an advanced conditional calculator plugin like Table Rate Shipping for WooCommerce takes the headache out of doing shipping rates and estimates.

This WooCommerce shipping calculator plugin has the ability to add multiple rates for a given customer based on a variety of conditions set by the admin. These can include shipping destination, cart subtotal, item shipping class, price, weight, and so much more. 

It is translation-ready, multi-lingual compatible, multiple currencies compatible, and has multiple pricing options beyond flat rates.

3. Trending: Cost Calculator WordPress

Cost Calculator WordPress

Built with simplicity in mind the Cost Calculator WordPress plugin is one of the most flexible and user-friendly quote and estimation calculator form in the market. In addition to being highly customizable, it is also highly responsive and adapts to every device, from smartphones and tablets to desktops.

 

It is compatible with a wide range of WordPress builders including WP Bakery, Elementor, Gutenberg, and Bold Builder. It features form elements like: textbox, numeric slider, reCAPTCHA, and dropdown menus with image icons. You can assign a value to each form element and it will automatically contribute to the total value by adding to or multiplying the item price.

Finally, the Cost Calculator plugin includes PayPal integration and Contact Form 7 support–each form element is included in the final statement as an individual item.

4. ez Form Calculator—WordPress Plugin

ez Form Calculator WordPress Plugin

In terms of versatility, ez Form Calculator is the multi-purpose form creator you need in your tool kit. The sheer diversity of forms you can create with this plugin in incredible. Besides, you have the ability to generate more leads for your business from the diverse forms you create.

The plugins comes rich in features like drag-and-drop form creator, simple cost calculators, advanced estimate calculators, extensive contact forms, ability to create and email PDF files, and back-end verification for security.

In addition to being translation ready, it can be used with both Paypal, Stripe, and WooCommerce.

5. Cost Calculator For WordPress

Cost Calculator for WordPress

Cost Calculator for WordPress is a powerful and easy-to-use calculation and appointment plugin for WordPress. This unique tool allows you to easily create price estimation forms to give your client idea of the cost of your service. The plugin offers its own visual form builder but you can also benefit from full integration with WPBakery Page Builder.

 

The plugin comes with numerous components like dropdown, slider box, input box, contact form and more. Each components can be freely configured and you can create an unlimited number of different calculated fields forms. All calculations made by customers are saved to the database and are available from the admin level, additionally they are sent to the e-mail address.

 

6. Contact Form 7 Cost Calculator

Contact Form 7 Calculator

Contact Form 7 Cost Calculator allows you to easily create quote or price estimate forms for Contact form 7. From hotel booking quote forms, quotes for appointments and services, loan, and finance calculators you can do it all using this plugin.

Additionally, you can create forms with dynamically calculated fields to display the calculated values. You can also create both single and complex calculations using calculated fields form.  

7. Zigaform–WordPress Calculator and Cost Estimation Form Builder

Zigaform - WordPress Calculator & Cost Estimation Form Builder

In a few easy steps you can build estimate forms using Zigaforms. It’s the easiest and most intuitive form builder available. It comes with a drag-and-drop form builder that lets you create 100% mobile responsive forms without having to touch a single line of code.

You can add Zigaform forms to your site easily with a shortcode, widget, template function, or append it automatically to any content you choose. You can do all this in 7 languages including Spanish, Chinese, and Russian.

Zigaform has built-in security for strictly fighting spams and bots, including transparent nonce security that makes it almost impossible to pass an automated submission. Best of all, you can find an extensive documentation on the Zigaform website, which comes in handy if you need any assistance on using the form or troubleshooting the commonly found errors.

8. Super Forms–Calculator Add-on

Super Forms - Calculator Add-on

The Super Forms Calculator Add-on is specifically for those who use Super Forms. With this add-on you can create advanced calculation forms based on the user input. Make awesome booking and order forms or create complex estimation forms. It is as easy as doing normal mathematics.

9. WooCommerce Advanced Request a Quote

Request a Quote - WooCommerce Request a Quote

The WooCommerce Advanced Request a Quote plugin enables the customer or visitor to get the rate for the products inside their wish list. It also at the same time, allows the site owner to give out discounted, promotional, special customer, or regular customer prices to the customers.

The customers or visitors can bargain for the appropriate price and the site owner would have the authority to accept or reject the negotiation.

For better and professional experience between customers and site owner, the plugin comes with an integrated email form integrated to enable the customer to send the details of the products, custom quote request or any queries to the site owner.

The plugin can be displayed on any page using the shortcode. 

10. Moveto: Mover Quotes and Booking Management Tool

Moveto - Mover Quotes and Booking Management

Moveto is a quote and price estimate form plugin that helps clients get quotes from movers' website. It is perfect for movers, shipping, logistics, transportation, and freight companies.

Among the templates you will find are: freight quote, logistics quote request, transportation quotes, container shipping quote, and movers price quote template.

Some features of this plugin include:

  • a highly responsive dashboard
  • Google Maps integration to calculate distances
  • easy automatic ways to calculate taxes like VAT and GST
  • powerful admin area to check all quote requests

11. WooCommerce Cart To Quote Plugin

WooCommerce Cart to Quote Plugin

The WooCommerce Cart to Quote plugin allows store owners to enable quotation inquiries for registered or guest customers. The quotation form is added in the cart page and can be created with Gravity Forms plugin or Contact Form 7 plugin. Customers can submit the cart inquiry from cart page. Admins can disable or enable checkout for registered or guest customers so that customers can only submit the cart as an inquiry.

12. Cart to Quote for WooCommerce

Cart to Quote for WooCommerce

This plugin allows users to request a quote by filling out a form. It works like a shopping cart. The user adds items in the quote list then submits it. Upon submission, a quote is create in the back-end. The store manager receives an email notification to review the quote and approves it.  

The store manager can create can also create special offers and discounts for customers on WordPress and WooCommerce. Once approved, the customer receives an email notification and can go ahead and pay for the quote via WooCommerce checkout. 

13. WooCommerce Shipping Calculator On Product Page

WooCommerce Shipping Calculator on Product Page

Instead of making them go all the way to the shopping cart to know what shipping costs for a particular product will be, you can save your customers the hastle. Your customers can calculate shipping costs of the product right on the product page. The WooCommerce Shipping Calculator on Product Page plugin will help them do so.

This plugin also gives you options to do the following:

  • add shipping calculator anywhere in site using the shipping calculator shortcode.
  • add custom calculate shipping messages
  • display shipping method in radio or dropdown
  • display all available shipping methods with price same time
  • hide the shipping calculator on specific product
  • display shipping charge before or after shipping form

Free Cost Calculation Plugins for WordPress

If you're on a tight budget, there are free alternatives to these premium calculator, estimation, and quotes plugins for WordPress. They are free to download and use in your own project.

1. Cost Calculator Builder

Cost Calculator Builder

The WP Cost Calculator Builder is a smart, simple tool that allows you to easily create price estimation form. It helps you build any type of estimation forms on a few easy steps. The plugin offers its own calculation builder. Moreover, you can create an unlimited number of calculation forms and insert them on any page or post.

2. Stylish Cost Calculator

Stylish Cost Calculator

With Stylish Cost Calculator, you can build an attractive instant quote on your website, with zero coding.

3. Loan Repayment Calculator and Application Form

Loan Repayment Calculator and Form Builder

Loan Repayment Calculator and Form Builder is ideal for payday loans, fixed fee payments, regular payments, savings, comparisons and pretty much anything else that gets calculated from a variable amount and term.

Sprout Invoices–Easy Estimates and Invoices for WordPress

Sprout Invoices - Easy Estimates and Invoicing

You can easily create estimates and invoices for your clients using Sprout invoices. It comes with all the typical invoicing features including recurring invoices and recurring payments. It also integrates with payment gateways like Stripe, Paypal, and more. It also integrates with form builders like Ninja Forms, Gravity Forms, WP Forms and Formidable Forms.

You can create a better experience for customers on your website by adding feature-rich premium quote, estimate or cost calculator plugins from CodeCanyon today!

Bestselling Cost, Quote, Estimate Calculators for WordPress and WooCommerce

While you're here, you can also check out some of the other amazing WooCommerce plugins available on CodeCanyon.

 

How to Uninstall WordPress

$
0
0

In this quick tutorial, we’ll go through the steps that are required to uninstall a WordPress website from your server.

WordPress is one of the most popular CMS frameworks—you can use it to build websites that may range from a simple blog to a full-fledged eCommerce website. It’s really easy to use and can be set up on your server within minutes.

If you want to learn WordPress, check out our complete guide to using WordPress:

In this article, I'll show you the essential steps in order to uninstall your WordPress website.

What You Need to Delete Your WordPress Site

Before you go ahead and uninstall your website, it’s important to note that you'll also delete all your content and files from that site, and you won’t be able to recover them. If you think you might want to access these files or restore your site in the future, you'll need to back up your site.

To back up your website, you need to back up your code, files, and database. There are different ways you could do the website backup. Either you could use a WordPress plugin which allows you to take a complete backup of your website, or you could manually download code files and export the database from your cPanel or phpMyAdmin.

Check out our complete guide on how to back up your WordPress site before you go any further!

Apart from the backup, you should also know the name of your database which is used in your WordPress installation. We’ll need it when we drop the database in the last section. You can find the name of your database in the wp-config.php file. When you open the wp-config.php file, the following section contains your WordPress database name.

You can use either FTP client software or File Manager in cPanel to browse your website files. The wp-config.php file should be available in the root of your website. Just take a note of your database name, and that’s enough for now.

How to Delete Files

As I said earlier, your WordPress installation consists of two things: files and a database. In this section, we’ll discuss how you could delete all the files in your WordPress installation. Note that this only works for a non-multisite website. Don't use these directions for a site in a multisite network, or you might end up deleting the entire network.

Firstly, if you have FTP access to your website, you could use any FTP client software to connect to your website. Alternatively, you could also use the File Manager feature in your cPanel to reach the WordPress installation directory. Irrespective of the method you use to connect to your website, go to the WordPress installation directory. It should contain directories and files like the following.

WordPress installation directory.

Select all these files and directories and delete them. In an FTP client, you can typically right-click and select the Delete option. In the cPanel file manager, you just need to click on the Select All button and hit the Delete button to delete it! Once this is completed, you’ve successfully deleted your WordPress installation files!

How to Delete the WordPress Database

Once you’ve deleted all the files in your WordPress installation, it’s time to delete the database. In this section, we’ll see how to delete your WordPress database.

Again, note that this only works for a non-multisite website. Don't use these directions for a site in a multisite network, or you might end up deleting the database for the entire network.

There are different approaches to deleting your WordPress database. If you have access to the command line, you could run MySQL commands to drop the WordPress database. On the other hand, you could also use the phpMyAdmin tool in cPanel to delete the database. We’ll go through both options.

How to Drop the Database With the CLI Tool

If you have access to the command line, head over to your terminal and run the following command to get into the MySQL shell.

You need to replace YOUR_USERNAME and YOUR_PASSWORD with your MySQL credentials. Once you’re into the MySQL shell, you need to run the following command to delete your database.

You need to replace YOUR_DATABASE_NAME with your database name. After running this command, MySQL will delete your database permanently.

How to Drop Database With cPanel

If you don’t have access to the command line or you don’t know how to use it, you could delete it from your cPanel as well.

On your cPanel dashboard, click on the MySQL databases link, and that should list all the databases. Click on the Delete link or icon for your database, and that will delete your WordPress database!

You could also use the phpMyAdmin tool to delete your database. Head over to your phpMyAdmin page and select the database which you want to delete. Next, go to the Operations tab and click on the Drop the database (DROP) link, as shown in the following screenshot.

Be very careful if you're manually deleting a database. Be sure you're deleting the right one!

deleting the WordPress database

Conclusion

Today, we discussed different options that you could use to uninstall your WordPress installation.

If you want to learn how to make a WordPress site from A to Z, be sure to check out our complete guide.

You can also learn how to use WordPress with our free online course.

 

 


40 Reasons Envato Elements Is Great for WordPress Developers

$
0
0

If you're a WordPress developer, you know how important it is to have a wide selection of digital assets in your toolbox. 

With thousands of items all in one place, Envato Elements is just the resource you need, and you can download as many assets as you want, as often as you like, for a single affordable monthly fee

Download all the digital creative assets you need
Download all the digital creative assets you need for your WordPress website from Envato Elements

What's more, all downloaded items are covered by a single license that gives you broad commercial rights when using the items you download.

If you have any doubts that Envato Elements is for you, here are the reasons every WordPress developer needs to sign up for this service today. 

  • unlimited premium themes to download
  • unlimited advanced plugins
  • unlimited fonts for a stylish site
  • unlimited icons and graphics for website design
  • royalty-free stock photos and videos
  • logos
  • the Elements plugin for WordPress

Unlimited Premium Themes to Download

With over a thousand WordPress themes to choose from in our library, I'm sure you'll find what you need. From blog, eCommerce and minimalist, to multipurpose WordPress templates, we've got them all. Here are some of our favorites:

1. Blogosphere - Multipurpose Blogging Theme

Blogosphere - Multipurpose Blogging Theme

Blogosphere is one of our most popular WordPress themes. This premium Wordpress theme was designed to make blogging easier and prettier.

The theme includes several blog layout styles, it's Gutenberg ready and fully integrated with WooCommerce. This blogging WordPress theme can be adapted to any niche. Or you can use its ready-to-use demos:

  • Default style Blog
  • Modern style Blog
  • Interior Blog
  • Fashion Blog
  • Food Blog
  • Travel Blog
  • Lifestyle Blog

2. Bonfire: Creative Multipurpose WordPress Theme

Bonfire - Creative Multipurpose WordPress Theme

The wonderful thing about using a ready-made theme is that it can help you cut out a lot of the grunt work that goes into building a site from scratch and focus your energy instead on making modifications that will make your site unique. 

Envato Elements has hundreds of wonderful themes that will help you do just that, like Bonfire, a multipurpose WordPress theme that features 14 beautiful pre-defined homepages and is perfect for a wide range of creative businesses. 

Bonfire is based on the Redux framework and works with loads of popular plugins like Visual Composer, Slider Revolution, Ultimate Addons for Composer, WPML, and Mega Menu.

3. One: Business Agency Events WooCommerce Theme

One - Business Agency Events WooCommerce Theme

One Theme is a stunning business and event theme that has countless customization options. The theme comes with eight home pages, 30+ inner pages, and 25 additional elements. 

4. Eunice: Photography Portfolio WordPress Theme

Eunice - Photography Portfolio WordPress Theme

Eunice is a stylish, attractive, and bright photography theme that will help you showcase your artwork. The theme features photo layouts such as full-width sliders, grids, masonry, ribbons, and albums.

5. App Promotion One Page App Promotion Theme

App Promotion One Page App Promotion Theme

This theme was designed so you can easily promote your apps, launch products, promote events, and much more! App Landing comes with three professionally created home pages that are sure to impress.

6. Zuka: Clean, Minimal WooCommerce Theme

Zuka - Clean Minimal WooCommerce Theme

The clean and minimal Zuka theme has ten unique demos, over ten header layouts, over four testimonial displays, and many other useful features. The theme comes with a simple drag-and-drop editor that easily allows you to customize your entire website. 

Unlimited Advanced WordPress Plugins

Browse through a library of more than 600 plugins for WordPress websites. Do you need a slider? A Pinterest plugin? WooCommerce plugins? Download as many as you need with your subscription.

7. WordPress Pinterest Feed Plugin

WordPress Pinterest Feed Plugin

This WordPress plugin is one of the most popular plugins for a reason. If you run a WordPress blog, you know how important it is to integrate Pinterest  in it. This plugin allows you to display your own profile  pins and boards from Pinterest on your website.

The purpose of this WordPress plugin is to showcase your ideas and inspire your visitors and clients. Try it today!

8. Next Post Fly Box for WordPress

Next Post Fly Box for WordPress

Another reason to use Envato Elements is to access its awesome collection of plugins like the Next Post Fly Box for WordPress featured here. Next Post Fly Box is a lightweight WordPress plugin that creates floating boxes with the next and previous blog posts. Box content settings offer featured images, title of posts, excerpt, and a close button. This handy plugin also supports custom post types and post categories.

9. ZoomSounds - WordPress Wave Audio Player

ZoomSounds - WordPress Wave Audio Player

The ZoomSounds HTML audio player features nine skins and multiple layouts. All that is required to add this powerful audio player to your website is a simple shortcode.

10. WooCommerce Quick Order

WooCommerce Quick Order

The default WordPress eCommerce plugin, WooCommerce, can be quite slow at times, which makes for a sub-optimal customer experience. WooCommerce Quick Order Plugin helps fix this issue by allowing your users to purchase your products faster!

11. WP Clever FAQ Builder

WP Clever FAQ Builder

Quickly and easily create complex FAQs for your customers with this WordPress plugin. Unlike the classic FAQs, you can have your users generate new questions based on their input, which will help you build a more thorough database fo FAQs. 

12. Super Forms: PayPal

Super Forms - PayPal

Super Forms allows you to create a custom form that redirects to the PayPal checkout page. This is ideal if you have a website that deals with subscriptions and need to use a popular payment processor. 

Unlimited Fonts for a Stylish Site

As a WordPress developer, you know the importance of fonts and typography. Download as many as you need here. Whether you need serif, sans-serif, script or decorative, there are thousands of premium fonts waiting for you.

13. Saekana Script

Saekana Script
Saekana Script

If you need a beautiful, strong cursive font that makes a statement, Saekana Script fits the bill. A great font for logotypes, titles, and website headers, this big, bold script will certainly command attention in places where you need it. Saekana comes in two styles—rough and clean—and contains a full set of lower and uppercase letters and a large range of punctuation and numerals.

14. QARVIC Typeface

QARVIC Typeface
QARVIC Typeface

Alternatively, if you're looking for a simple and beautiful sans serif font for your logo design, website title, or headers, QARVIC is a terrific choice. It has two types of letters—plain type and type grunge—and also comes with outline icon characters. The font contains a full set of lower and uppercase letters, multilingual characters with accents, punctuation, and numerals.

15. CLARION: Fancy Handwriting Decorative Typeface

CLARION - Fancy Handwriting Decorative Typeface

The beautiful and fancy handwriting typeface can work for all types of businesses. The font is a single-weight font with the standard OTF, TTF, and Web Fonts.

16. Original: A Minimalist Font

Original - A Minimalist Font

Original is a minimal and vintage character that is perfect for logos, artwork, headers, and business cards. The font also features numerals and symbols.

17. Serendipity Script

Serendipity Script

Serendipity is a handwritten font that is available for both personal and commercial use. This cursive typeface will work well for more art-driven websites. 

18. Olenber Font

Olenber Font

Olenber Font is a handmade brush font with a bold weight. This font will work best as a display or headline font. 

Unlimited Icons and Graphics for Website Design

A WordPress website isn't complete without the best graphics. We've got vector graphics, icons, backgrounds, patterns and everything you need.

19. Graphic Design Line Icons

Graphic Design Line Icons

Every WordPress developer needs a set of icons in different styles they can access for different purposes. Happily, with your Envato Elements subscription, you have access to an endless pool of icons in every style imaginable. All, like the Graphic Design Line Icons set featured here, are provided in transparent PNG files and are easy to customise using any vector software like Adobe Illustrator. 

20. Happy Children Swimming on Sea

Happy Children Swimming on Sea

Don't wait until you need terrific graphics to scramble to find them. With Envato Elements, you have access to any number of graphics that are super simple to incorporate into your website. This Happy Children Swimming on Sea graphic is just one of many vector illustrations available that will save you the hassle of searching for an illustrator or spending hours hopping from one site to the other to find illustrations that are just right for your purpose.

21. Modern School and Education Thin Line Design Icons

Modern school and education thin line design icons

This set of modern education icons is a must-have if you are running any sort of educational or tutorial website or app. These graphics are sure to make your website look more visually appealing. 

22. 80 Map & Navigation Icons

80 Map  Navigation Icons

This fully editable and customizable icon set will work perfectly for mapping interfaces, navigation apps, and website designs. It includes all sorts of icons, including pins, pointers, highway signs, markers, and much more. 

23. 15 Bank and Finance Icons

15 Bank and Finance Icons

This high-quality icon pack contains 15 bank and finance icons. You'll find pound, euro, calculator, piggy bank, pie chart, bar chart, and money bag icons in this set.

24. Data Protection 50

Data Protection Icons

This simple set of black and white icons is very versatile and will make any app or website that you put it on more attractive to your users. Included is an SVG file for each icon. 

Logo Templates with Unlimited Downloads

Browse through a library of more than 10,000 logos you can edit in every design software. Here are some of the best logo templates.

25. Dog Cat Pet Monoline Logo

Dog Cat Pet Monoline Logo

If you've got a veterinary WordPress website, you'll love this minimalist logo. I's vector-based, which means it's fully editable and scalable without losing resolution. Edit this awesome and simple logo in Adobe Illustrator.

26. Floral Wreath Save The Date

Floral Wreath Save The Date

This logo is perfect if you have a WordPress website for a weeding, or if you're a wedding planner. This logo is vector-based and you can easily edit the text and color.

27. Apricity Logo Template

Apricity Logo Template

Finding the right logo can be one of the biggest challenges when creating a new project. Happily, Elements has hundreds of ready-made logos to make your task easier. Apricity Logo Template, an organic style logo template suitable for any business or product, is just one of many available with an Elements subscription. The template is easy to customise. You can change the size and colour and alter the text as you like. 

28. So Flowery Branding Kit

So Flowery Branding Kit

This gorgeously delicate logo is the final reason Envato Elements is useful for WordPress developers. With this kit, you get 18 logo designs, 17 icons, and 13 watercolour elements, and what's more you can remove any elements you don't need and modify everything to make it work with the brand image you're creating. All files are well organised and fully editable. 

29. Color Hex Logo Template

Color Hex Logo Template

This creative and modern logo can be used across many industries. The logo is fully customizable and comes with AI and EPS 10 file formats

30. Ateh: Negative Space Plane Logo

Ateh Negative Space Plane Logo

This customizable logo comes in Adobe Illustrator format and is fully customizable. Whether you need to change the shapes, text, colors, fonts, or positions, you will have full control over this modern and sleek-looking logo.

Royalty-Free Stock Photos

Did you know there are over one million photos in Envato Elements' library? As a WordPress developer, you've got to have the best royalty-free stock photos available. Here are just some of our top categories.

31. Top Royalty-Free Food Photos

Tagliatelle pasta with pesto sauce

A WordPress cooking blog or recipe website needs the best food stock photos. This is just an example of the kind of royalty-free stock photos you'll find in the Food collection.

32. Beautiful Landscapes

Beautiful landscapes

The beautiful landscapes section contains stunning photographs of some of the most amazing landscapes across the globe. If you need to display a landscape on your website or app, then you must check out these photos. 

33. Big City Vibes

Big city vibes

Need to display spectacular images of big cities? The Big City Vibes section of Envato Elements has plenty of images to help you create an eye-catching experience for your users.

34. Fashion

Fashion

Fashion photos are a must if you are running a fashion blog, store, or app. Create a sense of professionalism with these high-quality images.

35. Royalty-Free Stock Photographs

Aerial view of waves rocks and transparent sea

A well-chosen photograph can make a huge difference to the success of your project. With your Elements subscription, you can now take advantage of the hundreds of thousands of new royalty-free stock photos available at Envato Elements and take your project to a whole new level.

Unlimited Royalty-Free Stock Videos

The same goes for video, which is often far more expensive to source than still images. Give yourself the best chance of finding the right video footage for your website, when you access the hundreds of royalty-free stock videos at Envato Elements.

36. People Stock Video

young people playing jenga

With over 300,000 videos, the People category is a popular one in the stock videos. If you need couples, friends, families, or any kind of video stock featuring people, don't hesitate to go there.

37. Holidays Stock Video

Holidays destination

Take advantage of our wide collection of holidays video stock footage for your WordPress website. This is great for a travel blog, travel agencies and more. 

38. Business & Corporate Stock Footage

Business  Corporate

If you need to create a corporate and business video, Envato Elements has you covered. You will find over 60,000 premium videos to download in this stock video section. 

39. Cartoons Stock Footage

Cartoons

Adding cartoon footage to your videos is a great way to engage your audience. The library of cartoon videos available on Elements is sure to have a cartoon that will fit in your next video.

40. Slow Motion Stock Footage

Slow Motion

Slow-motion videos can add quite a bit of interest to your videos or can make great website background videos. You can choose from over 5,000 captivating videos for your next project from the Envato Elements library of slow-motion videos. 

Bonus: The Elements Plugin for WordPress Makes It Easy

To make Elements even more accessible to WordPress users, Envato has developed an elegant new plugin. The Elements WordPress plugin currently offers scores of template kits, which together contain over 1,000 well-designed templates you can use while creating a WordPress site. 

Because it's designed to work seamlessly with popular WordPress page builders such as Elementor and Beaver Builder, you won't have to write a single line of code while using it.

Working with a WordPress page builder

Creating professional-looking static pages for a WordPress site is hard, even for an experienced web developer. It involves tasks such as designing responsive layouts, finding appropriate creative assets, and acquiring the right licenses to use them. If you've ever tried doing all these tasks on your own, I'm sure you understand how time-consuming and expensive they can get.

Envato Elements WordPress Plugin

With the Envato Elements WordPress Plugin, you'll be able to perform all these tasks with just a few clicks. This unique plugin gives you immediate access to hundreds of free template kits and over 700,000 premium royalty-free photos right inside your WordPress admin panel. By using it alongside a page builder plugin such as Beaver Builder or Elementor, you can create stunning pages for your site in minutes.

Choose as Many WordPress Assets as You Like Today

Now you know some of the reasons that make Envato Elements an indispensable asset for WordPress developers. There are countless tools and resources that you can download, all with an Envato Elements subscription. If none of the items I’ve shared with you here catch your fancy, there are thousands more to choose from at Envato Elements, and you can download as many as you like for one low monthly price. 

This post has been updated with contributions from Maria Villaneuva, a journalist and writer with many years of experience working in digital media.

Common React Native App Layouts: Login Page

$
0
0

In this series, you'll learn how to use React Native to create page layouts commonly used in mobile apps. The layouts you'll be creating won't be functional—instead, the main focus of this series is to get your hands dirty in laying out content in your React Native apps.

If you're new to laying out React Native apps or styling in general, check out our tutorial on layouts in React Native:

To follow this series, I challenge you to try recreating each screen by yourself first before reading my step-by-step instructions in the tutorial. You won't really benefit much from this tutorial just by reading it! Try first before looking up the answers here. If you succeed in making it look like the original screen, compare your implementation to mine. Then decide for yourself which one is better!

In this first part of the series, you'll create the following login page:


react native login

Getting Started

In this tutorial, we will use the Expo CLI. Expo is a set of tools and services built around React Native and native platforms that help you develop, build, deploy, and quickly iterate on iOS, Android, and web apps from the same JavaScript or TypeScript codebase. 

Expo is the easiest and fastest way to build React Native apps. The official Expo get started guide contains detailed instructions on how to download and configure Expo CLI for the major operating systems.

Create a new project

You will be prompted to choose the type of project to initialize. Choose Managed workflow and blank. Wait a few seconds for Expo to install the project files and change the directory into the new project.

The project structure should look like this. 

Open App.js to start working on your application. The starting code App.js should look like this:

On the second line of code, we import React to use JSX, Then we import the StyleSheetText, and View components from React Native.

Next is the App function, which returns a view component and a text component as a child of that. <View> is an essential component in React Native and can serve many purposes, such as styling different elements, wrapping elements, or nesting elements. The <View>  element is equivalent to <div> in HTML web development. As you can see, the View component has a property, style = {styles.container}which is used to apply styles to the view

The <Text> component allows us to render text. 

Layouts With Flexbox

Flexbox is a critical technique in React Native. Flexbox is designed to provide a consistent layout on different screen sizes. Flexbox works the same way in React Native as it does in CSS on the web, with a few exceptions. (You can learn about CSS Flexbox here.) The defaults are different, though, with the flex direction defaulting to column instead of row and the flex parameter only supporting a single number.

Flex defines how items fill over the available space along the main axis. The available space is divided according to each element's flex property.

We define the flexbox layout at the bottom of the file in the styles constant. The container has the following styles

  • flex: 1—This defines how elements will fill over space. Space is usually divided according to each element's flex property.
  • justifyContent: "center"—This aligns children of a container in the center of the container's main axis
  • alignItems: "center" —This aligns children of a container in the center of the container's cross axis.

User Interface and Common Components

A typical React Native will use the following components.

Viewa container for other components
Textdisplays text
Imagedisplays images
Stylesheetprovides a way of styling elements 
TextInputan input field
Buttona clickable buttons

Adding an Image

Images in React Native are placed in the assets folder and referenced like this:

Let us add an image in the assets folder. This will be used as the logo image. Start by removing the text component it with the logo image. Don't forget to import the Image component component at the top.

Styling in React Native 

Elements in react Native are styled using JavaScript. All the React Native elements accept a prop named style, which accepts an object with style names and values. These style names and values are similar to those used in CSS,  except the names are written using camel casing. For example, React Native uses backgroundColor for the CSS property background-color.

Add the following styles to the image.

Here we add a marginBottom: 40 style to make some space between the image and the text inputs.

Next, add text input fields for the email and password. First, add state properties to hold the email and password. State in React Native is used on components that change over time. For example, the information in the TextInput keeps changing as users input their information. The initial state of the email and password will be empty.

Start by importing useState, as shown below. The useState function will allow our functional components to be stateful.

Then initialize the state by adding the following code in the App function.

We use a View to wrap each text input for easy styling. Add this code below the image.

The setState method will update the state object with whatever information the user has entered. secureTextEntry is set to true to hide the text entered in the email text input for security purposes. 

Add the following styles to the inputView and textInput props.

Add the Forgot Password? button below the text input fields. We'll use  a TouchableOpacity button, which changes opacity when pressed.

Next, add the following styles for the forgot password button.

Finally, add the Login button. Add the following code below the forgot password button.

Add the styles for the login button.

Here we add a border radius style to make the button circular and a marginTop: 40  property to make a space between the two buttons. We also set a  custom height and width. 

The Final Login Screen Code

The final code for App.js should look like this:

And here is the final look of the app:

react native login

Conclusion

In this tutorial, you've successfully created a beautiful login page using your Flexbox knowledge.  You have also learned how to use the Expo CLI, an easy way to build and test React Native Apps.

In the next tutorial in this series, you'll learn how to create a calendar screen. In the meantime, check out some of our other tutorials on React Native and Flexbox.

How to Add Google AdSense to WordPress

$
0
0

Google AdSense is one of the best ways to monetize your website. In this article, I'll show you how to set up AdSense to show ads on your WordPress website.

With Google AdSense, you can place ads in the site header, footer, sidebar or in-between. The ads that are served by Google are contextual to your website content. The concept is very simple: when someone clicks on any ad served by Google, you’ll get paid!

To set up Google AdSense on your WordPress website, there are a couple of steps that you need to follow:

  • create a Google AdSense account and connect your website to it
  • configure your ad unit codes
  • insert ad codes to your WordPress website

From the next section onwards, we’ll discuss each of the above steps briefly.

Create Your Google AdSense Account and Connect it With Your WordPress Website

To be able to use Google AdSense on your website, you need to create a Google AdSense account in the first place.

Go ahead and sign up for your Google AdSense account. Click on the Get Started button, follow the steps and fill in the required information. Finally, you’ll end up on the page as shown in the following screenshot.

Get AdSense Verification Code

Basically, Google is asking us to verify the ownership of the website for which we want to use Google AdSense. For that, we need to copy the code as shown in the above screenshot to our WordPress website. Keep this page open in the meanwhile, as you’ll need to get back to this page once you've added the above code to your website.

Now, let’s see how you can add the verification code to your WordPress website. Head over to the admin side and go to Appearance > Theme Editor. On the right hand side, click on the Theme Header link under the Theme Files section. It will open the header.php template file, and you just need to add the verification code as shown in the following screenshot.

Add Verification Code to WordPress

Click on the Update File button to save your changes.

Now, go back to the Google AdSense page, tick the I've pasted the code into my site box and click on the Done button. You’ve now completed the verification process from your side.

Google may take a few days or weeks to approve your account, and only after your account is activated, you can start configuring ad unit codes and showing ads on your website.

Get Your Ad Unit Codes

Once your account is activated, you can start configuring ad unit codes by accessing AdSense dashboard.

There are two ways you can place Google ads on your website.

  • by site
  • by ad unit

The By site option allows Google to display ads automatically on your website by just inserting a single <script> snippet on your website. If you want to use this method, click on the Get code button under the By site tab, and add this code to your website in the same way the verification code was added in the previous section. And you’re done, you don’t need to do anything more in this case!

On the other hand, the By ad unit option allows you to configure ad units manually, and thus, it gives you more control over how and where you want to display ads on your website.

To create ad unit codes, go to Ads > Overview and choose the ad type under the By ad unit tab. Finally, give a name to your ad, select size of your preference and create the ad unit. When you’re done, you’ll get a code which you need to embed on your website.

In the next section, we’ll see how you could embed ad unit codes on your WordPress website.

Insert Ad Unit Codes to Your WordPress Website

Once you’ve created ad units and collected ad unit codes from Google AdSense, the last step is to add it to your WordPress website.

Head over to the admin side, go to Appearance > Widgets. In our case, we need to use the Text widget as we have to add the custom HTML code. Drag the Text widget from left side and drop it onto the position where you want to show it. In the following screenshot, I’ve decided to show the ad in the footer-2 position. Next, insert your ad unit code into the editor.

Add Ad Unit Code to WordPress

Finally, click on the Save button to save your changes. And now, you’ve successfully configured the ad unit code on your WordPress website! In the same way, you could go ahead and configure multiple ad unit codes at different places like header, footer and other places on your website.

So that’s how you can monetize your WordPress website with Google AdSense. It’s very easy to use and you can get started with it right away!

Conclusion

Today, we discussed how you could monetize your WordPress with Google AdSense. If you want to learn more about WordPress, check out some of our our other posts.

If you want to learn how to make a WordPress site from A to Z, be sure to check out our complete guide.

You can also learn how to use WordPress with our free online course.

 

Easy Form Validation With jQuery

$
0
0

In our previous tutorial, we  discussed how to implement basic form validation using some input attributes in HTML5 and a little regex

In this tutorial, you will learn how to use a jQuery plugin to add form validation to your website.

Using a jQuery plugin to validate forms serves a lot of purposes. It gives you additional abilities like easily displaying custom error messages and adding conditional logic to form validation. A validation library can also help you add validation to your HTML forms with minimal or no changes to the markup. The conditions for validity can also be added, removed or modified at any time with ease.

Getting Started

We will use the jQuery Validation Plugin in this tutorial. The plugin offers a lot of features and also helps you define your own validation logic.

Before we can start using the plugin in our fields, we have to include the necessary files in our project. There are two different files to include. The first is the core file, which includes the core features of the plugin, including everything from different validation methods to some custom selectors. The second file contains additional methods to validate inputs like credit card numbers and US-based phone numbers.

You can add these files to your projects via package managers like Bower or NPM. You can also just directly get a CDN link to the files and add them to a script tag on your webpage. Since this is a jQuery-based plugin, you will also need to add a link to the jQuery library.

Once you have added these files, you can start validating any form with the validate method.

Validating Your First Form

You can start using this plugin without making any significant changes to your markup. The only thing that you might have to change is to add an id or class to the form you want to validate if it doesn't have one already.

Here is the markup of a basic form that we will be validating using the jQuery validate plugin.

We are using the same attributes that we used in our previous HTML5-based form validation tutorial. The form will still do the validation without us adding any JavaScript. However, using the plugin for validation will let us show the error messages right below the invalid input field. We will also be able to style the errors however we want.

To start validating the form with this plugin, simply add the following JavaScript code on the webpage:

This is based on the assumption that you have already added the required JavaScript files. Adding those lines of JavaScript will make sure that your form is properly validated and shows all the error messages. Here is a working demo.

The library tries to be as user friendly as possible by only showing error messages when they are necessary. For example, if you tab through the name and email fields without actually entering any information, you won't get any error messages. However, if you try to move to the email field after only entering one character in the name field, you will get an error message about entering at least three characters.

The error messages are injected into the DOM using the label element. All of them have an error class, so it is easy to apply your own styling, as we did in our example. The same is true for invalid inputs, which also get an error class added to them.

Options for the validate() Method

In our previous example, we simply called the validate() method without passing any options to it. However, we can also pass an object to this method along with many options inside that object. The value of these options will determine how the form plugin handles the validation, errors, etc.

If you want this plugin to ignore some elements during the validation process, you can do so easily by passing a class or selector to ignore(). All form elements with that particular selector will be ignored by the plugin while validating the input.

Add Validation Rules for Input Fields

You can also pass some rules to the validate() method in order to determine how the input values are validated. The value of the rules parameter should be an object with key value pairs. The key in each case is the name of the element that we want to validate. The value of that key is an object which contains a set of rules which will be used for validation.

You can also add conditional logic to the different fields that you are validating by using the depends keyword and passing a callback function to it which returns either true or false. Here is an example which uses simple rules to define how the input is validated.

In the above code snippet, the keys nameageemail and weight are simply the names of input elements. Each key has an object as its value, and the key-value pairs in the object determine how an input field will be validated. These validation options are similar to the attributes that you can add in the markup of a form. For example, setting required to true will make the element required for form submission. Setting minlength to a value like 3 will force users to enter at least 3 characters in the text input. There are a few other built-in validation methods which are briefly described on the documentation page.

One thing that you should note in the above code is the use of depends to conditionally make the weight a required field if the age is over 50. This is done by returning true in the callback function if the value entered in the age input field is over 50.

Create Your Own Error Messages

This plugin also allows you to set error messages for different validation rules in a form. You begin by setting the value of the messages key to an object with key-value pairs for the input fields and the corresponding error messages.

Here is an example which will display custom error messages for each input field.

Just like rules, messages rely on the name of the input fields. Each of these input fields will accept an object with key-value pairs as its value. The key in each case is the validation rule which has to be followed. The value is simply the error message that you want to display if a particular rule is violated.

For instance, the age input field will trigger the required error message if left blank. However, it will trigger the number error if you enter anything else besides a number in the input field.

One thing that you will notice is that the plugin will show a generic error message for validation rules where you haven't supplied a custom error message. Try filling out different values in the following demo and you will see that the custom and generic error messages show up as expected.

Customizing the Appearance of Error Messages

There are times when you might want to add your own classes to valid and invalid input in order to target them more specifcially or for better integration with an existing theme.

You can change the classes which are added to valid or invalid input elements using the errorClass and validClass keys. This can help in preventing some unwanted clashes due to reusing the same class name. By default, the class error is assigned to every invalid input element and label. The class valid is assigned to every valid input element.

It is important to remember that setting errorClass to something like fail-alert will remove the class error from the invalid elements. You will have to use errorClass: "error fail-alert" to assign multiple classes to same element. The same goes for validClass.

There are no additional labels added to the form when users enter a valid input. So, the classes from validClass are assigned to the valid input element.

The following code snippet builds upon the previous example to add custom CSS classes and styling to invalid and valid elements.

The only additional JavaScript code is used to assign the classes.

Here is the CSS that we will use to change the appearance of error messages:

In addition to customizing the error messages, we are also adding our own styling to valid input elements. Here is a CodePen demo to show us the final result.

More Options to Change the Plugin Behavior

You can prevent the plugin from validating input fields on key up, click and other such events by setting the value of onfocusoutonkeyup, or onclick to false. Keep in mind that boolean true is not a valid value for these keys. This basically means that if you want the plugin to validate or lose focus on a key up event, just leave these options untouched.

You also have the option to change the element in which the error appears. By default, the plugin uses the label element to show all error messages, but you can change it to em or any other element using the errorElement key. The error element itself can then be wrapped in another HTML element using the wrapper key.

These are some of the most common options that you are likely to use when validating forms. However, there are some other validation options that might come in handy if you want to do something like change the placement of error messages or group them all together.

Final Thoughts

In this tutorial, we learned how to take our form validation to the next level using a jQuery plugin. Using JavaScript form validation gives us a lot of additional control over basic HTML validation. For instance, you can easily control how and when different error messages appear when an input is filled with invalid values. Similarly, you can also specify if the plugin should skip validation for some particular elements. I would strongly recommend that you read the documentation of this plugin and some best practices on how to use it properly.

In our next tutorial, you will learn about some more JavaScript-based tools and plugins to help you easily create and validate forms.

And while you're here, check out some of our other posts on JavaScript forms and form validation!



9 Android Templates to Inspire Your Next Project (+5 Free Templates)

$
0
0

Do you need inspiration for your upcoming Android app? Are you on a tight budget and need to get an app up and running as soon as possible? 

By using an Android app template available on  CodeCanyon , you can use a professionally created template to inspire your next app, all for an affordable price. 

Universal Android App Template
Universal is one of the many inspiring Android app templates available on CodeCanyon

Starting an Android app from scratch can be a very tough process. Expensive developers will need to be hired, and countless hours of work will need to be poured into the development. At  CodeCanyon, you will be able to choose from all the premium Android app templates available and find the perfect template to fit your upcoming project.

The Best Android App Templates on CodeCanyon

Explore over 5,000 of the best  Android app templates available on CodeCanyon. With a low-cost, one-time payment, you can purchase these high-quality Android app templates and create an app that your audience will love. 

Here are some of the best-selling Android app templates available on  CodeCanyon for 2020.

Best Selling Android App Templates on CodeCanyon
Best-selling Android app templates on CodeCanyon.

The premium Android app templates on CodeCanyon will help you deliver the best possible user experience. Having a quality user experience is key to the success of your app and many features built into these templates are designed to do just that. 

Here are a few of the types of templates that you can expect to see on CodeCanyon:

  • Material Design
  • web to app converter
  • classified ads 
  • live TV streaming

Don't miss out on all of the high-quality apps available on CodeCanyon and get your  Android template today!

Let's now go over the top 9 Android app templates available on CodeCanyon. 

Top 9 Android App Templates (From CodeCanyon for 2020)

1. Bestselling:  Universal

Universal is a beautiful, minimal, multi-purpose Android app template. You can create just about anything with it. And you can do it fast! Universal is a WebView app that lets you convert a website into an Android app. This app template has been around for a long time and is packed with features: a customizable native navigation menu, share buttons, geolocation, push notifications, and more!

Whether you're looking to build a simple app or an app packed full of features, this is a stellar template to get you started.

Universal - Full Multi-Purpose Android App

Build your app, your way. Some of the features include:

  • in-app purchases and AdMob advertising
  • push notifications
  • media player
  • localization
  • and more

This Android template app UI features parallax animations and content-focused design. Best of all, the built-in configuration tool is so powerful that you don't need to write any code. And if you're an expert, you can always edit the project source code in Android Studio!

If you need to convert your WordPress website, YouTube channel, WooCommerce site, or other web site into a mobile app, it's hard to recommend anything else—Universal deserves serious consideration.

2. Bestselling:  Universal Android WebView App 

Universal WebView App is a native Android application which uses a web view component for displaying content. With this template, you can turn your responsive website into a universal mobile app. Developed in Android Studio, this app is quick, easy, and affordable, and it does not require programming skills. The code is easily configurable and customizable. And there is just one config file to set up everything!

Universal Android WebView App Template

Universal WebView App is also compatible with WordPress or any other web framework. It supports HTML5, CSS3, JavaScript, jQuery, Bootstrap, and other web technologies.

Create your own app in less than 15 minutes without any special knowledge! It’s easier than you think.

3.  Web2App

Web2App

If you're looking to transform your website into an Android app, then this is the template for you! The template has powerful customization, such as seven different layout options where you can choose your own theme and customize the app to fit your particular brand identity. 

Here are a few other notable features that you can expect with this app:

  • navigation drawer
  • hideable toolbar
  • AdMob
  • Firebase analytics

4.  Android News App

Android News App

It’s 2020. People want genuine news. Grassroots platforms have seen that local news is missing from the big picture, and they want to address the imbalance. Different sections of society that have been invisible for so long want to tell their own stories to the world. They want to build their own news systems. 

Here's the good news. You can save your money and time by creating your own native mobile news app using  Android News App, a mobile news system which runs on the Android platform. It's developed with clean native Java code to make the app run fast and smoothly. As you would expect, AdMob is integrated into the app for monetization. And you can manage all content—news, categories, push notifications—on this app through a beautifully organized, user-friendly admin panel. 

5.  Android Live TV

Android Live TV

This app template will allow your audience to watch live TV on their Android devices. Mobile device usage has significantly increased over the past five years and many people are consuming content on mobile phones. This app makes it incredibly easy for viewers to watch their favorite TV shows on their phones. 

Here are a few features of this template:

  • mini web player
  • four types of stream links
  • ratings and comments
  • GDPR compliant

6. The City

If you want to create an app that will guide visitors to interesting places in your city, The City app template is the best choice. This all-native app lets users discover interesting places on a city map. The inspired UI design of this Android app template follows material design specs and even has animations. 

The City

Data is stored locally on the user's phone, so the app is fast and responsive and can work in offline mode. There is also an integrated admin back-end, so you can update the location data from anywhere on the fly. Then, with GCM notification, you can send those updates out to your users so they always have the latest version.

7. Your Radio App

If you've ever wanted to know how to stream audio in an Android application, then this template is worth checking out. The application is focused on streaming audio from online radio stations. The template includes a feature-packed Android application as well as a back-end for managing the radio stations users can listen to.

Your Radio App

The template is compatible with both Android Studio and Eclipse, and it relies on Parse for push notifications. It also includes AdMob for ad management. The application supports a wide range of stream formats and has a beautiful, modern user interface. If you're not convinced yet, then download the application from Google Play to try it out. It comes with full Android Studio projects source code, full PHP code for server side, and full documentation with pictures.

8.  Cookbook Recipe App

You'll find plenty of inspiration with the Cookbook Recipe App.

If you're interested in building a cookbook app, this is perfect. But even if you have something else in mind, there's plenty here to learn from.

Cookbook - Recipe App

This template features:

  • a sweet material design
  • flavorful search
  • delectable recipe details
  • a yummy shopping list feature
  • a crunchy kitchen timer
  • and so many more delicious features

AdMob and Google Analytics are supported, and the code is clean. If you hunger for some fresh inspiration, consider the  Cookbook Recipe App.

9.  Taxi Booking App

Many traditional businesses are making the jump to mobile, and this includes taxi companies. There's a reason why  Uber and  Lyft are so popular—mobile apps are simply more convenient for customers. 

This Android template is quite impressive. It contains a feature-rich Android app as well as a powerful back-end, making a complete solution. The app includes an interactive map with vehicle information and tracking, voice recognition, and support for push notifications.

Taxi Booking App

The template offers a solution for both users and drivers. Users can order a ride with the mobile application, and drivers receive a notification when someone requests a ride. Even if you don't plan to build a taxi booking application, there's a lot you can learn from browsing the ins and outs of this template.

It comes with Android Studio project source code, php admin panel files, MYSQL database, and full documentation to guide you through the whole setup and configuration process.

Now that we have gone over the best premium Android app templates available, let's go over a few free alternatives. 

5 Free Android App Templates to Download in 2020

The premium templates available on CodeCanyon will without a doubt give you the most feature-rich templates available on the web. Not to mention that the user experience with the premium templates will be unparalleled. 

However, if you are on a budget and still need to create a professional app, then here are five free Android app templates that you can download now from SEOtoolzz. 

1.  Android Chat List

Android Chat List

This free Android app template is a chat template that is XML ready with Android Studio. You can build a basic chat app with this template that will help your audience communicate with one another.

2.  Social Media

This template contains three XML screens that feature a chat, list questions, and notification screens. This template will help you kickstart any type of social media app you're working on. 

3.  Login App

Login App

This template gives you a simple login screen that your audience can access. Most apps will need some sort of login, so this will make a good addition to any of your apps. 

4.  Profile App

This profile page template has options for your users to input their name, email, and password. You can also display an active or inactive status for your profile.

5.  Navigation Drawer

Navigation Drawer is a pop-out menu that gives your users options to navigate through the app. You can set up each menu item to link to your desired screen.

Looking for more Android app templates? In the next section, we'll cover where you can find more high-quality templates for your next app.

Discover More Android App Templates for 2020

The Android app templates mentioned in this article are some of the highest quality that you can find on the web. However, these app templates might not be exactly what you need for your particular app. 

If you need a different type of Android template, then be sure to check out all the other hand-selected templates in the Envato Tuts+ articles below:


Take Advantage of the Android App Templates Available on CodeCanyon Now!

If you need inspiration for your next Android app, then head on over to CodeCanyon. There you'll find thousands of professionally crafted templates that will help you kick-start your next project. 

The templates offered are feature rich and can be purchased for a low-cost, one-time payment. This will not only help you save money from having to hire a developer, but it will help you save time as well, as the hard work will already be done for you. All you will have to do is customize the template to fit your business's needs, and you'll be ready to launch the app. 

Don't miss out on the  best-selling Android app templates available on CodeCanyon. What are you waiting for? Start working on your latest app now!

15 Stunning Ionic App Templates and Ionic Themes

$
0
0

In this post, I'll show you 15 of the best Ionic app themes and templates on the market—including 4 free Ionic app design templates.

What Is Ionic?

Ionic is a popular framework for creating hybrid mobile applications using the wildly popular Angular framework. 

Do you want to create hybrid apps that work on both Android and iOS? With Ionic, you no longer need to create separate apps for Android and iOS operating systems. Instead, with Ionic, you can create one code base that is compatible with both Android and iOS. 

One great benefit of using Ionic is that you don't need to learn a new language from scratch. Developers can create full-featured mobile apps for Android and iOS using technologies they are already familiar with, like JavaScript, HTML, and CSS. 

Ionic eCommerce

Top-Selling Ionic App Templates on CodeCanyon

Ready to kick-start your Ionic development? Try out one of these ready-made app templates from CodeCanyon, for Ionic 4 and beyond!

These app templates and themes start from prices as low as $5 for something simple like a lockscreen. However, you can also find templates to create full-fledged dating apps, food delivery apps, and more.

Ionic Apps on CodeCanyon

Best Ionic App Templates and Ionic Themes for 2020

1. Bestselling:  Ionic 5 eCommerce 

Ionic eCommerce

Ionic 5 eCommerce  offers an impressive variety of ready-made eCommerce pages so that you can create a mobile app to suit your needs. This ionic 5 app template It also provides a comprehensive CMS so that you can manage your store. 

Some key features include:

  • interactive themes
  • social share
  • product filters, sorting, and search
  • inventory management
  • multiple payment methods including PayPal, Instamojo, and Hyperpay
  • supports multiple languages
  • push notifications

The developer provides full support and will customize and install the app for you for a fee.

2. Bestselling:  Ionic 3 App for WooCommerce  

Ionic 3 App for WooCommerce

Ionic 3 App for WooCommerce is an app template you should definitely consider using if you are creating a shopping app. It allows you to quickly create a beautiful app that can connect to your WooCommerce website, pull data and settings from it, and sync categories and products in real time. It also promises your customers an easy and hassle-free shopping experience. 

Customers can also search products within categories, view order history, and add products to a wish list.

This ionic theme 3 app template supports most of the payment methods out there, automatically loads shipping methods, allows customers to search for products globally on the home page or within categories, and much more.

Other notable features of this template include:

  • ability to load content from local storage
  • powerful admin panel where you can load the designs you like
  • unlimited design layout

3.  Business Directory Ionic 5 

Business Directory ionic 5

Consider  Business Directory Ionic 5 if your goal is to build a mobile app which lists businesses with their products and services. This complete store and business listing solution consists of a mobile application and a powerful content back-end with data updates. 

No coding knowledge is required to set up the app. It is easy to customize and comes with curated color themes. 

Through the clean and user-friendly interface, users can easily browse through businesses and stores using various filters such as category, name, or distance.

Store and business owners can display and promote their products, services, news, contact information, and more.

Finally, free updates with new features are added constantly. 

4.  IMABuildeRz v3 Universal AppBuilder for Ionic v5 

IMABuildeRz v3 Universal App Builder for ionic v5

IMABuildeRz v3 is not a template; it is an app generator. It is used to generate Ionic Framework code for apps. With it, you can create no-limit apps, complete with a back-end. 

The code you generate is based on your instructions and on your brand. The generated TypeScript, PHP, HTML, and SCSS code can then be edited again for complete customization.

IMABuildeRz V3 comes with add-ons that allow you to create apps with or without coding skills.

5.  Food Delivery App with PWA and Firebase 

Food Delivery App with PWA  Firebase

When you purchase the  Ionic 5 Food Delivery app Template, you will receive an admin panel and three main apps: the user app, restaurant app, and delivery app.

The ionic 5 app template supports multiple restaurants, multiple cities, multiple languages, and multiple payment gateways. It also comes with comprehensive documentation, including video installation guides.

More features of this awesome app template include:

  • addresses from geo-location
  • live location tracking
  • push notifications with custom alerts
  • admin invoice generator
  • reviews for restaurants, food, and drivers  

6.  Grocery Ionic 

Grocery ionic

Grocery Ionic will help your grocery store improve the lives of your customers. It converts your grocery store into an online store, and it comes with a powerful back-end CMS to help you manage it. 

It has a great UI where can you list all your items together with their descriptions. Customers can browse and add the items they want to the shopping cart, place an order, and securely pay for it. You can then deliver their items directly to their doorsteps. Payment gateways include PayPal, Stripe, and Razor. 

The following back-end features will help you understand the scope of this app:

  • Inventory management helps you create, update, and delete items.
  • Order management allows you to view orders, change the status, and mark them as ready for delivery.
  • Slider management makes it easy to add new slider images.
  • Category management for creating unlimited categories and products.
  • View feedback from customers.
  • Receive and answer customer queries.
  • Google Maps integration lets delivery providers find customer locations.  

7.  Nearme   

Nearme

Nearme is a location-based app template that has definitely had some teething problems in the past. However, with the recent Ionic 5 update, improved documentation, and a beautiful redesign, it's earned a place on our list as a great template to help developers build an app that will identify supermarkets, restaurants, places of interest, gas stations, and so on that are near the end user. 

The ionic theme template comes with an admin panel that allows developers to send push notifications to users and manage categories, places, deals, slider images, users, reviews, and more.

8.  Conference Ionic 5 

Conference ionic 5

Conference Ionic 5 is the ultimate tool to provide mobile access to complete information about a conference to enhance the attendee experience and boost the conference marketing.

Conference Ionic allows users to view schedules and conference information such as location, exhibition halls, and sponsors. Committees have contact with organizers and other attendees. 

Users can create their personal agenda for easier attendance and can access speaker profiles and event information.  

9.  Ionic Stencil Essential 

Ionic Stencil Essential

The  Ionic Stencil Essential app template gives you a UI kit to quickly create Ionic 3 and Ionic 4 apps. You will get two separate code bases. One is based on Ionic 3, while the other one is based on Ionic 4.

Apps you can build include event organizer apps, calendar apps, eCommerce apps, or other apps related to business and finance. There are a lot of screens and UI elements available to cover all your needs.

Here are some of its features:

  • multiple themes available for use
  • clean user interface
  • easy to install with detailed documentation
  • code base is compatible with both iOS and Android
  • regular updates with new features

10.  Deco News 

Deco News

The  Deco News Ionic app template is the ready-made solution you need to build your own news app. News apps give content users access to issues they care about under one platform. 

The Deco News app template comes with a wide array of cutting-edge features that include:

  • 12 color combinations
  • AdMob integration 
  • deep linking 
  • push notifications supported by OneSignal
  • forms validator
  • free updates and support 

11.  Ionic 3 Ready-to-Use Elements with 12+ Categories 

This  Ionic theme will help you get started quickly with almost any kind of app that you plan to create using Ionic.

Ionic Opus UI Kit

Instead of a single app dedicated to creating something specific like food delivery, restaurant, or dating applications, this Ionic theme comes with different individual components that you can use in your own apps.

There are currently 12 different components to display chats, addresses, profile, home feed, and orders, as well as login and registration. Each of these components in this ionic ready made kit  has multiple variants for the UI. For example, there are five different UI demos for the grid component. You can pick the one that meets your needs and easily integrate it in your application.

The UI looks great for each component, and the code has been optimized to give you the best possible performance, without any lag.

Free Ionic App Templates and Components

It is not always possible to find completely developed Ionic app templates for free. Most of the time, you can expect to get individual components for free, like login screens or custom lists. Here are a few free Ionic app components and templates for you to explore.

Ionic 3 Restaurant Mobile App

Ionic 3 Restaurant Mobile App

Ionic 3 Restaurant mobile app is a great option for developers who want to build a restaurant mobile app. Built with Ionic version 3, it's completely free to use for your personal and commercial project. It has a NodeJS REST API and MongoDB as database.  This fully-customizable and ready-to-use, easily configurable app template comes generously loaded with features that include: table booking, chat with sale, order tracking, social login and registration, food categories, product review and rating, payment gateway integration

The paid version of Ionic Firebase Restaurant App builds with Ionic V4.

Ionic UX/UI Starter

IONIC UI-UX STARTER

By using the Ionic UI/UX Multipurpose Theme and Template, developers don't need to start coding a project from scratch. It is richly loaded with 50 different screens of UI layouts for apps as varied as eCommerce, News, Social, Notifications UI app and more.  In addition to having more than 20 ionic native features, it comes with Firestore authentication login, registration and profile feature.

Ionic 4 Starter Theme

This is a basic Ionic 4 starter theme with several pages like login, register, about, and edit profile. It also contains a couple of components like notifications and a popup menu.

Ionic 4 Start Theme

Beautiful Custom List

This  beautiful custom list is actually a standalone component that you can integrate in your other Ionic apps. As the name suggests, it is simply a list of different items. However, the UI is very appealing.

Ionic 3 Multi Purpose Theme

This is yet another basic  Ionic 3 theme that gives you access to common ready-made components and pages. You will get things like a welcome page, a news feed page, and a sidebar with sliding animation.

Tips on Getting Started With an Ionic App

Even though Ionic makes it a lot easier for people to quickly create apps for both Android and iOS, it can still be a bit challenging for absolute beginners. There are a couple of things that you can do to get started quickly.

1. Read the Documentation

The best way to learn about Ionic and get help when you are stuck is to read  the documentation. It provides information about a variety of topics like installation, theming, components, and native APIs.

2. Try Creating Basic Apps

The next step in the right direction would be for you to try to create some basic apps of your own. This could be something simple like a timer or calendar app in the beginning. After that, take a look at free apps created by other users and see the process they followed.

3. Start Developing Complete Apps

Once you fully understand the basic concepts and have created a few basic apps, it's time to start working on the app you wanted to create in the first place.

Build Your Ionic App Now! 

A fully completed app will have a lot of components, screens, and functionality that will take a lot of time and effort on your part to create from scratch. The Ionic apps and templates  available on CodeCanyon will prove a great time-saver for you at this point.

Ionic Apps on Codecanyon

Take Advantage of Ionic Tutorials From Envato Tuts+

If you want to improve your skills in building Ionic apps and templates, then check out some of the ever-so-useful  Ionic tutorials we have on offer!



How to Use the Modulo Operator in PHP

$
0
0

PHP has a total of eight arithmetic operators. The most common are addition ( +), subtraction ( -), multiplication ( *), and division ( /). A slightly lesser-known, though still very important operator is modulo ( %). In this tutorial, we'll focus on the modulo operator. We will discuss what it does and some of its practical uses.

What Does the Modulo Operator Do?

If you have two variables $a and $b, calculating $a % $b—usually pronounced "a modulo b" or "a mod b"—will give you the remainder after dividing $a by $b. Modulo is an integer operator, so it converts both the operands to integers before calculating the remainder. So basically modulo does integer division and then gives back whatever is left from the dividend.

The sign of the value returned by a modulo operation is determined by the sign of the dividend. In division, the result after dividing two negative numbers will be a positive number. However, that's not the case with the modulo operator. The sign of the divisor has no effect on the final value.

Here are a couple of examples:

Floating-Point Modulo

If you want to calculate the remainder when two floating-point numbers are divided by each other, you will have to use the fmod($dividend, $divisor) function. It returns the floating-point remainder after the division. The remainder value will have the same sign as the dividend, and its magnitude will be less than the divisor. The three numbers are related as follows:

Here, the value i will always be an integer.

You should remember that floating-point arithmetic is not always accurate due to the limitations of the binary or decimal representation of fractions. For example, 1/3 cannot be accurately represented in decimal form. You can keep writing 0.33333.... but at some point you would have to stop. You will get closer to the original value with each additional 3 in the decimal representation, but the value will still not be exactly 1/3.

This kind of inaccuracy causes problems with the fmod() function: the results are not entirely reliable.

Here are some examples of the fmod() function:

The second value isn't accurate because 0.2 divides into 18.8 perfectly. This is just a shortcoming of calculations in the floating-point format used by computers.

Arbitrary Precision Modulus

PHP also has functions for calculating the Modulus for arbitrary precision numbers using the bcmod() function from BC Math. Keep in mind that both the number have to be passed as strings for the function to work. Here are some examples:

Uses of the Modulo Operator

In this tutorial, we will restrict ourselves to integer modulo because it is much more common and has a lot of applications.

Checking If a Number Is a Multiple of Some Other Number

The result of the modulo operator is zero if the first number is perfectly divisible by the second number. This could be used to check if one number is a multiple of the other in a given number pair. Probably the most common use of this property of the modulo operator is in checking if a number is even or odd. Here is an example:

In the above example, you could be getting the list of colors from a user and asking them to only provide an even number of colors.

The example below uses a similar reasoning to create groups with 5 students each. In real life, you will have to use extra code to group the students, but the basic idea of checking if the total students are multiples of 5 does not change.

Changing Numbers to Be a Multiple of Some Other Number

In the above section, we used the modulo operator to inform users to only provide input values in certain multiples. If that is not possible, we can also force the input to be even as well as a multiple of 5 or some other number.

The modulo operator provides the whole number left after dividing the first number by the second number. This means that subtracting the remainder from the first number will make it a multiple of the second number. For example, 28 can be changed to be a multiple of 5 by taking the modulo 28 % 5. In this case, the modulo will be 3. We can now subtract 3 from the original number to make it a multiple of 5. The following line will force any positive number x to be a multiple of another positive number y by subtracting an appropriate value from it.

In our previous example with 28 students, we could just leave 3 students out and group other students together.

Put a Limit on the Input

As I mentioned at the beginning of the post, in the case of positive numbers, the modulo operator will return a number between 0 and N - 1, where N is the divisor. This means that you can put a cap on any input and do some operations repetitively and sequentially. Here is an example:

In the above example, we have just five colors but a total of 180 images. This means that we will have to keep looping through the same five colors and assign them to all our images. The modulo operator fits this need perfectly. It will restrict the value of $i % $color_count between 0 and (5 - 1) or 4 inclusive. In other words, we will be able to pick all the colors of our array sequentially very easily.

Do Some Task Every Nth Time in a Loop

When traversing a loop, we can check the value of a variable incremented with each pass through the loop and perform a specific task after every nth iteration. One practical use case that comes to mind is updating users about a long-running process. Let's say you are making changes to 1,000 different images using PHP. If the changes are significant, this process will take a while to update all images.

In such cases, the users will have no way of knowing if the program is just stuck or actually making any progress. What you could do is report the progress to users after editing every 10th image.

The update_images() function in the above example is completely made up, but you could replace it with other processes like resizing the images, adding watermarks, turning them grayscale, etc. (Check out my PHP GD image editing tutorials if you want to learn how to programmatically edit images in PHP yourself.)

Converting Between Different Units of Measurement

The modulo operator can also be used to convert between different units of measurement. For example, you could use it to change a time duration expressed in seconds into the same duration expressed in hours, minutes, and seconds. Similarly, you could also convert a large number of centimeters into kilometers, meters, and centimeters. Here is an example:

We begin by simply dividing the total number of seconds by 3,600 and casting the value into an integer. This gives us the total number of hours since every hour has 3,600 seconds.

In the next step, we subtract 3600 * $hours from the original number of seconds. This gets rid of all the seconds that we have converted to hours. Dividing by 60 now will give us the total number of minutes. Finally, we use the modulo operator to get the number of seconds.

Calculating the GCD of Two Numbers

You can also use the Modulo operator to quickly calculate the greatest common divisor of two numbers. The trick is to keep calculating the modulo of the numbers and reassigning them until they divide completely.

We keep calculating $a%$b, if $b does not completely divide $a. After each calculation $b is assigned to $a and the modulo we calculated earlier is assigned to $b. The value of $b when the modulo becomes 0 is our GCD.

Calculating Modulus with Modular Exponentiation

Modular exponentation is used in many fields in computer science like cryptography. It relies on a property of modulus where:

We can create a function based on the above property to calcuate the remainder when dividing x y by m.

Calculating the modulo by first evaluating the exponent 44 123 would have given us a 203 digit number. It would be much bigger if the exponent is over 1000. In such cases, using the above function will give us the modulo much more quickly.

The function simply returns 0 if the divisor is 1. Otherwise, it run a for loop for $exponent number of iterations and calculate the modulus at each point. The end result is simply the remainder that we would have gotten by calculating the value of exponential expression and taking the modulo of the result.

Final Thoughts

As you saw in this tutorial, the modulo operator, though easy to use, has a lot of applications. We began this tutorial by looking at the modulo of both positive and negative numbers as well as floats. After that, we covered some common scenarios where we would use modulo.

If you have any questions related to this tutorial, please let me know in the comments. Do you have any other uses of modulo in mind? Please share them with fellow readers by posting them below.

Learn PHP With a Free Online Course

If you want to learn PHP, check out our free online course on PHP fundamentals!

 

In this course, you'll learn the fundamentals of PHP programming. You'll start with the basics, learning how PHP works and writing simple PHP loops and functions. Then you'll build up to coding classes for simple object-oriented programming (OOP). Along the way, you'll learn all the most important skills for writing apps for the web: you'll get a chance to practice responding to GET and POST requests, parsing JSON, authenticating users, and using a MySQL database.



How to Use Browser Caching in WordPress

$
0
0

In this article, I'll discuss the benefits of browser caching and how you can use it for your WordPress websites. In the first half of the article, you'll learn to set up browser caching with Apache and Nginx server configuration. Then I'll show you how to use third-party plugins for browser caching.

Browser Caching And Why You Should Use it

Browser caching is a technique which allows you to store your website's resources on the client or browser side. This means the browser doesn't need to download those resources (eg. images or scripting), improving the overall load time of your webpages. This results in better UX since your website will load faster.

Apart from that, browser caching significantly improves your SEO ranking—it's considered to be an essential requirement for a website. If you measure your web performance score with tools like Google PageSpeed, you'll notice significant improvements after you leverage browser caching.

What exactly does a browser do when your website enables browser caching? Basically, when you request a webpage, a browser makes a lot of requests to the server in the background to load different resources like images, CSS, JavaScript, and font files. Now, when the browser caching is enabled, it would store all these resources on the client or user side. And thus, when a user browses other pages of your website, a browser doesn’t have to download these resources again from the server, as it could use the cached resources.

The benefit of using browser caching is twofold. Firstly, it reduces the number of HTTP requests a browser has to initiate to the server to load resources. Also, since it loads the required resources from the browser cache, the overall page speed is significantly improved.

Broadly speaking, there are two different ways you could implement browser caching for your WordPress websites. If you are comfortable enough to edit a few configuration files, you could implement it by editing the server specific configuration files. On the other hand, if you don’t have access to your server configuration or don't want to risk messing it up, you could use third-party plugins which allow you to configure different caching options from the admin side itself.

How to Leverage Browser Caching With Apache And Nginx

In this section, we’ll go through the necessary steps to implement browser caching with the help of server-specific configuration files.

Browser Caching With the Apache Server

In Apache, the mod_expires module allows you to set expires and cache-control headers. Specifically, you could use ExpiresDefault and ExpiresByType directives to configure cache lifetime in a more readable syntax. You can configure it in the .htaccess file in the root of your WordPress installation.

Go ahead and open the .htaccess file in your favorite text editor. Add the following code at the end of the file and save it.

As you can see, we’ve configured browser caching for different types of files. For example, the directive ExpiresByType image/gif "access plus 1 month" tells the browser that it should cache all .gif files for a month. In the same way, we’ve configured cache lifetime for the other extensions as well. Of course, you could configure the cache lifetime as per your requirements. You could choose from the following period types:

  • years
  • months
  • weeks
  • days
  • hours
  • minutes
  • seconds

Finally, we’ve used the Header append Cache-Control "public" directive to tell the browser that it’ll be stored in the public cache. With these settings in place, you’ve enabled browser caching for your WordPress website!

So that’s how you can leverage browser caching with Apache for your WordPress sites. In the next section, we’ll see how to achieve it with the help of Nginx.

Browser Caching With the Nginx Server

If you’re running your WordPress website with the Nginx server, you would need to edit the virtual host file of your domain. If you have shell access to your server, it’s really easy to access this file and edit it. If you’re not comfortable enough to edit files from the shell yourself, I recommend you get help of a professional developer. If there’s any syntax error in your file, it may break your site!

Go ahead and open the virtual host file of your website. It's important to note that you would need either sudo or root access to be able to edit this file. In most cases, you'll find it under the /etc/nginx/sites-enabled directory on your server. Add the following code in the server block.

In the case of Nginx, we’ve used the location directive to configure file types for which we want to enable browser caching. Following that, the expires directive is used to configure the cache lifetime. And finally, the add_header directive is used to add the Cache-Control header.

Once you’ve saved the changes, you should test your Nginx configuration to make sure that the syntax is correct. For *nix-based systems—Linux, Unix, and macOS—you could run the nginx -t command to test it. For Windows systems, you could use the GUI tools to do it. Finally, if everything looks good, you can go ahead and restart your Nginx server. After the Nginx server is restarted, it should enable browser caching and static resources will be cached on the client side.

In the next section, we’ll discuss how you can enable caching with the help of third0party plugins.

How to Enable Browser Caching With Third-Party Plugins

In WordPress, there’s barely anything which you can't achieve with third-party plugins. And that’s true as well when it comes to browser caching. There are a lot of plugins that allow you to enable different caching features from the admin side itself. In this section, we’ll discuss the Leverage Browser Caching plugin, which is a popular one among this category.

Firstly, go ahead and download it from the WordPress marketplace. Follow the standard WordPress plugin installation instructions to install it. And once it’s installed, you’re done! You don’t need to do any configuration at all!

It’s important to note that this plugin will only work with sites that use Apache as a web server, since it modifies the .htaccess file located in the root of your WordPress installation to enable browser caching. As the Leverage Browser Caching plugin writes into the .htaccess file, you want to make sure that this file is writable by the web server.

Apart from this plugin, there are a few other plugins as well that you could try and experiment to see how they work. I would encourage you to exercise different options to see how it affects your website performance.

Another powerful plugin that includes settings for browser caching is WP-Optimize. You can learn all about how to use WP-Optimize it in our free course on essential WordPress plugins.

Conclusion

Today, we discussed how you to use browser caching in WordPress website. It’s an essential part of fine-tuning your website performance. 

If you want to learn how to make a WordPress site from A to Z, be sure to check out our complete guide.

 

You can also learn how to use WordPress with our free online course.

 

 

 

Uploading Files With AJAX

$
0
0

I can’t seem to reach the end of the fun stuff you can do with web technologies. Today, I’m going to show you how to upload files via AJAX.

First, we'll see how to upload files using vanilla JavaScript. And later on, I'll show how you could use the DropzoneJS library to implement drag-and-drop file uploads.

Looking for a Quick Solution?

If you're looking for a quick solution, there's a great collection of file upload scripts and applications over at CodeCanyon.

JavaScript File Loaders and Uploaders

How to Upload a File With Vanilla JavaScript

There are three main components to our project.

  • The multiple attribute on the file input element.
  • The FileReader object from the new File API.
  • The FormData object from XMLHttpRequest.

We use the multiple attribute to allow the user to select multiple files for upload (multiple file upload will work normally even if FormData isn’t available). As you’ll see, FileReader allows us to show the user thumbnails of the files they’re uploading (we’ll be expecting images).

For older browsers that don't support FormData or FileReader, the upload behavior will fall back to a normal, non-AJAX file upload.

With that out of the way, let’s get coding!

Step 1: The Markup and Styling

Let’s start with some basic markup and styling. Of course, this isn’t the main part of this tutorial, I won’t treat you like a newbie.

The HTML

Pretty basic, eh? We’ve got a form that posts to upload.php, which we’ll look at in a second, and a single input element, of type file. Notice that it has the boolean multiple attribute, which allows the user to select multiple files at once.

That’s really all there is to see here. Let’s move on.

The CSS

No shockers here, we're just creating some basic styling for our upload form.

Step 2: The PHP

We need to be able to handle the file uploads on the back end as well, so let’s cover that next.

upload.php

Bear in mind that these were the first lines of PHP I’d written in easily a year. You should probably be doing a bit more for security; however, we’re simply making sure that there are no upload errors. If that’s the case, we use the built-in move_uploaded_file to move it to an uploads folder. Don’t forget to make sure that the folder is writable.

So, right now, we should have a working upload form. You choose an image (multiple, if you want to and your browser lets you), click the Upload Files! button, and you get the message Successfully Uploaded Images.

Here’s what our mini-project looks like so far:

But, come on, it’s 2020: we want more than that. You’ll notice that we’ve linked up jQuery and an upload.js file. Let’s crack that open now.

Step 3: The JavaScript

Let’s dive right into the JavaScript code for file uploading!

Here’s what we start with. We create two variables: input is our file input element, formdata will be used to send the images to the server if the browser supports that. We initialize it to false and then check to see if the browser supports FormData. If it does, we create a new FormData object. Also, if we can submit the images with AJAX, we don’t need the Upload Images! button, so we can hide it. Why don’t we need it? Well, we’re going to auto-magically upload the images immediately after the user selects them.

The rest of the JavaScript will go inside your anonymous self-invoking function. We next create a little helper function that will show the images once the browser has them:

The function takes one parameter: the image source (we’ll see how we get that soon). Then, we simply find the list in our markup and create a list item and image. We set the image source to the source we received, put the image in the list item, and put the list item in the list. Voila!

Next, we have to actually take the images, display them, and upload them. As we’ve said, we’ll do this when the onchange event is fired on the input element.

So, what do we want to do when the user has selected files? First, we create a few variables. The only important one right now is len = this.files.length. The files that the user has selected will be accessible from the object this.files. Right now, we’re only concerned with the length property, so we can loop over the files... and that is exactly what we’re doing next. Inside our loop, we set the current file to file for ease of access. Next thing we do is confirm that the file is an image. We can do this by comparing the type property with a regular expression. We’re looking for a type that starts with “image” and is followed by anything. (The double-bang in front just converts the result to a boolean.)

So, what do we do if we have an image on our hands?

We check to see if the browser supports creating FileReader objects. If it does, we’ll create one.

Here’s how we use a FileReader object: We’re going to pass our file object to the reader.readAsDataURL method. This creates a data URL for the uploaded image. It doesn’t work the way you might expect, though. The data url isn’t passed back from the function. Instead, the data url will be part of an event object.

With that in mind, we'll need to register a function on the reader.onloadend event. This function takes an event object, by which we get the data URL: it’s at e.target.result. We’re just going to pass this data RUL to our showUploadedItem function (which we wrote above).

Next, we check for the formdata object. Remember, if the browser supports FormDataformdata will be a FormData object; otherwise, it will be false. So, if we have a FormData object, we’re going to call the append method. The purpose of a FormData object is to hold values that you’re submitting via a form; so, the append method simply takes a key and a value. In our case, our key is images[]. By adding the square-brackets to the end, we make sure each time we append another value, we’re actually appending it to that array, instead of overwriting the image property.

We’re almost done. In our for loop, we’ve displayed each of the images for the user and added them to the formdata object. Now, we just need to upload the images. Outside the for loop, here’s the last piece of our puzzle:

Again, we have to make sure we have FormData support; if we don’t, the Upload Files! button will be visible, and that’s how the user will upload the photos. However, if we have FormData support, we’ll take care of uploading via AJAX. We’re using jQuery to handle all the oddities of AJAX across browsers.

You’re probably familiar with jQuery’s $.ajax method: you pass it an options object. The urltype, and success properties should be obvious. The data property is our formdata object. Notice those processData and contentType properties. According to jQuery’s documentation, processData is true by default, and will process and transform the data into a query string. We don’t want to do that, so we set this to false. We’re also setting contentType to false to make sure that data gets to the server as we expect it to.

And that’s it. Now, when the user loads the page, they see this:

And after they select the images, they’ll see this:

And the images have been uploaded:

So that's how you can upload files using the vanilla JavaScript. In the next section, we'll see how to implement file upload with the DropzoneJS library.

How to Use the DropzoneJS Library

The DropzoneJS library is a popular free library which allows you to implement the file uploads functionality the blink of an eye. It also supports drag-and-drop file uploads along with a beautiful preview feature.

Let's have a look at the following code which implements the file upload functionality with DropzoneJS.

You'll have to download the dropzone.js and dropzone.css files locally first.

Apart from that, you just need to use the dropzone class in the form tag, and the DropzoneJS library will handle the rest!

Let's see how it looks like when you load it in your browser.

As you can see, there's a section which allows you to drop files on it, alternatively you could also select files from your computer by using the default file selection dialog box. Go ahead and drop a few image files on it and it should present you a nice preview as shown in the following screenshot.

Isn't that look amazing with just a few lines of code? In fact, the DropzoneJS library also allows you to customize the UI and other stuff. I would encourage you to check the configuration options provided by this library.

Apart from this, there's the filepond library which is also a popular file upload library you could use. It provides all niche features like drag and drop, progress bar, previews, reordering and alike.

That’s a Wrap!

Uploading files via AJAX is pretty cool, and it’s great that these new technologies support that without the need for lengthy hacks.

Learn JavaScript With a Free Course

If you want to master JavaScript, be sure to check out our free course to learn the complete A-Z of modern JavaScript fundamentals.

 

In this course, you'll learn all of the essential concepts of the JavaScript language. That's right: all of them! Including the most important recent improvements to the language, in JavaScript ES6 (ECMAScript 2015) and JavaScript ES7 (ECMAScript 2016).

You'll start with the very fundamentals of the language: variables and datatypes. Then in each lesson you'll build knowledge, from data structures like arrays and maps to loops, control structures, and functions. Along with the basics of the language, you'll also learn some key built-in APIs for manipulating data, AJAX, and working with the web browser DOM. Finally, you'll get a look at some of the most powerful and widely used web APIs that are supported by all modern browsers.

This post has been updated with contributions from Sajal Soni. Sajal belongs to India and he loves to spend time creating websites based on open source frameworks.

21 Best Tab and Accordion Widget Plugins for WordPress (Free & Premium)

$
0
0

Your website's content should be organized and beautiful. By adding a tab or accordion widget plugin to your WordPress website, you will be able to display your website's content in an elegant way. 

An interactive accordion and tab plugin can tidy up the design and readability of your webpages.

ZF WordPress Category Accordion
Get this WordPress accordion plugin for your WooCommerce site from CodeCanyon 

Accordions and tabs are great ways to communicate text-heavy information in a stylish and condensed way. Keeping your website clutter-free and interactive should be the main priority for your website, and accordions and tabs help you accomplish this. 

At CodeCanyon, you will be able to choose from a library of premium WordPress accordion plugins available and find a tab and accordion plugin that will fit your website's theme and allow you to display your website's information without crowding your page's designs. 

The Best WordPress Tab and Accordion Plugins on CodeCanyon

Discover CodeCanyon's extensive library of the best tab and accordion WordPress widgets and plugins ever created. With a cheap one-time payment, you can purchase these high-quality WordPress widgets and plugins and draw in more traffic to your website. 

Here are a few of the best-selling tab and accordion WordPress widgets available on CodeCanyon for 2021.

Best-Selling WordPress Tab  Accordion Widgets  Plugins
Best-selling tab and accordion widgets and plugins available on CodeCanyon 

These powerful tab and accordion plugins allow you to display your website's text and media in a systematic order that fits your particular website. These widgets and plugins come with plenty of features that can enhance your website, including:

  • pagination
  • animated layers
  • customizable columns and rows
  • touch-enabled mobile functionality 
  • lightboxes

Head on over to CodeCanyon and choose from the premium tab and accordion plugins available now! 

15 Best Tab and Accordion WordPress Widgets for 2021

Here are 15 of the top-rated WordPress tab and accordion widgets and plugins that are available for you to download on CodeCanyon:

1. Ultimate Searchable WordPress Accordion

Ultimate Searchable WordPress Accordion

This five stars rated WordPress accordion plugin for WPBakery Page Builder is a crowd favorite. Some of its coolest features are:

  • quick and easy installation
  • responsive accordion layouts
  • unique live content search
  • 14+ smooth animations
  • 6 pre-defined color themes
  • RTL support
  • lifetime support and updates

See what user spektacle says about this accordion WordPress plugin widget:

Probably the best accordion add-on available for WPBakery (Visual Composer). Lots of flexibility to adjust the look and feel of each accordion and the transitions are super smooth to create a sleek effect.

2. BWL Knowledge Base Manager WordPress Accordion

BWL Knowledge Base Manager WordPress Accordion

This is one of the best best tab plugins for WordPress we've got. The WordPress tabs plugin is user-friendly, fast and fully responsive. People love this WordPress tabbed content widget because:

  • no configuration is required
  • responsive grid system
  • AJAX-based searching system
  • animated and responsive tabs
  • extensive Options panel
  • unlimited customization
  • lifetime support and updates

User cleolc says:

This is a quality plugin for WordPress. We have over 400 entries to manage in our knowledge base and this app works flawlessly! And customer service has been fast and extremely helpful.

3. ZF WordPress Category Accordion

ZF WordPress Category Accordion

This WordPress accordion plugin was created to improve your WooCommerce website with a better navigation experience. 

ZF WordPress Category Accordion plugin allows you to show all your categories as WooCommerce category accordions. Check this WordPress accordion's nice features:

  • support WooCommerce category accordion
  • support WordPress category accordion
  • pages accordion (accordion menus)
  • translation ready
  • support shortcodes and widgets
  • toggle accordions
  • 7 default color schemes

4. CSS3 Accordions For WordPress

CSS3 Accordions For WordPress

This accordion WordPress plugin widget is entirely based on CSS3. It's one of the best accordion plugin for WordPress because it comes with an intuitive admin panel, horizontal and vertical layouts and unlimited color skins. 

You can put any type of content inside the expandable section including lists, images or any custom HTML code.

5. Accordion Slider—Responsive WordPress Plugin

Accordion Slider

The Accordion Slider WordPress theme combines two great functions in one handy plugin. First it functions as an accordion, and secondly it functions as a slider. Best features of this accordion and accordion slider include:

  • add as many panels as you want, without worrying about screen space
  • touch-enabled to work well with mobile screens  
  • loads images and content from posts, galleries, and Flickr
  • accordions are automatically cached to improve the load time
  • can be placed anywhere: in posts/pages, template PHP code, or widgets

Accordion Slider—Responsive WordPress Plugin is a great two-in-one accordion plugin that will appeal to those looking for a great way to present images or text.

6. Grid Accordion—Responsive WordPress Plugin

Grid Accordion - Responsive WordPress Plugin

One of the best-looking WordPress accordions out there, Grid Accordion adds a fresh feel to your site by offering a feature not found in other plugins: an accordion that works in two directions. While most plugins let you open and close tabs or similar UI elements either horizontally or vertically, with this accordion plugin, you can do both. Not only does it handle text content well within its accordion grid, but you can even fill your content areas with images and other media for a more stunning effect.

Make sure to check out the demo for Grid Accordion here.

This accordion WordPress plugin widget also comes with a host of other features, such as:

  • a fully responsive and touch-enabled design
  • support for dynamic content from posts and galleries
  • available hooks for actions and filters
  • JavaScript API endpoints for maximum customization

7. WP Responsive FAQ With Category

WP Responsive FAQ With Category

The Responsive FAQ With Category WordPress tabs plugin is specifically designed for users who want to add a Frequently Asked Questions area to their site and don’t want their visitors to have to scroll through an endless stream of text.

This WordPress tabbed content widget's best features include:

  • FAQs can be arranged by category
  • 15 customizable different designs to choose from
  • compatible with Visual Composer page builder and WooCommerce
  • two types of FAQ toggle icons: arrow or plus sign

There’s no question this one of the best tab plugin for WordPress and that WP Responsive FAQ with Category is the answer to all your FAQ needs.

8. WooCommerce Category Accordion

WooCommerce Category Accordion

The WooCommerce Category Accordion is designed specifically for WooCommerce users. It can be used as a widget or shortcode to list product categories and subcategories. The best features of this WordPress accordion are:

  • supports unlimited categories and subcategories
  • 14 Font Awesome icons included
  • ability to highlight current category option
  • sort by ascending or descending order

WooCommerce Category Accordion is ideal for users who want to organize their products or services into categories and subcategories to make it easier for customers to navigate their site.

9. Responsive Searchable 3 Level Accordion

Responsive Searchable 3 Level Accordion

Responsive Searchable 3 Level Accordion is a simple WordPress accordion plugin that can be used anywhere on your site. It will appeal to users who are looking to arrange content in accordion style within a post, sidebar, footer, etc. Best features of this accordion and accordion slider are:

  • can be used as a widget or shortcode
  • three nesting levels available
  • five ready-made styling options
  • allows users to type in searched phrase

Responsive Searchable 3 Level Accordion For WordPress is a low-fuss accordion plugin, and its standout features like three-level support and searchable content really set it apart.

10. Accordion FAQ WordPress Plugin

Accordion FAQ WordPress Plugin

FAQ pages are an important part of almost any website, and with this WordPress accordion plugin, you can fit a mountain of text behind a sleek and easily digestible display. This accordion plugin focuses on doing one thing, creating FAQ-style content easily, and it does it well. Here’s what you can expect to get with this WordPress tabs plugin:

  • ability to quickly add multiple FAQ accordions throughout your site
  • easy drag-and-drop interface for reordering
  • color, icon, and font customization
  • built-in generator for creating shortcodes

If you’re looking to add an FAQ section to your existing design, then the Accordion FAQ WordPress Plugin has you covered.

11. WordPress Tabs and Accordions DZS

WordPress Tabs and Accordions

WordPress Tabs and Accordions DZS is another of the best tab plugin for WordPress that gives users access to both tab and accordion functions. Best features:

  • full skins to fit every brand
  • WYSIWYG editor
  • unlimited color options for customization
  • iPhone, iPad, and Android optimized
  • and more

So if StackTabs doesn’t appeal, WordPress Tabs and Accordions DZS is another great two-for-one WordPress tabbed content widget.

12. Side Tabs—Layered Popups Add-on

Side TabsLayered Popups Add-on

A little different than most of the plugins on this list, Side Tabs delivers the features you’d expect from a WordPress tabs plugin, but instead of existing within your site’s content, they live at the edge of your screen. This unique presentation creates a number of unusual uses.

One of the most interesting ways you can use Side Tabs is to present a constant access point to content throughout an entire page (or several pages). Besides that, this WordPress tabbed content widget also makes a great tool for offering Calls to Action and similar content without being too intrusive.

With a ton of customization and animation options available out of the box, this is one of the best tab plugin for WordPress. It works brilliantly for anyone looking to add a fresh way of presenting information to their site.

13. WooCommerce Tabs Pro: Extra Tabs for Product Page

WooCommerce Tabs Pro Extra Tabs for Product Page

If you have a WooCommerce site, the WooCommerce Tab Pro plugin will allow you to create and manage 11 different types of tabs to display your products. Best features of this WordPress tabs plugin are:

  • ability to add unlimited tabs to a single product page
  • WYSIWYG editor for editing custom content
  • ability to enable or disable tabs
  • ability to create a global tab that can be used with all products

When you have an eCommerce site, making improvements to your layout can really boost sales. With WooCommerce Tabs Pro: Extra Tabs for Product Page, the tills will soon be ringing.

14. Elegant Tabs for Visual Composer

Elegant Tabs for Visual Composer

Elegant Tabs for Visual Composer is an add-on for the WPBakery WordPress plugin (formerly Visual Composer). This WordPress tabbed content widget lets you add any shortcode to multiple tabs and offers loads of customization like different colors, icons, and backgrounds for different sections or tabs. Best features include:

  • vertical tabs
  • drag and drop any WPBakery elements inside the tab content
  • supports deep linking
  • ten different styles of tabs and unlimited variations
  • and more

Elegant Tabs is also available for Fusion BuilderWooCommerceCornerstone, and Beaver Builder.

15. PullOut Widgets for WordPress

PullOut Widgets for WordPress

Like the Social Network Tabs for WordPress, the PullOut Widgets is a different take on tabs. The WordPress tabs plugin is specifically designed to turn any widget on your site into a pullout tab. Best features:

  • 289 icons for pullout tabs
  • 32 sliding animation effects
  • unlimited pullout widget positioning on the top, right, bottom, or left side
  • unlimited widget colors

The most successful websites are interactive, and PullOut Widgets for WordPress gives your visitors plenty of chances to engage with your content.

5 Free Tab and Accordion WordPress Widgets and Plugins for Download in 2021

The best features and most beautiful interfaces are found in the premium plugins from CodeCanyon. But, if you're on a budget or just want something simple, check out these free tab and accordion plugins for WordPress.

1. Arconix Shortcodes

Arconix Shortcodes

Arconix Shortcodes is a very versatile accordion plugin and is a must-have if you cannot afford any of the premium plugins. With this plugin, you can add not only accordions but styled boxes, buttons, tabs, unordered lists, columns, and much more.

2. Easy Accordion

Easy Accordion is a responsive drag-and-drop accordion builder that will help you to display multiple accordions on your WordPress website. No coding is necessary to add the accordions to your website as everything is added through shortcodes.

3. Accordion

Accordion

This Accordion plugin can help you create different sections of your website, including but not limited to FAQs, a knowledge base, and a question & answer section. You can change colors, font size, and icons for each accordion.

4. Squelch Tabs and Accordions Shortcodes

With the use of shortcodes, you can add horizontal accordions, vertical accordions, and tabs. This free plugin will help you save space on your webpages, make your website look more professional, and add an interactive component to your website.

5. Shortcodes Ultimate

Shortcodes Ultimate allows you to add many tools to your website. You can easily create tabs, buttons, boxes, sliders and carousels, and responsive videos. The plugin comes with over 50 shortcodes for you to implement. 

How to Add an FAQ Accordion to Your Website

In this example, we are going to create an FAQ section for our online store using one of our best accordion plugin for WordPress. 

First, we need to create a category for our FAQ accordion so the plugin knows what content to add to each specific accordion. Once you have installed the Accordion FAQ WordPress plugin, head on over to WP Dashboard > FAQ > Categories. In the name field, we will type "Online Store" and click the Add New Category button. 

Next, we will click on WP Dashboard > FAQ > Add New. We will add our three FAQ entries this way. We will include the question in the title and the answer in the text editor. 

Creating FAQ Entry

For each of our entries, we will make sure to click the checkbox next to the category, Online Store, that we created to make sure we group the entries together. 

Once we have added our three FAQ entries for our online store, it is time to add the accordion widget to a page. On an existing or new page or post, click on the Add Shortcode button on the top of the text editor. Choose Insert FAQs from the Select a Shortcode drop-down menu. From here we will be given a basic group of settings for us to change. We will choose the Online Store category from the Faq Category option and change the Icon Background Color to blue. 

Changing Accordion Settings

Click the Insert Shortcode button, and the shortcode will be added to the text editor. The FAQ accordion will now be displayed on your webpage for all your users to see!

Online Store Accordion FAQ

Install a Tab or Accordion WordPress Widget Now! 

By adding a premium tab or accordion plugin to your website, you will be able to simplify your web page's design and display your text and media in an easy-to-understand way. 

These handy widgets and plugins allow you to integrate interactive displays for your website's content that can be styled to fit your website's theme. 

In addition to all the high-quality tab and accordion widgets available, there are also thousands of other high-quality WordPress plugins on CodeCanyon that can help enhance your website. Take look through this massive collection of plugins and you will find all types of plugins, including gallery, newsletter, eCommerce, and marketing plugins.

This post has been updated with contributions from Maria Villanueva, a journalist and writer with many years of experience working in digital media.

25 Best WordPress Slider & Carousel Plugins of 2021

$
0
0

Whether you want to show off customer testimonials, your latest blog posts, your best images, or other media on your website, there is a WordPress slider plugin or WordPress carousel slider plugin out there that’s right for you.

Add interactive and stylish looking sliders and carousels to your WordPress website to show off your website's content in an attractive way. 

Slider Revolution Responsive WordPress Plugin
One of the many fully customizable WordPress Slider & Carousel Plugins on CodeCanyon

Images, videos, and graphics are necessary to draw in and keep your audience's attention. Simply placing this media on your website is not enough. You must present this media in a way that fits in with your website's theme and invites the user to share the content.  

At CodeCanyon, you will be able to choose from all the premium plugins available and find the exact slider and carousel plugin that will fit your website's theme and grab your website viewers' attention. 

The Best WordPress Slider & Carousel Plugins on CodeCanyon

Discover CodeCanyon's extensive library of the best slider and carousel WordPress plugins ever created. With a cheap one-time payment, you can purchase these high-quality WordPress plugins and draw in more traffic to your website. 

Here are a few of the best-selling slider and carousel WordPress plugins available on CodeCanyon for 2021.

Best Selling Carousel  Slider WordPress Plugins On CodeCanyon
Best-selling slider and carousel plugins available on CodeCanyon

Using the default WordPress editor to add your media can damage your brand. Uploading your media this way leaves you with little to no flexibility when it comes to design and functionality. 

By taking advantage of the premium plugins available on CodeCanyon, you will have access to slider and carousel features such as:

  • ready-to-go templates
  • responsive designs
  • drag-and-drop editors
  • eye-catching animations

20 Best WordPress Slider & Carousel Plugins (From CodeCanyon for 2021)

1. Slider Revolution Responsive WordPress Plugin

Slider Revolution Responsive WordPress Plugin
Slider Revolution Responsive WordPress Plugin

The Slider Revolution is our best-selling WordPress carousel slider plugin. Users love this WordPress slider because it allows them to create stunning elements without writing code.

Some of the best features of the Slider Revolution Responsive WordPress plugin are:

  • new visual editor
  • 200+ templates
  • 20+ addons
  • 2000+ elements object library
  • lifetime updates

This WordPress slider holds a 4.75 stars rating. User CraigRutherford says:

The interface is very impressive alongside fantastic features

Slider Revolution is a favourite here at Envato Tuts+. You can learn more about it in one of our other posts.

2. Kreatura Slider Plugin for WordPress

Kreatura Slider Plugin for WordPress
Kreatura Slider Plugin for WordPress

The Kreatura Slider Plugin for WordPress is another top-selling and top-rated WordPress carousel plugin.

Easily create sliders, image galleries, slideshows, landing pages and more with this Kreatura WordPress slider plugin. This features:

  • new animation engine
  • premium slider templates
  • fully responsive layout for a perfect fit on all devices
  • SEO optimized

User Cleijsen says:

One of the best slider products out there

3. Master Slider—Touch Layer Slider WordPress Plugin

Master Slider - Touch Layer Slider WordPress Plugin
Master Slider—Touch Layer Slider WordPress Plugin

Touch screens are present on smartphones, tablets and more devices. Give your visitors a nice navigation experience and integrate this touch WordPress image slider.

Master Slider is a truly responsive and device friendly slider which works perfectly on all major devices.

  • 70+ pre-built sliders
  • visual editor—no coding knowledge required
  • transition editor
  • WooCommerce integration
  • fully responsive

4. Slaido—Template Pack for Slider Revolution WordPress Plugin

Slaido - Template Pack for Slider Revolution WordPress Plugin
Slaido—Template Pack for Slider Revolution WordPress Plugin

Slaido is a WordPress slider plugin that allows you to browse through more than 300 slider templates in your WordPress dashboard and import them with just one click. Slaido is a really complete carousel slider plugin. It comes with more than 300 responsive templates, including more than 100 multi-purpose niche templates.

Check some key features:

  • fully responsive sliders
  • easy to import or export 
  • smooth animations
  • all PSD source files included
  • life-time updates

5. Ultimate 3D Carousel Wordpress Plugin

Ultimate 3D Carousel Wordpress Plugin
Ultimate 3D Carousel Wordpress Plugin

Looking for a different WordPress image slider? Check this 3D WordPress carousel plugin. This WordPress image slider allows you to display multimedia content with an unique layout from a 3D perspective. It runs on all major browsers and it's compatible and responsive on mobile devices.

Check some key elements of one of the best video slider plugin WordPress:

  • supports unlimited categories
  • shortcode generator
  • customizable thumbnails 
  • customizable hover effects 
  • include multiple stances on the same page

6. Multimedia Responsive Carousel with Image, Video and Audio Support

Multimedia Responsive Carousel with Image Video and Audio Support
Multimedia Responsive Carousel with Image, Video and Audio Support

If you work with video and need to feature many clips in your website, you'll need one of the best video slider plugin WordPress we've got. This WordPress carousel slider is a great option because it supports multimedia and be customized as video gallery or audio gallery.

Check its best features:

  • touch screen navigation support for mobile
  • responsive design
  • two predefined skins: black and white
  • multimedia support: Images, YouTube, Vimeo, HTML5 video and HTML5 audio
  • supports links for each image 
  • autoplay parameter 

7. RoyalSlider WordPress Carousel

RoyalSlider
RoyalSlider

The single most downloaded slider at CodeCanyon, RoyalSlider for WordPress is packed with irresistible features. Used by companies as diverse as Coca Cola, Ralph Lauren, and Land Rover, this plugin does just about everything you could possibly want from a slider.

The most appealing feature is the native HTML5 fullscreen support. Perfect for showing high-resolution photography!

Other standout features include:

  • multiple sliders per page are allowed, even with different skins
  • touch swipe navigation support
  • responsive design
  • vertical or horizontal thumbnails, bullets, or tabs for navigation

RoyalSlider will definitely wow your visitors with its clean design and professional functionality.

User frctech says:

"I have used RoyalSlider since 2011. It is reliable, well-designed, well-maintained, and well-supported. On the handful of occasions that I've needed support, answers have been prompt (freaky fast even), intelligent (no crappy canned responses), and have solved my issue."

8. Logos Showcase

Logos Showcase
Logos Showcase

The Logos Showcase plugin is specifically created for users who want to make a grid of images with external or internal links or need to display a list of clients' or sponsors' logos.

The standout feature with Logos Showcase is the ability to display logos in a grayscale version, with the option to display the original colours by hovering if desired.

Standout features include:

  • choice of three different ways to display images
  • control of transition speed and auto-scroll is enabled
  • control of default size of logo images
  • option to set URLs to each logo which can open on the same page or in a new page

Logos Showcase is the slider to choose if your priority is to display logos and lists most effectively.

User cross5 says:

"More than incredible customer support. The plugin is really easy to use, all needed features are available. Highly recommended!"

9. All Around WordPress Carousel Slider

All Around
All Around WordPress Carousel Slider

All Around, as the name suggests, is a really well-rounded slider. It gives you a clean, responsive design, a number of predefined styling options, and support for swipe gestures. Use one of the six layouts or customise the plugin manually as needed. 

Standout features include:

  • six premade styles
  • support for videos
  • vertical or horizontal sliders
  • supports multiple sliders on one page
  • autoplay mode

The All Around slider isn't all-around by name only. If this is your first WordPress slider and carousel plugin, it just might also be the last one you'll ever need.

10. Super Bundle WordPress Carousel Slider

Super Bundle
This is a display of what the carousel from the Super Bundle WordPress plugin could create.

One of the best slider plugins for WordPress, Super Bundle is a collection of terrific elements, settings, and tools that are designed to take your WPBakery Page Builder site to the next level. It lets you turn any content into a carousel, add a video lightbox, animate text, etc.

Standout features include:

  • parallax background and video background options
  • over 70 customizable, high-quality SVG row separator designs
  • 13 entrance animations and 14 exit animations
  • 6 unique text effects
  • video or image thumbnails that when clicked open a large video lightbox popup

What's great about Super Bundle is that apart from creating great carousels, it allows you to add a ton of other cool features to your WordPress site. A great multipurpose plugin.

User alienflaky says:

"There are more than one reason I gave this product 5 stars. From an awesome product to a solid back-end support, it is definitely a must if you want to customize your WordPress beyond a purchased theme."

11. Global Gallery WordPress Carousel

Global Gallery
Global Gallery WordPress Carousel

Global Gallery is a WordPress image slider that helps you to create awesome galleries from a variety of image sources, including Flickr, Facebook or other social media platforms, WordPress custom elements, and any RSS feed. The plugin offers four gallery layouts and also includes both a responsive image slider and a full-featured carousel.

Standout features include:

  • four gallery layouts
  • drag-and-drop gallery builder
  • image tags filter
  • images slider with fixed or responsive sizing
  • images carousel with multi-column layouts

With its fast, one-click setup, the Global Gallery plugin will help you create filterable, fully responsive and adaptive galleries on your website in no time.

User mkknop says:

"I am so happy with getting Global Gallery! It is really easy to set up and especially together with the Overlay Manager add-on, I was getting the 'really slow zoom-in' effect I was looking for. Also notable: The perfect customer support from the author, with same-day feedback / solutions. Very recommendable and worth the price."

12. Carousel Anything WordPress Image Slider 

Carousel Anything
Carousel Anything WordPress Image Slider

If you’re in the market for a highly versatile WordPress image carousel, Carousel Anything is for you. With Carousel Anything, you can create carousels for any of your content: blog posts, image sliders, video showcases, testimonials, team members, and more. The plugin comes with two designs: one displays your posts in a simple and clean layout, while the other offers a few more design features.

Standout features include:

  • works great with touch devices
  • create carousels from your post types
  • lightweight 
  • works with any theme

This WordPress carousel slider plugin gives you one of the easiest and quickest ways to create carousels for your website. 

User Pixelschiebr says:

"I really love this add on. I am not even halfway through all the ways I could use it. But so far I use it for Sliders on news pages as well as video Galleries on my pages. It works very well with Visual Composer and I love that I can have all the settings for background colors etc. Carousel Anything is way simpler and gives me all the options that I need."

13. Progress Map

Progress Map
Progress Map

Progress Map is unique among the WordPress plugins listed here in that it combines carousel slider features with a Google Maps feature. The plugin’s aim is to help users create WordPress sites that provide listings for hotels, real estate, restaurants, job posts, etc.

With this plugin, you can plot your listings on Google Maps using markers and then feature the same listings in photos on a carousel—with connections between them! When an item is selected on the carousel, its location on the map is indicated. Likewise, when the marker on the map is clicked, it activates the image carousel.

Standout features include:

  • carousel can be positioned to the right, to the left, over or under the map
  • provides clustered map markers for a map with a large number of locations
  • carousel items are fully resizable and fully customisable
  • connect the plugin with any custom post type

If you’re looking for a visually powerful way to display a number of different locations on a map using an image carousel, the Progress Map plugin is a great solution.

User GiulioNF says:

"Insane plugin! Everything you need using maps and front-end, Really easy to customize as well!"

14. Viba Portfolio WordPress Image Slider

Viba Portfolio
Viba Portfolio WordPress Image Slider

Viba Portfolio is all about showcasing your latest blog posts, portfolio, customer testimonials, etc. to their best advantage. This WordPress gallery slider provides you with four different gallery types, as well as 60 skins to change the looks of your slider easily and quickly. It also offers full control of all customisation features, from layouts to font size to colour and overlays.  

Standout features include:

  • 60 skins
  • 4 gallery types
  • 3 filter types
  • responsive grid and responsive carousel layouts

Use Viba Portfolio as a WordPress testimonial slider, WordPress post slider, or any other kind of slider you need. It's that versatile!

User galiabrener says:

"This is the best plugin ever! Not only does it look very beautiful, but the customer support is so amazing! Thank you dear Harun for your excellent work and outstanding support! I would recommend everyone to get this beautiful plugin!

15. Ultra Portfolio WordPress Carousel

Ultra Portfolio
Ultra Portfolio WordPress Carousel

Ultra Portfolio will primarily appeal to users who are interested in building portfolios with slider features included. It offers a large number of layout options and really delivers on flexibility and functionality. The most appealing feature of this slider is the ability to control animation effects and animation speed.

Standout features include:

  • unlimited layouts
  • WooCommerce integration
  • Google Font integration
  • responsive layout lets you control the number of columns for different screens

Ultra Portfolio should be your choice if you want to combine slider functions with a wide range of portfolio options.

User iRoland says:

"Very good and easy to use plug-in for overall portfolio presentations."

16. Responsive Posts Carousel 

Responsive Posts Carousel
Responsive Posts Carousel is a lightweight and powerful carousel WordPress plugin.

With this powerful carousel WordPress plugin, you can choose from 50+ ready-to-use templates that are fully customizable in the simple live template editor. You can create all types of sliders with this plugin, such as showcases, vertical sliders, multi-row sliders, and many more, thanks to the myriad of features offered. 

Here is what one of the plugins users, Hurri500, has to say about this five-star plugin:

"Great support and a very cool and useful plugin. I had a small styling issue in the admin area which the author sorted out pronto... outstanding!"

17. Before & After Image Slider for WPBakery Page Builder

Before  After Image Slider for WPBakery Page Builder
Before & After Image Slider for WPBakery Page Builder

This easy-to-use shortcode, which works with WPBakery Page Builder, allows you to build a rather nifty slider to showcase your before-and-after photos. Your website guests will be able to trigger the before-and-after slider either on a mouse hover, by click and drag, or by the use of a scroll bar. The plugin adjusts to your screen size. 

Standout features include:

  • horizontal, vertical, and diagonal splits
  • responsive and touch enabled
  • customizable border and arrow colors
  • scroll bars are available in the settings

Before & After Image Slider for WPBakery Page Builder is great for before-and-after shots of website redesigns, photo edits, makeover sessions, and more. 

User robCODE says:

"Super. Does what it says on the tin. Compatible, easy to install and looks good."

18. Blog Layouts Bundle For Elementor

Blog Layouts Bundle For Elementor
Blog Layouts Bundle For Elementor

If you work with Elementor Page Builder, you'l love this pack. You'll get five plugins for your WordPress site: Post Blocks, Post Slider, Post Carousel, Recent Posts and Author Bio.

Enjoy this WordPress carousel plugin with:

  • user-friendly design
  • 100+ unique layouts
  • beautiful image effects
  • set custom fonts for title, category, description and meta
  • slider mode
  • vertical/horizontal carousel modes

19. Slider—Image Slider for Wordpress

Slider - Image Slider Wordpress
Slider - Image Slider Wordpress

This Slider plugin is one of our newest WordPress carousel plugins. You can embed a simple photo slider by uploading images; create an image carousel or add videos.

Announce your sales and discounts, highlight the top projects or products and tell about your company with this complete WordPress slider plugin.

  • unlimited number of slides
  • add images by URL
  • Iiteractive customizable elements: CTA-buttons, badges, texts and titles
  • adjustable slide switching duration 

User cobracinco says:

Really great plugin, after 5 minutes it was possible to create a nice looking slider – good work. Highly recommended

20. Smart Product Viewer—360° Animation Plugin

Smart Product Viewer - 360 Animation Plugin
Smart Product Viewer - 360° Animation Plugin

Impress your visitors with a 360° video carousel WordPress plugin. This image carousel was specially designed for online stores with WooCommerce. 

This 360º video carousel WordPress plugin is perfect to showcase your products. It allows a customer to see your product in detail with a full 360° spin view. It’s simple to install and easily customizable with lots of options to choose from.

The video carousel WordPress plugin is a success with users. Jakweb says:

Very easy to use and it works on mobile devices too.

5 Free Slider and Carousel WordPress Plugins for Download in 2021

Without a doubt, paid slider and carousel WordPress plugins will offer you the most comprehensive set of tools. More features, customer support, and overall user experience will be higher with these premium plugins. However, you might not currently have the budget to spend on these premium slider plugins and still need to show the images to your website visitors. 

That is why I have collected a list of five of the best free WordPress slider and carousel plugins available. 

1. Soliloquy Slider 

Soliloquy Slider allows you to create a beautiful responsive image and video slider for your WordPress site in minutes. The team over at Soliloquy has made sure to optimize the plugin for web and server performance.

2. WP 1 Slider

WP 1 Slider

WP 1 Slider has a ton of great features that can help you build an attractive-looking slider, including a responsive design, slider templates, and individual settings for each slide.

3. Responsive Slider

Responsive WordPress Slider has an intuitive drag-and-drop interface, swipe navigation, and responsive layout. Easily build SEO friendly slides with this handy little plugin.

4. MetaSlider

Free Responsive Slider by MetaSlider

This slider plugin is easy to use. Simply select the images you want to display, drag and drop them into place, and then add captions, links, and SEO fields to each image, and you are ready to display the slider. 

5. SlideDeck

SlidDeck is a popular slider plugin for all your image and video slides. This free slider plugin allows you to choose from 50+ transition effects, create a video slider, add unlimited slides to one slider, and much more. 

Getting the Most Out of the WordPress Slider & Carousel Plugins

While the premium WordPress Slider & Carousel available on CodeCanyon have all you need to create a professional-looking display for your media, there are a few tips that you will want to consider to ensure you are getting the most out of these valuable plugins. 

1. Placement Is Key

In most cases, you will want to display your slider or carousel at the top of your webpage. One of the goals of these sliders and carousels is to draw the attention of your audience, and having them anywhere but the top of your webpage will make them seem less important. 

2. Optimize for Mobile

Much of today's website browsing is done on mobile phones. All the premium plugins have responsive designs that can be adjusted to look great on mobile devices. Make sure you spend the time adjusting these mobile view settings to give these viewers the best experience possible. In addition to optimizing your slider for mobile devices, make sure to optimize it for multiple screen sizes as well.

3. Use High-Quality Images and Videos

No matter how visually appealing your slider and carousel is, if the actual images and videos aren't of high quality, you will stand little chance of gaining the attention of your website visitors. Make sure you use the highest quality images and videos available. 

Discover More Awesome WordPress Plugins

After our selection of the best video slider plugin WordPress and best WordPress sliders, let me share with you more useful plugins for your WordPress website:

Learn More About WordPress Plugins

We know WordPress can seem intimidating if you're just starting to use this awesome platform. But don't worry, here I have some resources that might help you with your WordPress website.

Additionally, you can check our fantastic course: A Beginner’s Guide to Using WordPress

Add a Premium WordPress Slider and Carousel Plugin to Your Website Now!

If you are looking to create a more visually appealing website that highlights your websites media, then purchase a premium Wordpress slider and carousel plugin from CodeCanyon

These feature-rich plugins allow you to integrate an eye-catching display for your media that can be easily customized to fit your website's theme.

While you are on CodeCanyon, feel free to check out the thousands of premium WordPress plugins available, as well as the best-selling, trending WordPress plugins of the year. 

This post has been updated with contributions from Maria Villanueva, a journalist and writer with many years of experience working in digital media.

Design and Code Your First Website in 9 Easy to Understand Steps

$
0
0

Learning how to begin coding a website can be a tough task. If you're not familiar with coding languages, it's even harder. But learning how to code a website is easy with the right guide.

In this tutorial, we'll go over simple website design for beginners with a HTML web page template. They're the easiest way to code a website. It's a process that will save you time in the long run, while letting you create a professionally-designed website for your visitors!

Black male in front of computer screen coding mobile app web development computer programming
Black male in front of computer screen coding mobile app, web development, computer programming (Stock photo from Envato Elements)

We'll be using a template from Envato Elements in this tutorial. If you want to browse other web design template options, look through Envato Element's collection of website templates. You'll find professional, responsive options that are ready to customize for your next project. 

Before We Start Our Web Design Code

You're probably excited to learn how to begin coding a website. But looking at code can be intimidating if you're a beginner. So before we dive in, let's have a look at some useful terms to know so you can understand the changes you're making in the below steps to code a website.

  • HTML: Hypertext Markup Language is a language that organizes web pages. Things like text and links are added here. In this tutorial, we'll be working with HTML.
  • Tags: Tags are how code works in HTML. They are written between angle brackets. One tag opens (i.e. <title>) and another closes (i.e. </title>). Text content goes between the opening and closing tags. 
  • PHP: A server-side scripting language which is mostly used to build web-based applications. You'll see it used to collect data. Almost all contact forms work with a PHP file. 
  • Comments: Comments are notes left by the writer of the code. These don't change anything about the page, but they let you see what the code is supposed to do.

What We'll Need

If you want to follow along with this tutorial, you'll need a couple of things:

Okno - Ultimate Multipurpose HTML5 Template

Do you have everything you need? Then let's get started!

1. Edit the Title and Header

We're working on the index-onepage-personal.html file in this tutorial. It's a simple website design for beginners to work on. Open it in Sublime Text and your browser after extracting the Okno ZIP folder. Sublime Text will let you edit the HTML code and your browser will let you see the changes in real-time.

In Sublime Text, find the title tag under the title comment (line 9). This changes the name that appears on the tab or window of the page. It will look like this in HTML:

Replace the text with the name of your site. Since this is a personal one-page website template, this will most likely be your own name. Save the file in Sublime Text, and refresh the page in your browser. You'll see the changes in the tab at the top of the window:

html code for website design project tutorial title tag

Let's move on to the navigation bar of this simple website design for beginners. This bar is visible as visitors scroll, and also includes a spot for a logo on the left. You can change the logo starting in line 45 with these lines of code:

Line 45 and line 46 are both for your logo, but for different parts of your page. Line 45 is for a light logo against a dark background. Line 46 is for a dark logo against a light background. This is to make sure your branding is visible on the page.

Place copies of your logo in the img folder found inside the assets folder. Change the file names in the code (logo-light.png and logo-dark.png) to match the file names of your logo.

Note: your logo should be in the PNG file format with a transparent background. Also note that the alt attribute is very important for your webpage in case the photo doesn't load or a visitor is using screen-reading software. Give an alternate description for all your images while working on this tutorial. 

In this template, the navigation bar represents different sections of the one-pager. If you don't want to rename these sections, feel free to skip ahead.

Under the primary menu comment, you'll see the names of each section. Edit the text between the a tags starting on line 54 to rename the links in your navigation bar. 

Save the HTML code for this web design project and refresh to see your changes.

2. Update Personal Information

Now it's time to start editing your information in the web design code. 

Let's look at the section starting with the comment on line 96. What can be changed here? We can replace the background image and avatar. You'll also be able to add your name, job title, area of expertise, and other information.

how to code a website easy tutorial personal information

Let's start by changing the images. You can edit the background photo in line 99 and the avatar in line 104. Unlike altering text, you'll need to make changes to the img tag itself through the source attribute. The src attribute tells the webpage where the photo can be found. 

If we look at the src attribute for the background photo, we can see where to find the image. In your Finder or File Explorer, head to assets img >  photos to find the image file yourself.

To change the background image, have a replacement JPG ready with the exact dimensions of the original file. Give your photo a simple name and place it in the photos folder. Now change the name in the src attribute, and save.

If you don't have a replacement photo ready but want to change the background, head to Envato Elements. You can find a stock photo or cool graphic to use. I'll be using one of these stock background photos.

where to start coding a website tutorial background image change

Changing the avatar is the same process. Drop your headshot in the avatar folder within the img folder. Replace avatar01 in line 104 with the name of your photo. Save the HTML code for this web design project in Sublime Text and refresh your browser to see how it looks now.

where to start coding a website tutorial avatar change

Change Name and Bio

Editing your name and bio takes a few simple steps. Find the H1 tag in line 107, and add in your name. In the line below, type in your job title.

Lines 112 through 129 are where you can briefly add more professional information. As you can see in your browser, the default fields are SpecialtyBorn DatePrevious CompanyYears Experience, and Current Company. If you want to share this information, edit the dd in lines 113, 115, 121, 123, and 129. If you'd like to change this entire section, you'll need to change the dt tag in lines 112, 114, 120, 122, and 128 too.

Made your changes? Save the HTML file, refresh the page, and see your changes.

where to start coding a website tutorial

Notice that you can have visitors download your CV or resume from a button. To set this up, we'll first create a folder titled cv within the assets folder. Then, we'll put our CV in this new folder.

Now let's look at the HTML. More specifically, line 134 of the sample code for website design:  

We are going to replace the # in the href attribute with assets/cv/name-of-cv-file.extension. To make the CV downloadable, add the download attribute after the href attribute. Line 134 should now look like this: 

Save the HTML code for this web design project and test it out in your browser. Note that for now you'll only be able to open the file from the button. But once your website goes live, visitors will be able to download your resume.

3. Services Section

Let's add in what services we offer. If you changed the name of this section, or any other sections, in Step 1, you can still follow along with the rest of the tutorial. Just make sure to change the h6 tag in each step.

Change the name of the first service in line 155 with the h5 tag. This can be any service you offer. In the following line, give a brief description of your service in the p tag. Save the file and see the changes in your browser.

web designing in html code project tutorial services section

Looks like we might run into a problem. If you changed the name of the service, the mobile app icon no longer matches up. That's not a problem. Okno uses Themify Icons. These are free to use web icons for personal and commercial use.

 Search for a matching icon from the Themify link above. Add in the name of the icon's attribute in the i tag. For this example, I will use the ti-shortcode icon. Let's see how that looks like now:

web designing in html code project tutorial icon change

That's better. Repeat this process for the rest of your services in lines 162, 169, 178, and 185 of the sample code for website design.

web designing in html code project tutorial icon changes

4. Add Skills

This is a well-designed section in this simple website design for beginners. As you can see in your browser, the skills section has a meter to show your proficiency. This can be edited in the web design code under the Skills comment.

In line 209, change the skill that you want visitors to see. It's found in the strong tag.

How good are you at performing this skill? To show this off on your site, we need to backtrack to line 207. Within the div tag, we are going to edit the aria-valuenow attribute, as well as the style attribute. These values will use the same number to represent your skill level out of 100. If you'd like to put 97 out of 100, make that change in both attributes. Your changes should match the code below.

Save and refresh your browser window to see your new skills! You can repeat this step to finish the rest of your skills section.

html code for website design project tutorial skills section progress bar

5. Education And Job Experience

This is the section in our web design code that lets us add education and job experience.

Let's start with lines 255 through 257. The first line lets us edit the date, the following line is for the title of your education or work experience, and the final line is for location. So if I want to share my three-month rocket science course at NASA, I'd edit the code to look like this: 

You can repeat these steps for the other two entries found in lines 262-264 and lines 272-274.

html made easy web design for beginners tutorial experience section

6. Testimonials

If you're following these steps to code a website as a freelancer, then you know how important this section is. Testimonials from past customers, clients, and bosses go a long way towards someone trusting you with their next project.

This testimonial section starts with the comment in line 294. These quotes have special formatting that we're going to leave as they are. All we're going to do is edit the text found in the div tag. If you have an exact quote you want to use, add it here. Use the strong tag to make parts of the testimonial stand out with bold text.

If you have a headshot of the person giving the testimonial, add it in line 298. If not, feel free to remove that line of code. The following two lines of code let you finish the testimonial with the person's name and job title.

Repeat these steps to finish this section.

html made easy web design for beginners tutorial testimonial section

7. Media

Do you have photos of your work that you'd like to share? You can have them ready in this step.

Before we get started, it's important to note getting the exact dimensions of your photos is important for this section. Each photo must be exactly 640x563. Use Adobe Photoshop to resize your images. If you don't have the program, you can use a free online website like Pixlr.

Once you have your pictures ready, let's see how we can add them to our website. In line 337, we can change our photo with a familiar line of code. If we read this line, we can see that we need to have our photos within the works folder, which is found in the img folder. We'll also need to change the file name so our website knows what photo to use. 

Let's make these changes and save. Refresh your browser to see your photo.

html made easy web design for beginners tutorial works section

You may notice that hovering over your photo shows a special effect. It looks like we can leave a brief description of the project shown in the picture. Let's take full advantage of this HTML web page template and add a brief description.

Backtrack to lines 333 and 334 of the sample code for website design. In the first line, let's leave the name of this project. In the second line, let's add what related service was needed to finish the project. 

If this work is available to see online, we can link to it. In line 332, replace the # in the href attribute with the link to the webpage featuring your project. Try linking to Google to see how this works.

This section lets you share up to six projects. Follow the steps above for each piece of your work you'd like to share.

html made easy web design for beginners tutorial works section hover

8. Contact Section

Now is the time to set up the contact information in the HTML code for this web design project. This is an easy step to get done. 

We start by adding your headshot in line 425. This follows the same process talked about in the second step of this web design code tutorial. 

Within the address tag starting on line 426, we'll add our address, phone number, and email address. Feel free to change the type of contact information you share by editing what's within the strong tags.

The contact form doesn't need many changes. If you'd like to add a fun spin to the default text, just change the placeholder attributes found on lines 440, 443, and 447. Changing the text of the button can be done on line 451.

But will our contact form work? Not yet! We need to make a very quick edit to our PHP file. In your Finder or File Explorer, go to assets > php within the Okno folder. Then open the file contact-form.php in Sublime Text.

In line 9 of this file, you'll see the following code:

 Replace the example email with your own email address, and save the file. Now when a visitor completes the contact form, you will get an email with what they said.

sample code for website design tutorial contact form move me

9. Edit Footer

This is the last of our steps to code a website. The footer of this one-page website features a copyright credit to the creators of the Okno web template and three links. You can remove the footer entirely, remove some elements, or edit the links. If you want to edit the links, I'll walk you through how to do that.

html made easy web design for beginners tutorial footer

On line 476 of the sample code for website design, you'll find the following code:

Within the href attribute, replace the # symbol with a link to a website you want to share. This change will let visitors go to that website by clicking on Sign Up. You can change this text to anything you'd like. Repeat this process for lines 477 and 478.

We're Done!

Congrats, you successfully followed the steps to code a website with a web template! This process saves you a lot of time if you're creating a site for yourself or a client. And as you can see, it's one of the easier ways to build a website. 

Find Awesome HTML Web Page Templates From Envato Elements

If you liked the web template we used in this tutorial, you can find even more variety on Envato Elements. There are a ton of modern choices for you, and you'll be able to edit them just as easily as Okno. Here are just a few options you could try that are found on Envato Elements.

1. AppStorm—App Startup Template

AppStorm App Startup Web Design Template

Here's the perfect HTML web page template for a tech startup. AppStorm is designed with promoting software in mind. The layout is incredibly modern and functional, as well as being made for mobile. Choose from three different home page designs and customization options for the perfect look. AppStorm is the easiest way to code a website for your new app or SaaS product.

2. Jadusona—eCommerce Baby Shop Bootstrap4 Template

Jadusona - eCommerce Baby Shop Bootstrap4 Web Design Template

Jadusona is a minimal, easy to use e-commerce website. You'll have a variety of page demos to use to show off your baby and child products. Get your online baby shop ready thanks to Jadusona's features, like:

  • fully-responsive design
  • clean code
  • included Google Fonts
  • Ajax contact form

Try Jadusona if you've been looking for web design examples for beginners to start your website.

3. Erika—Portfolio, CV And Resume HTML Template

Erika HTML Web Design Template

Complement your physical CV or resume with Erika. This online landing page is the perfect place to tell visitors everything about you and your skills. Show off your services, portfolio, and more with Erika. It's Retina-ready, cross-browser compatible, and responsive so visitors can browse from any device. Basically, Erika is everything you'll need from a personal web template download.

4. Modaz | Minimalist eCommerce HTML Template

Modaz Minimalist eCommerce HTML Web Page Template

If you're starting an e-commerce site, you'll want to let your products be the star of the show. With the Modaz e-commerce HTML template that's possible. The minimal design directs attention towards your product photos and item pages. Choose from 11 home page variations and customize the inner pages to complete your website. The clean code makes Modaz one of the easiest ways to code a website. 

5. Emily—Personal Blog HTML Template

Emily Personal Blog HTML Web Page Template

Give your content the aesthetic platform it deserves with Emily. This personal blog HTML web page template comes with over 14 HTML pages for you to build your site. Its design is full-responsive and cross-browser compatible, so visitors can enjoy your blog on any device. If you're starting a blog as a web designing in HTML code project, try out Emily.

Find Even More HTML Web Page Templates

Who doesn't like having options? The web design templates featured above are some of the best web design examples for beginners you can find online today. If you want to look at premium options with clean code, check out these articles from the Envato Tuts+ team.

Learn More About Code With Envato Tuts+

Whether you're a beginner or are experienced with code, there's always something new to learn. If you'd like to find video tutorials and guides to help you along, check out the Envato Tuts+ YouTube channel. There are hundreds of video tutorials available, including for code. Just check out our code video guide playlist. Here's a look at what you can find: 

There are also written tutorial guides and courses available on the Envato Tuts+ website. Below are a few you can get started with.

Keep Exploring the World of Code!

Today you learned how to begin coding a website with a web template and looked at some excellent template options. Web design templates are perfect if you want HTML made easy, or quick web design for beginners and experts.

Remember, you can find even more useful web design templates from Envato Elements with your subscription. There are even more HTML web page templates from ThemeForest, which you can purchase without a membership.

If you're interested in designing more web pages, you can find more tutorials on our site and YouTube channel. Did you find this guide helpful? Let us know in the comments!

Viewing all 5160 articles
Browse latest View live