Make ‘Em Shine: How To Use Illustrations To Elicit Emotions




 


 

As designers, we often use imagery that resonates with our audience. Yet, often we also end up with stock photos and generic icons that come across as mere decoration. Or we bypass imagery altogether. But custom images are a powerful design tool. They can tell a story and convey a distinct personality.

The Power Emotional Design: Including Illustrations Into Your Projects

Custom illustrations can be especially impactful. They can make our audience feel personally connected to an app or website, while being an integral part of the design.

The post Make ‘Em Shine: How To Use Illustrations To Elicit Emotions appeared first on Smashing Magazine.


Source: Smashing Magazine

Dynamic Page Templates in WordPress, Part 1

WordPress page templates are a great way to completely alter how particular web pages are displayed. You can use them to add a vast range of functionality to your site.

They do, however, have one limitation in that they are ‘static’ templates. You cannot customize them or affect their behavior in any way. You can only choose whether to enable a page template or not. By default, a page template will simply carry out a fixed function, e.g. display a sitemap, or remove the sidebar to display a full-width page.

In this tutorial series, I’ll be looking at how you can extend page templates to be more flexible, improving their functionality greatly. I’ll start by introducing how to create a standard page template via a child theme, before moving on to a more flexible approach where I’ll create a general-purpose dynamic page template.

Finally, I’ll show you three real-world examples of fully working dynamic page templates. I’ll also cover advanced topics such as how to assign page templates to custom post types.

Want to Follow Along?

To follow along with this tutorial series, you’ll need a WordPress site with admin access. By far the easiest way to do this is to use a local development environment. A dedicated text editor is also useful but not essential.

If you happen to be developing with WordPress via a remote server then you’ll need to be able to edit theme files via the WordPress admin, or edit files locally and use FTP software to transfer them back to the server. For the sake of simplicity, I’ll assume that you’re working with WordPress locally throughout the rest of this tutorial.

To implement our page templates, I’ll be using a child theme based on the Twenty Seventeen parent theme, which (at the time of writing) is the latest default WordPress theme. So if you are following along then it’s a good idea to have this installed before moving on.

The default Twenty Seventeen Theme

You can use a child theme based on another parent theme if you prefer, but you’ll need to modify some of the code to make it work seamlessly with your particular theme. The basic method, though, is pretty much the same for any child theme.

WordPress Page Templates

Before learning how to make page templates more flexible, let’s go over some basic details.

WordPress uses a template hierarchy to decide which template renders the current page. The template used in most scenarios for pages is page.php but can be different if you’re viewing a page with a particular ID or slug. However, if you select a page template for a particular page, this will always be used in preference, which makes it very easy to customize any page using a page template.

Here are some typical examples of commonly used WordPress page templates:

  • Contact Form
  • Portfolios
  • Frequently Asked Questions
  • Custom 404 Page
  • Custom Login Page
  • Sitemap
  • Full Width Page
  • Blog Posts Page
  • Widgetized Page
  • And many more…

I could go on, but you get the idea. Page templates are cool! You can use them for almost anything.

If you’ve used WordPress for any length of time then it’s highly likely you’ve already come across one or more of the examples above. Most themes include page templates to complement theme functionality, and you can easily add your own via a child theme. I’ll be covering how to do this shortly.

Page templates are so useful because they give you complete control over the whole page. You can leave out the header, footer, and/or sidebars if you wish. This is one of the reasons why full-width page templates are so common because it’s very easy to manipulate the sidebars via a page template.

To see all currently available page templates, go to the WordPress page editor and access the Template drop down via the Page Templates meta box. Simply select the page template you want and, once the page has been updated, it will be visible the next time the page is viewed.

Adding Page Templates via a Child Theme

As mentioned above, we’ll be using a custom WordPress child theme to implement all page templates throughout this tutorial. I’ll start off with a basic child theme and page template, and then add more complexity to it as we go along.

The whole process will be covered step by step, so don’t worry if you’re not familiar with child themes and/or page templates. You will be by the end of the tutorial!

The basic idea behind child themes is that they allow you to customize the look and feel of your current theme (called a parent theme) in a way that won’t be affected when the parent theme is updated.

If code is added directly to the parent theme then all customizations will be overwritten and lost during a scheduled theme update. This is an important point as any well-maintained theme will be regularly updated. To find out more about child themes, I’d recommend taking a look at the official documentation

It’s interesting to note that it’s technically possible to use a WordPress plugin to add page templates, but it’s much simpler to use a child theme. I don’t want to complicate things unnecessarily with extraneous code, so I’ll be sticking with child themes for our page template implementation.

Let’s Get Started!

Ok, so enough theory—let’s create our initial page template! It will be located in a custom Twenty Seventeen child theme which will act as our page template container, so we need to create the child theme first.

Open up your theme folder and create a new folder for your child theme. According to WordPress best practices, it’s recommended that you name the child theme folder the same as the parent theme it’s based on, amended with ‘-child’. As our parent theme folder is named twentyseventeen, name your child theme folder twentyseventeen-child. Inside this new folder, create a single file named style.css and add the following comment block at the top.

We now need to reference all the styles from the Twenty Seventeen parent theme. If you’ve ever worked with child themes before, then you might be used to adding a CSS @import statement directly underneath the comment block. This is no longer considered a WordPress best practice due to speed concerns. Instead, we’ll enqueue the parent theme styles, which will be more efficient.

Inside the child theme root folder, create a functions.php file and add the following code to set up an empty class container. We’ll use this class for all our setup code.

Note: The closing PHP statement is not necessary, but you can add it if you prefer.

Now add a hook and callback to enqueue the Twenty Seventeen parent theme styles, rather than importing them directly inside the style.css file. Do this by adding two new class methods.

Save your changes and activate the child theme. You now have a fully functioning, albeit simple, Twenty Seventeen child theme. To test whether it’s working properly, add a line of custom CSS to style.css.

If all is well then you should see all your site text now colored a nice garish red!

Updated styles as per the child theme

Don’t forget to delete the test CSS before moving on. Now that the child theme is active, we can begin to implement our first page template.

Adding Our First Page Template

One thing is worth mentioning about where you store page templates inside your child theme. You can store the page templates either directly inside the root child theme folder or in a top-level folder. It doesn’t matter which one you choose; either location is fine.

However, if you have multiple page templates, you may decide to store them in a folder for organizational purposes. The folder name is unimportant, but it must be located directly inside the root child theme folder, otherwise WordPress won’t recognize your page templates. For this tutorial, I’ll be using a folder called page-templates.

Let’s now add a new page template to the child theme. The standard way to do this is to make a copy of the parent theme page.php theme template file and add it to your child theme. You can name the file anything you like, but I’d recommend including something that makes it recognizable as a page template. I’ll go with test-page-template.php.

Once you’ve copied the page.php file (and renamed it) to the page-templates folder, your child theme structure should now look like this:

Adding the first page template

Open up test-page-template.php and replace the comment block at the top of the file with the following.

This step is very important as the comment block tells WordPress to recognize the file as a page template and will add it to the list of available page templates on the page editor screen.

The full page template code should now look like this.

Let’s test our page template. Go to the WordPress admin and edit any existing page, or create a new one. On the page editor screen, select the Template drop-down from the Page Attributes meta box to assign our page template to the current page.

The Page Attributes

Because we simply copied the parent theme page.php template file, our custom page template is doing nothing more than outputting the current page, which is not very useful. Also, we won’t be needing to output the editor content or comments, so remove these from the page template while loop, and add a custom message. Change the contents of the while loop to the following.

Save this and view the page on the front end.

Viewing the page template on the front-end

Note: If you can’t see the custom message then make sure you have selected the custom page template on the page editor and saved it to update settings.

Let’s now make our custom page template a little more useful. Replace the message we added above with the following code to output a sitemap of all published pages.

This will result in the following output.

Viewing the sitemap

It’s easy to see just how useful page templates can be. But we can do even better!

Conclusion

So far, we’ve created a child theme and used it to implement our standard page template. In the next tutorial, I’ll show you step by step how to extend this, demonstrating how page templates can be made more flexible.

Specifically, we’ll create a general-purpose dynamic page template by adding custom controls to the page editor screen. Control logic will then be added to the page template to allow us to directly customize how the page template is rendered.

WordPress has an incredibly active economy. There are themes, plugins, libraries, and many other products that help you build out your site and project. The open source nature of the platform also makes it a great option from which you can better your programming skills. Whatever the case, you can see what we have available in the Envato Marketplace.

This is my first tutorial (be gentle!) so please feel free to leave any feedback you may have in the comments feed below. I’ll do my best to answer every question.


Source: Nettuts Web Development

How Korske Ara of World Photo Day Uses WordPress

World Photo Day comes around once a year on August 19, and celebrates our passion for photography. Originally founded way back in 1837, photographer Korske Ara revived the event in 2009, and it’s been going strong ever since.

“Photography is a powerful method of communication that we can use to uplift, inspire and initiate change in our world. A picture is worth a thousand words and those words can be in any of the 6,500 languages on planet earth”. Korske Ara—Founder, World Photo Day

The public face of World Photo Day is a WordPress site. We recently caught up with Korske and chatted about his goals for the event, how his WordPress theme and plugins help achieve those goals, and about his choice of hosting plan.

Hi Korske. Tell us about your website, including the role it plays in your business.

Our main website, worldphotoday.com is all about sharing great photos from around the world, captured by ordinary people. We also use it to provide information to our participants about how they can get involved in World Photo Day, to celebrate their passion for photography.

What would you like to achieve with it?

The primary goal of our website is to promote a global gallery and competition where participants can share their world with the world.

Our goal is to inspire photographers around the world to reflect on photography and the ability we have to capture and share powerful stories and moments.

Why did you choose WordPress as your platform?

We chose WordPress as our platform because of its ease of setup and extensibility through a variety of plugins.

Which theme and plugins are you using?

The World Photo Day website uses one of the most popular premium WordPress themes on the market, Avada, which is available at Themeforest. We chose Avada for its customisability and built in style support of many popular plugins.

The World Photo Day website runs with both free and paid plugins. Free plugins include: Yoast SEO, Akismet and WooCommerce. Our premium (paid) plugins including Gravity Forms, WPML and The Event Calendar PRO.

Continue reading %How Korske Ara of World Photo Day Uses WordPress%


Source: Sitepoint

How to Make a Simple JavaScript Quiz

“How do I make a JavaScript quiz?” — this is one of the most common questions I hear from people who are learning web development, and for good reason. Quizzes are fun! They are a great way of learning about new subjects and allow you to engage your audience in a fun, yet playful manner.

How to Make a JavaScript Quiz

And coding your own JavaScript quiz is a fantastic learning exercise. It teaches you how to deal with events, handle user input, manipulate the DOM, provide the user with feedback and keep track of their score (for example, using client-side storage). And when you have your basic quiz, there are a whole host of possibilities to add more advanced functionality, such as pagination. I go into this at the end of the article.

In this tutorial I will walk you though creating a multi-step JavaScript quiz which you will be able to adapt to your needs and add to your own site. If you’d like to see what we’ll be ending up with, you can skip ahead and see the working quiz.

Things to be Aware of Before Starting

A few things to know before starting:

  • This tutorial is entirely on the front end, meaning that the data is in the browser and someone who knows how to look through the code can find the answers. For serious quizzes, the data needs to be handled through the back end, which is beyond the scope of this tutorial.
  • The code in this article uses ES2015 syntax, meaning the code will not be compatible with any versions of Internet Explorer. However it does work for modern browsers, including Microsoft Edge.
  • If you need to support older browsers, I’ve written a JavaScript quiz tutorial that’s compatible back to IE8. Or, if you’d like a refresher on ES2015, check out this course by Darin Haener over on SitePoint Premium.
  • You’ll need some familiarity with HTML, CSS, and JavaScript, but each line of code will be explained individually.

The Basic Structure of Your JavaScript Quiz

Ideally, we want to be able to list our quiz’s questions and answers in our JavaScript code and have our script automatically generate the quiz. That way, we won’t need to write a bunch of repetitive markup, and we can add and remove questions easily.

To set up the structure of our JavaScript quiz, we’ll need to start with the following HTML:

  • A <div> to hold the quiz
  • A <button> to submit the quiz
  • A <div> to display the results

Here’s how that would look:

<div id="quiz"></div>
<button id="submit">Submit Quiz</button>
<div id="results"></div>

Then we can select these HTML tags and store references to these elements in variables like so.:

const quizContainer = document.getElementById('quiz');
const resultsContainer = document.getElementById('results');
const submitButton = document.getElementById('submit');

Next we’ll need a way to build a quiz, show results, and put it all together. We can start by laying out our functions, and we’ll fill them in as we go:

function buildQuiz(){}

function showResults(){}

// display quiz right away
buildQuiz();

// on submit, show results
submitButton.addEventListener('click', showResults);

Here, we have functions to build the quiz and show the results. We’ll run our buildQuiz function immediately, and we’ll have our showResults function run when the user clicks the submit button.

Displaying the Quiz Questions

The next thing our quiz needs are some questions to display. We’ll use object literals to represent the individual questions and an array to hold all of the questions that make up our quiz. Using an array will make the questions easy to iterate over.

const myQuestions = [
  {
    question: "Who is the strongest?",
    answers: {
      a: "Superman",
      b: "The Terminator",
      c: "Waluigi, obviously"
    },
    correctAnswer: "c"
  },
  {
    question: "What is the best site ever created?",
    answers: {
      a: "SitePoint",
      b: "Simple Steps Code",
      c: "Trick question; they're both the best"
    },
    correctAnswer: "c"
  },
  {
    question: "Where is Waldo really?",
    answers: {
      a: "Antarctica",
      b: "Exploring the Pacific Ocean",
      c: "Sitting in a tree",
      d: "Minding his own business, so stop asking"
    },
    correctAnswer: "d"
  }
];

Feel free to put in as many questions or answers as you want.

Now that we have our list of questions, we can show them on the page. We’ll go through the following JavaScript line by line to see how it works:

function buildQuiz(){
  // we'll need a place to store the HTML output
  const output = [];

  // for each question...
  myQuestions.forEach(
    (currentQuestion, questionNumber) => {

      // we'll want to store the list of answer choices
      const answers = [];

      // and for each available answer...
      for(letter in currentQuestion.answers){

        // ...add an HTML radio button
        answers.push(
          `<label>
            <input type="radio" name="question${questionNumber}" value="${letter}">
            ${letter} :
            ${currentQuestion.answers[letter]}
          </label>`
        );
      }

      // add this question and its answers to the output
      output.push(
        `<div class="question"> ${currentQuestion.question} </div>
        <div class="answers"> ${answers.join('')} </div>`
      );
    }
  );

  // finally combine our output list into one string of HTML and put it on the page
  quizContainer.innerHTML = output.join('');
}

First, we create an output variable to contain all the HTML output including questions and answer choices.

Next, we can start building the HTML for each question. We’ll need to loop through each question like so:

myQuestions.forEach( (currentQuestion, questionNumber) => {
  // here goes the code we want to run for each question
});

Continue reading %How to Make a Simple JavaScript Quiz%


Source: Sitepoint

How to Use Laravel Mix in Non-Laravel Projects

If you, like me, just want to get up and running on a project as quickly as possible, you probably don’t want to spend time configuring build tools like Webpack. Laravel Mix solves this problem, and makes asset compiling incredibly easy, but what if you want to use it on a non-Laravel project? This article shows you how to accomplish that.

Potion vector illustration

What Is Laravel Mix?

Laravel Mix, formerly Elixir, could be defined as an API wrapper for Webpack. It has a fluent syntax and is generally easy to use. Setting up versioning, hot reloading, and asset building/compiling is a breeze, and requires only a single configuration file and a few lines of code.

Backstory

For most of my projects, be it clients or personal, I choose Laravel, but I recently had a client who wanted the ability to edit pages and content on their website, he wanted a CMS. I decided to give OctoberCMS a try, considering that it’s based on Laravel.

I set up File Watchers from PhpStorm, but it didn’t work as well as running Laravel Mix. After a week of using File Watchers, I tried pulling Laravel Mix from a Laravel project, and the result feels exactly like it should.

Requirements

For this tutorial, I assume that you have basic knowledge of managing JSON files and that you have NPM and Node installed on your system.

If you want to use versioning and hot reload, you’re required to use PHP, and Composer.

To verify that you have NPM and Node, you can run the following in your terminal:

node -v
npm -v

You should see versions for both Node and NPM.

Note: You can also use Homestead Improved which comes with all of this installed. If that’s confusing to you, clear things up with our book!

Continue reading %How to Use Laravel Mix in Non-Laravel Projects%


Source: Sitepoint

Inspirational UI Design Ideas for Your Next Website Project

Seven Creative UI Design Ideas You Can Use In Your Next Website

This article was peer reviewed by Dave Maxwell and Panayiotis Velisarakos. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be!

The web has moved a long way from its traditional roots. Where once it was perfectly fine to provide a basic text-only website, now it’s practically expected that your sites convey not only information, but provide a modern, crisp and exciting user experience.

To that end, it’s up to you as the designer or developer to create something that’s visually interesting. This could be something as small as an awesome set of font pairings, or as complex as full-on animations and deep interactions.

Today we’re going to look at a few sites that masterfully use micro-interactions, hover state animations, CSS gradients and transforms to create visual interest and guide users’ actions. The whole point is to create something that users enjoy, either directly through interaction or through subtle effects users might not even notice, which nevertheless contribute to create positive connections with the site.

Stripe

Stripe is a US-based payment processing system for credit cards. It’s a developer-focused solution and this comes across both in their system and their website. Their site is colorful, interactive and generally pretty awesome to use. Let’s see which elements we can pick out and leverage in our designs.

Gradient Backgrounds & CSS Transforms

Stripe website banner

The Stripe website showcases a primary header section with a creative use of layout and design. The header changes colors on a page by page basis and is used as their main call to action element.

At its most basic level, it’s a collection of containers that have been positioned to create a semi mosaic grid. These fragments have each their own linear gradient that blends or contrasts with other parts of the header.

What makes the header look even more visually interesting is the fact that it’s been slanted. To get this type of effect, all you need to do is apply a skew(xdeg) transformation on the top element. Doing so instantly skews the inner elements.

The subtle skew, along with simple yet interesting images and colors, are all you need to bring about this inventive design. Getting a good mixture of low and high contrast sections here is important. If these sections were flat colors the effect wouldn’t look so great. Instead, the gradient flowing from one section to another makes this look visually striking.

If you like the idea, you could incorporate a layout like this in your header, or even use it as a background in a call to action or feature block. Try experimenting with mixtures of colors, positions and transforms and create something that looks interesting and makes you stand out.

Here’s a CodePen demo to get you started right away.

Stripe custom header made with CSS gradients

At its most basic level, this example is a collection of divs that have been colored with gradients and then positioned to produce the effect. Choosing the right combination of colors, heights and positions is what makes this effect striking.

Creating Interactive, Interesting Menus

Continue reading %Inspirational UI Design Ideas for Your Next Website Project%


Source: Sitepoint

How to Authenticate your Android Users Using Phone or Email

In this tutorial I will show how to use Facebook’s Account Kit Tool to allow users to log in or sign up using their phone number or email. You can find the completed project on Github.

After creating your project, please make sure that you add your Application to the Facebook’s Developers console and obtain your APP ID.

Once your Android Studio project has been set up, go to your Project/build.gradle and add mavenCentral() inside the repositories{ }

Also open your app/build.gradle file and add the Account Kit dependency:

compile ‘com.facebook.android:account-kit-sdk:4.20.0’

Continue reading %How to Authenticate your Android Users Using Phone or Email%


Source: Sitepoint

New Podcast: #Ep1 – Designing for Scale: Inside Atlassian’s Design Teams

SitePoint is teaming up with the True North Podcast for the launch of their fantastic second series. In this first episode, Ben Newton talks to Atlassian Design Team about how design – and the teams behind it – can successfully scale.

If you’re like me, when you think of a company like Google, Facebook or Uber you generally don’t think of the people within it. Maybe you think of their famous founders and project their personality traits onto an imagined company persona.

But for the most part it’s the brand that we visualize.

What is the Atlassian story?

If you don’t know the company name, you probably know their products. Their BitBucket product is Github’s biggest direct competitor. Their Jira Software Management System is a project management tool for agile teams used by the likes of eBay, Airbnb, and Spotify.

Their product line also includes Confluence and HipChat which aim to streamline sharing and collaboration within teams. There’s a lot going on.

With ten major products, millions of users and a 2015 IPO valuing the company at over $US4 billion, Atlassian has continually been challenged to evolve and adapt in the face of its unavoidable growth.

The userbase grows, teams grow, revenue rockets up, but everything needs to scale to keep up with demand and to continue serving customers at a high level. It’s a good problem to have.

Question: How Do You Scale From 6 Designers to 120 in 4 years?

 Georgie Bottomley

Georgie Bottomley – Senior UX Research

There is no better example of Atlassian’s rapid growth than the 4 year period from 2012 to 2016, when their design team grew from 6 designers to over 120. It goes without saying that what works for 6 designers probably doesn’t easily scale well for 120 designers. Adding another designer is more complicated than adding another web server.

The design leads at Atlassian were faced with several challenges. The first of which was how to best integrate the designers into their existing eco-system, this in isolation is a significant task. But adding to that was the logistical challenge of having teams dispersed over three locations – Sydney, San Francisco and Austin –  and three different times zones.

Continue reading %New Podcast: #Ep1 – Designing for Scale: Inside Atlassian’s Design Teams%


Source: Sitepoint

Building Killer Robots: Game Behavior In iOS With Fuzzy Logic Rule Systems




 


 

Imagine that it’s a hot day. The sun is out, and the temperature is rising. Perhaps, every now and then, there’s a cool breeze. A good song is playing on the radio. At some point, you get up to get a glass of water, but the exact reason why you did that at that particular time isn’t easy to explain. It was “too hot” and you were “somewhat thirsty,” but also maybe “a little bored.” Each of these qualities isn’t either/or, but instead fall on a spectrum of values.

Building Killer Robots: Game Behavior In iOS With Fuzzy Logic Rule Systems

In contrast, our software is usually built on Boolean values. We set isHot to true and if isHot && isThirsty && isBored, then we call getWater(). If we use code like this to control our game characters, then they will appear jerky and less natural. In this article, we’ll learn how to add intelligent behavior to the non-player characters of a game using an alternative to conventional Boolean logic.

The post Building Killer Robots: Game Behavior In iOS With Fuzzy Logic Rule Systems appeared first on Smashing Magazine.


Source: Smashing Magazine

Python for Java People

Table of Contents Syntax Dynamic typing The dynamic typing philosophy A hybrid paradigm Sequences Functions Objects and the dynamic runtime Objects Classes Wrapping up Comments Philosophically, Python is almost a polar opposite to Java. It forgoes static types and rigid structure in favor of a loose sandbox, within which you’re free to do basically whatever […]

Continue reading %Python for Java People%


Source: Sitepoint