All posts tagged “Custom”

Tokyo Camera Style: A photo book of rare, custom and beautiful cameras found on the most stylish streets of Japan’s capital

Tokyo Camera Style

Though smartphones might take the bulk of our daily point-and-shoot photography, street shooting with film is alive and well—especially in Tokyo. Throughout the ’90s and early aughts, Japanese camera-makers from Contax to Nikon produced a range of……

Continue Reading…


Cool Hunting

Create a custom celtic tattoo in Photoshop

Read more about Create a custom celtic tattoo in Photoshop at CreativeBloq.com


01. Pick your inspiration Designing a tattoo always begins with a premise, so the first thing I do is sift through some Celtic mythology to get my mind going. I consider designs based on The Morrigan and Cú Chulainn, but it’s the Four Treasures of the Tuatha Dé Danann that seems most fit for body art.




Creative Bloq

Understanding WordPress Custom Meta Box

In the previous post, we have talked about the WordPress custom field, which allows you to add and output a new entry in a post using the Custom Field box that WordPress provides in the post editing screen. If however you are not comfortable using the custom field box (we all have our individual preferences), here’s an alternative: you can create a meta box.

A meta box is a customized box that we create on our own, which may contain input or other interactive UI to add new entries of posts or pages. You can use the meta box instead of the Custom Field box to do the same thing. Let’s see how to create one.

More on Hongkiat.com:

Creating a Meta Box

WordPress providse an API function, called add_meta_box, which lets us create a meta box straight away. This is it in its utmost basic form.

 function add_post_reference() { add_meta_box('post-reference', 'Reference', 'referenceCallBack', 'post'); } add_action('add_meta_boxes', 'add_post_reference'); function referenceCallBack() { echo 'Hello World' } 

The add_meta_box takes four parameters: the ID, the meta box title, a callback function that will call out ‘Hello World’, and the post type we want to display. In this case we assign a new meta box in a post editing page (this also works with pages).

In the post editing section, you will find a new box, as follows.

WordPress basic meta box

The new meta box, as you can see above, would appear below the WYSIWYG editor. If you want to add it in the sidebar you can add ‘side’ after the post parameter, and along with ‘high’ if you want to put it at the very top of the sidebar.

 function add_post_reference() { add_meta_box('post-reference', 'Reference', 'referenceCallBack', 'post', 'side', 'high'); } add_action('add_meta_boxes', 'add_post_reference'); 

You will now find it above the Publish box..

WordPress meta box position

Now to replace the ‘Hello World’ text in there. Let’s add elements like an input field for a new entry.

In this example, we will add two input fields that consist of one for adding the Reference Name and another for Reference Link:

 function referenceCallBack($  post) { wp_nonce_field( 'reference_meta_box', 'reference_nonce' ); $  name_value = get_post_meta( $  post->ID, '_post_reference_name', true ); $  link_value = get_post_meta( $  post->ID, '_post_reference_link', true ); echo '<label for="reference-name">'. 'Reference Name' .'</label>'; echo '<input type="text" id="reference-name" name="post_reference_name" placeholder="Example" value="'.$  name_value.'" size="25"/>'; echo '<p class="howto">'. 'Add the name of the reference' .'</p>'; echo '<label for="reference-link">'. 'Reference Link' .'</label>'; echo '<input type="text" id="reference-link" name="post_reference_link" placeholder="http://www.example.com/" value="'.$  link_value.'" size="25"/>'; echo '<p class="howto">'. 'Add the link of the reference' .'</p>'; } 

Refresh the post editing page, and you should see these two inputs added.

 

The $ name_value and $ link_value variable will retrieve the entries from the database and populate them into the input fields. To get the entries into the database, we will need to create a function for that.

We need to add a few lines of code that will populate the entries added through these input into the database safely. “Safely” here means a legitimate and authorized entry (not the one coming from hackers or other unauthorized personnel). To save the entry, we will have to create a new function. Let’s name the function: save_post_reference, like so.

 function save_post_reference( $  post_id ) { } add_action( 'save_post', 'save_post_reference' ); 

As we have mentioned, we need to verify a few things for security purposes:

(1) We will need to check whether the user has the ability to edit a post.

 if ( ! current_user_can( 'edit_post', $  post_id ) ) { return; } 

(2) We also need to check if the Nonce is set.

 if ( ! isset( $  _POST['reference_nonce'] ) ) { return; } if ( ! wp_verify_nonce( $  _POST['reference_nonce'], 'reference_meta_box' ) ) { return; } 

(3) Then, we need to prevent the data from being auto-saved. Saving can only be done once the “Save” or “Update” button has been clicked.

 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } 

(4) We will also have to ensure that our two inputs, post_reference_name and post_reference_link, are set and ready before we submit the entries.

 if ( ! isset( $  _POST['post_reference_name'] ) || ! isset( $  _POST['post_reference_link'] ) ) { return; } 

(5) And the entry should be free from any unexpected characters that may compromise website security. To check this you can use the WordPress built-in function sanitize_text_field.

 $  reference_name = sanitize_text_field( $  _POST['post_reference_name'] ); $  reference_link = sanitize_text_field( $  _POST['post_reference_link'] ); 

Alright, now we are ready to save the entries into the database:

 update_post_meta( $  post_id, '_post_reference_name', $  reference_name ); update_post_meta( $  post_id, '_post_reference_link', $  reference_link ); 

Now you can try it out: input some content into the input fields, and click the “Update” button to save them.

WordPress meta box final

Conclusion

We have just created a meta box that comprises of two inputs. You can further extend the box with other types of inputs such as the radio button or select box. This example may be very basic but once you get the hang of it, you will be able to use this meta box for much more complicated uses. Let us know if you will be using this and what you will be using it for.





hongkiat.com

Officine Mermaid’s Custom Ducati Scrambler: The Milan-based shop reimagines the already capable bike as a badass off-road machine at home on any terrain

Officine Mermaid's Custom Ducati Scrambler

Though it opened in 2009, we first stumbled upon Officine Mermaid in 2013 while exploring Milan between appointments during Design Week. Located in the Motoquartiere—an intersection of streets lined with motorcycle part shops, vintage clothing stores……

Continue Reading…


Cool Hunting

Custom CSS3 & jQuery Toggle Search Form: Tutorial

Let’s continue out coding lessons today you will learn how to code a CSS3 and jQuery toggle search form.
MonsterPost

How To Get More Custom Voice Commands Out Of Google Now

Google Now, the smart voice assistant from the search giant, allows you to accomplish many tasks using nothing but your voice. You can use voice control on your device with this application, but it’s limited to understanding only a few commands.

The good news is you can use two awesome tools to extend the use of Google Now. This means better control and more functions for you to do custom jobs, all enabled with just your voice. If this tickles your fancy, have a look at how you can set this up.

You will need to either Commandr or AutoVoice (just pick one), but to be able to run either of them, you will need to get Tasker, which is a paid app. However, you can play around with Tasker’s trial version for 7 days first before deciding if you want to get it (for US$ 3.75). With this combo, you can send preset messages to friends and colleagues, post a pre-defined status update to your favorite social network amongst many other things.

Note: This tutorial was built using Commandr 3.1, AutoVoice 2.0.18 and Tasker 4.5u1 on Android 5 (Lollipop). It’s believed the steps given below will also work for other versions of these applications.

1. Setting Up Tasker

Tasker is an application to automate tasks in Android. It is similar to scheduled tasks makers in desktop operating systems. It can be used to create tasks that are automatically executed as per the active profile or situation. For example, if your phone’s battery drops to 15% charge (a low-battery profile is activated), then your device’s screen brightness sets to minimum possible (a task to set brightness to zero is executed).

How To Install Tasker

Here’s how to install Tasker’s trial version:

  1. Go to Tasker’s Download page on your device.
  2. Download the relevant Tasker version, as per your Android version.
  3. Install Tasker according to the instructions on the download page.

After installing Tasker, you need to configure it to be accessible by other apps, ie other apps get permission to run its tasks. Here’s how you configure it:

  1. Open Tasker.
  2. Click Settings button on top-right corner.
  3. Choose "Preferences".
  4. On UI tab, un-check "Beginner Mode".
  5. On Misc tab, check "Allow External Access".
  6. Click the back button, or the cross button beside the ‘settings" button.

How To Create Tasks With Tasker

Tasker is now set to run tasks for other apps, such as Commandr and AutoVoice. Now you need to create some tasks and here’s how to do that:

(1) Open Tasker, click on "+" button under Profiles.

(2) Select "Event".

(3) Select "Plugin".

(4) Select the "Commandr" plugin if you’re creating this task for Commandr. Otherwise, choose the "AutoVoice Recognized" plugin.

(5) Click on the pencil and configure the "Commandr" plugin as per below. Enter the text that you want to use as a voice command, such as "Hello Facebook".

(6) Or configure the "AutoVoice Recognized" plugin as given below:

  • Press OK if the "joaomgcd Apps" box appears.
  • Click on "Command Filter" under the Command section.

(7) Enter the text that you want to use as a voice command, such as "Hello Facebook". Note: The lite version of AutoVoice only allows a voice command of maximum four characters.

(8) Press the tick button.

(9) Press the back button. Tasker now asks you to choose a task for this newly-created profile.

(10) Select "New Task +". Enter task name, such as "Hello Facebook Task".

(11) Press the tick button.

(12) Click on the "+" button.

(13) Select an Action category, such as "App".

(14) Select an action, E.g. "Launch App".

(15) Set the options for that action, such as selecting "Facebook" from the apps.

(16) Press the Back button. The "Task" is now created.

2. Using Commandr Or AutoVoice

Now you can continue with the tutorial and install either Commandr or Autovoice to extend the features of Google Now and use your own custom commands with it. Both can be used to accomplish the task, but which is better? Personaly, I would go with Commandr because it comes with lots of built-in commands such as toggle hardware settings, read messages, etc and it’s free as opposed to AutoVoice’s full version that costs around $ 1.32.

Going With Commandr

Commandr can dramatically extend the power of Google Now. It gives you the ability to toggle hardware switches and control the music with simple voice commands. It adds tons of commands to Google Now, which makes voice-control functionality even more useful.

It plugs into Google’s voice assistant, and lets you better use your device by making voice commands. It uses the "run-as-per-need" mode, and that’s why, it doesn’t slow down your mobile device or decrease your battery’s life like a hungry beast!

Step 1: Setup Commandr

Install Commandr, then go through its short setup process as shown below:

(1) Open Commandr (and swipe left). Click on "Open Settings".

(2) Click on "Commandr for Google Now" (under Services). Switch on and click OK.

You need to do this small step to give it the accessibility access on your phone, so that it can listen to the commands given to Google Now. It will allow you to give the additional voice commands directly to your phone. If you chose "Limited Access" instead of "Open Settings" then you’re required to say "Note to self" before giving any additional commands to your phone.

Step 2: Activate Built-in Voice Commands

Commandr comes with tons of built-in voice commands. These commands are available after installation, and helps you to better voice-control your device, such as toggle hardware switches, read messages, etc. Here is how you activate them:

(1) Open Commandr.

(2) Tap on "Built-In Commands".

(3) Enable/disable built-in voice commands as per your choice.

That’s all! Now you can use these additional voice commands directly in Google Now.

Step 3: Create Custom Voice Commands

Commandr needs Tasker to create custom voice commands for Google Now. First, you should create tasks in Tasker as given above for Commandr. After that, you need to activate those tasks in Commandr so that they become recognizable and can be executed by Google Now.

Here’s how to activate Tasker’s tasks in Commandr:

(1) Open Commandr. Tap on "Tasker Commands".

(2) Enable/disable custom voice commands as per your choice.

That’s all! Now you can use these custom voice commands directly in Google Now.

Going With Autovoice

AutoVoice, just like an add-on, extends the functionality of Google Now. It brings new possibilities to the Google’s voice assistant, and powers it to understand your custom commands. Tasker helps it add your own commands to Google Now.

It works as follows: you create an automated task (whatever you need to do at your voice command) in Tasker, and AutoVoice calls that scheduled task every time you speak those "magic words" to Google Now. It only runs when required and thus hardly affects your device’s performance.

Step 1: Setup AutoVoice

Install AutoVoice from the Google Playstore.

AutoVoice needs to be configured after its installation for proper integration with Google Now. You need to turn on its accessibility setting, so that it can listen to the voice commands spoken to the Google’s voice assistant. Here’s how to setup AutoVoice:

(1) Open AutoVoice.

(2) Click on "Google Now Integration".

(3) Click on "Not Enabled". Click on "AutoVoice Google Now Integration". Switch on and press OK.

Step 2: Create Custom Voice Commands

AutoVoice, as a Tasker’s add-on, have no additional steps to create custom voice commands. You can simply create tasks in Tasker as given above for AutoVoice, and that all tasks can be activated by speaking the correct command for Google’s voice assistant. That’s all. Now you can use your custom voice commands with Google Now.

Conclusion

As you must have noticed: (Commandr OR AutoVoice) AND Tasker AND Google Now make a powerful voice assistant. These apps open doors to a new set of possibilities by letting your voice take control of your android device. They are easy to install and configure and even easier to use when creating custom voice commands.

What are you waiting for? Try one of the apps given in this tutorial, add some new voice commands to speak to your device and let the magic happen!





hongkiat.com

How to Create WordPress Custom Fields Without Plugins

WordPress has made it easy for developers to customize WordPress in so many ways to meet their custom needs, including letting developers assign new meta-data within a post. That way developer can display additional outcomes within their themes or plugins on top of standard data like the post title, post content, and post author.

There are several methods to create custom meta, you can use a plugin or work on top of a framework, or you can do it from scratch. In this post, we’ll look into how to create custom meta from scratch (it isn’t as hard as you’d think) and use it to display a sponsored post message.

Adding a Custom Meta Data

First of all, go to the post editor. Usually you can find regular input fields like the title, the content, the category, and the tag box there. There are a few hidden fields as well, including a Custom Fields Editor, which we can use to add our custom meta.

To display it, click the Screen Options and tick the Custom Fields option.

The Custom Field box should now appear at the bottom of the post content editor. Now, we can add our custom meta-data.

A single meta-data is handled with key name/value pairs. Hence, as you can see below, the Custom Fields box consist of two input fields: name and value.

In this following example, I will specify a new meta-data for the post that I’m currently editing, with hello_world as the key and Hello World as the value.

Click the Add Custom Field to add them in the post. You can later update or delete this meta-data. Also, as you have entered a key name before, WordPress will store and list the name in a dropdown option, so that you can reuse the key without having to type it all over again.

Retrieving the Meta Data

Having the meta-data set, you can now display your theme single.php file, which is the file to display single post content. You can call out the value from hello_world key using the get_post_meta() function. like so.

 <?php $  meta = get_post_meta( get_the_ID(), 'hello_world' ); echo $  meta; ?> <?php the_content(); ?> 

But keep in mind that this meta-data won’t be available in all post, so we will have to run this function within a conditional statement; in other words, we should call this function only when the meta-data is set in the post, otherwise it will return an error.

 <?php $  meta = get_post_meta( get_the_ID(), 'hello_world' ); if( !empty($  meta) ) { echo $  meta[0]; } ?> 

Given the above code snippet, you should see the Hello World! of the key value displayed above the post content.

Show “Sponsored Post” Box

Now let’s use it in a real world example. Assuming we are going to publish a sponsored post, and we want to show a disclaimer in a box above the post content, we can do this by creating the meta-data named is_sponsored_post and then setting the value field to Yes, like so.

We will display the box when the value of is_sponsored_post is set to Yes through the conditional statement, just like in the previous example.

 <?php $  meta = get_post_meta( get_the_ID(), 'is_sponsored_post' ); if( $  meta[0] == 'Yes' ) { ?> <div class="sponsored-post"> <p>Disclosure: This is a sponsored post that contains affiliate links. End of post: I received compensation in exchange for writing this review.</p> </div> <?php } ?> 

And this is what it looks like when the message is displayed.





hongkiat.com

Nat Geo’s Custom Gear Specialist

Nat Geo's Custom Gear Specialist


Tucked away in the basement of National Geographic, Kenji Yamaguchi tinkers fervently as he dreams up gadgets to help the publication capture its famously striking photos. When a near-impossible angle or new photography technique calls for equipment……

Continue Reading…


Cool Hunting

Custom Women’s Shirts by Double R: The Dallas-based brand offers traditionally tailored garments in seven refined designs

Custom Women's Shirts by Double R

In the world of menswear, customization and tailoring are commonplace. Yet, when looking for bespoke women’s wear, it is hard to find a designer that doesn’t fall within the prohibitively expensive category of couture. This is where Double R, a new……

Continue Reading…


Cool Hunting

Uber and Spotify reportedly partnering to bring custom playlists to your next ride

It looks like Uber is taking another step to separate its service from any other car ride. The company will announce a partnership with Spotify on Monday to let passengers stream music of their choosing as they ride in style to their destination, according to two separate reports from The New York Times and TechCrunch. Uber sent out invites to the press on Friday for a conference call to announce a “first of its kind partnership” with a “special partner guest.” The invite includes a music clef, suggesting it relates to the rumored Spotify partnership.

It’s not yet clear what the partnership will mean for passengers, but a leaked screenshot of Uber’s driver app suggests that the music will play through the driver’s smartphone, which…

Continue reading…

The Verge – All Posts