WP Facebook Messenger

FACEBOOK MESSENGER FOR WORDPRESS Fastest way to get connected For any sellers and business owners!

Woocommerce

WOOCOMPOSER Page Builder for WooCommerce WooCommerce Page Builder is The Quickest Way to Create from Product Detail Page to Thank-You Page and Everything in Between.

Facebook Live Chat For Wordpress

FACEBOOK LIVE CHAT FOR WORDPRESS The Very First Step of The 2017 Facebook Marketing Strategy

Yoast SEO

WordPress out of the box is already technically quite a good platform for SEO.

Contact Form 7 Multi-Step

CONTACT FORM 7 MULTI-STEP Featured on our Best WordPress Plugins Adding steps for your complex form The best solution to keep the form clean and simple to your visitors

Wednesday, August 9, 2017

What is wordpress multisite ?

What is wordpress multisite ?

One of the most interesting features of wordpress but we rarely take advantage, it is the feature to create multiple web sites on the same wordpress source code. The feature is called wordpress multisite.
What is wordpress multisite ?

In the past, it had a different name, wordpress multi user. But now we should call wordpress multisite for accuracy.
Wordpress multisite is a features available in the wordpress version of the source of 3.0, It can help us create a network of many websites on the same WP source code. And we can create as many websites as you like but not need to put new code for each website. It was wonderful, was not it ?

Application of wordpress multisite

Most of us have the need to create a network with many linked websites on the same server these days you should use the wordpress multisite feature is the best.
For example, the tutsplus page has many subpages Design.tutsplus.com, code.tutsplus.com, music.tutsplus.com and we can use wordpress multisite to create a network of many linked sites so, you can even link people to different sites. you can even link all users together so that they can sign in to any site on the network.

Benefits and when should not use wordpress multisite

We first need to know the benefits of using WP multisite:
  • Easily manage updates of source code and plugins / themes,  Because all subnets in the network use the same source code as a theme and plugins.
  • Can create sub-sites as you like and easily delegate and manage it.
  • Save resources, because the same source code for many website resources will save more than each website a different source code.

The case should not use WP multisite.
  • when You need each website is a separate IP because the sub-website whether using a domain name is not only pointing to the IP of the parent website, so it is not possible to use the IP separately for the child website.
  • You need a separate database because all the subnets in the same network share the same database, just that it has its own data tables.

Overall, if you need to build a website system that you believe will not make a big difference in the appearance of your website then you should use this feature.


Friday, August 4, 2017

DIRECTIONS FOR WORDPRESS REPRODUCTION


Your wordpress website may get infected when you use Unknown root source themes or plugins or the password you set too easy to hack so the malicious code is normal.
When a website is infected with malicious code, there are usually three categories as follows.
 First: your homepage has been moved to the hacked announcement, followed by a great music or a picture parody you.
Second place: your website sexaam silently send out phishing e-mail, Continuous spam on hosts you will never know
Third: Your website will contain links to dirty web sites,.
And if you fall into one of the above cases then the provider will lock your hosting. If you have used VPS  you will be warned or blocked website if it falls into the case number 1.
You will now be ranked lower in search results on google, and will be red when browsing the web using the chrom browser to warn you that your site is not secure.
But do not worry, there are ways hack will also prevent hacking. Just do not use theme or pirated plugins or set password is long and hard to remember, you do not remember the best (just kidding, do not follow) or simply install itheme security is ok.
What if your site is infected with malware then?
Do not worry then there is a way to solve the problem.


How to solve when the site is hacked?


When your site is infected Instinctively, you will go to google query how to remove malicious code or how to remove the virus for your website. But sadly, no tool can help you free, and if you want to remove the virus you have to accept to pay a very expensive price.
After deleting your site is not completely sure the only way to completely remove the virus is to reinstall website again.
Installing a website from scratch is the only way to get your website clean installing a website does not mean that you will rewrite the content or the product because the data will be saved to the database, but the good news is that no malicious code attaches to your database either.
Installing the website means that we will retrieve the soft data stored in the database on the old site, then install the new website and import the data into it, then reset the plugin and theme from the beginning with clearer source.

Steps to reset your website from scratch


Step 1: Install a new website


Now you are installing a new wordpress website on the host or localhost and use a new domain name to run this website  to ensure that you have just visited the new website and the old site for easy checking and comparison.
Then open the wp-config.php file of the new website and insert the following into <? Php:

01
02
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Change example.com to the new website address.

Step 2. Backup data on the old site


For the first backup you have to phpMyAdmin to export data in the database being used and downloaded to your computer or you can simply use the backup plugins to down load the database.
Next is bring the folder containing the image in the upload, / Wp-content / uploads / as 2017, 2016, 2015, 2014, ... about your computer you have to make sure that you only download the folder that contains the upload image for your safety.
If you use Hosting then you can go to File Manager using Compress to compress these folders and download. Or if you install a new website on the same host, you do not need to download, just copy the directory to / wp-content / uploads / in the new website directory.

Step 3: Import old data into new website


To this step you have to access phpmyadmin at the host or localhost running the new website and find the database name of the website. Then click on import and upload the .sql file that you had in step 1.
During the import database process, there will be some errors.
If you get an error when importing the database, create a new database and import it into the new database. Then set up the website using the new database offline.
Enter the name of the data sheet with prefix “wp_” or another prefix.
If you use a prefix name other than wp_, open the wp-config.php file at the new website, find $ table_prefix, and replace wp_ with the prefix of the database table. For example, if you have a table named 38dug_options in the database, it will change to:

01
$table_prefix = '38dug_';

Then upload the image files in the old website running on the host (wp-content / uploads) to the wp-content / uploads directory in the new website to ensure the image is not lost.

To test, you can access the Media Library on the new website to see if the image is fully displayed. If the image shows normal then it is complete.


Step 4: Reset the originating theme for clarity to be more secure


To this step is simple you just need to find a theme that fits your field. If the theme uses the best paid theme should buy the copyright of the theme to be sure, update to the latest version to prevent tigers.
Then you should install the plugins to secure your wordpress like itheme security.

Step 5: Upload the source code to the main website

Once you have completed the site setup steps When you start using the new web go to hosting and delete all the data in the old web, then transfer the source code of your newly created website to the host directory of the main website.
To do the fifth step you have to do two small steps.
1.Backup and restore the new website source code to the host.
2.Backup database and restore database on host.
After the transfer completes, open the wp-config.php file of new and improved wordpress WP_SITEURL is the main website address. Example:

01
02
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

This can ensure that you can access the new website by your own domain name.


Step 6: Change the website address in the database


Now log on to the new website on the host and install the plugins Better Search Replace, Then go to Tools -> Better Search Replace and find the old domain name in all the database tables and change to the new domain, uncheck Run as dry run as shown below.

So all the clean links on your old site will be redirected to the new website, It's not manual, so you can still keep your google ranking.

Last step. Set up security for WordPress website


This is the most important step .
Do you still remember the reason that you have to install wordpress back from the beginning?
This is because of malware infection, So after completing the new web setup steps you have to make security settings for your website secure.
And above all, you should use the theme and plugins have a clear origin to avoid being attacked.
If you do not install something strange on your website, complex admin password, good security plugin setup, then you will not need to worry about security solutions anymore.
Wish you never be infected for your website


Thursday, August 3, 2017

10 best live chat plugins you should have for wordpress


For any business website , it requires providing and best support to their customers and users.
Everyone wants to find a quick response to their queries. Your quick support will make your customers feel satisfied, and customer satisfaction will become the key to your business. For online shoppers, they prefer direct support over any other type of interaction.
The live chat format is extremely effective with any website it allows your customers to chat directly to the wordpress site easily and happily.
So today  in this article, Hatachi Nara is going to list 10 best and most popular WordPress live chat plugins. All these plugins are up-to-date and you can use these plugins to help your customers easily.
You can also choose the appropriate faebook messenger wordpress plugins to equip your sales site, Read more The best messenger plugins for wordpress in 2017 for more information and choose the appropriate plugins for yourself (click here).

1. Facbook Live Chat For Wordpress.


10 best live chat plugins you should have for wordpress

Pricing: FREE

Facebook Live Chat is a free WordPress plugin allow put your Facebook live chat box on your website, visitors can chat with you via Facebook Messenger. This is easy way to support and keep contact with your customers.
Because most customers and users now use facebook therefore, suppor and live chat with customers are much more convenient, so you can chat with yout cutomer at any time. The more wonderful thing is that facebook saves your chat history with client, so that you can take care of customers who have demand as yet have not made a purchase action, and live chat for wordpress is very easy to use.

Features of facebook live chat for wordpress

CHAT WITH YOUR CUSTOMERS ANYTIME

You can select any admin menu or submenu to hide & sort it.

UNLIMITED HISTORY CHAT

Yes, this is great. Facebook is saving the whole chat history. You can view chat log anytime.

UNLIMITED BANDWIDTH

This is Amazing!! With Facebook server, bandwidth is not a problem to worry about.

 MULTIPLE CHAT AT THE SAME TIME

Chat with many your customers at the same time, just like chatting with your friends in many chatbox.

 NO CONFIGURATION REQUIRED

Just enter your Facebook fan page URL. Then you can use it. Very simple. No Facebook app ID required.

EASY TO USE

Installing in just a few click and the whole secret weapon is ready to use.

 UNLIMITED COLORS

You can customize colour in Settings. Make it harmonized with your website theme colour.

USER-FRIENDLY

Facebook is popular and universal. It becomes around for quite a long time and people are very familiar with it.

 INCREASE YOUR FANPAGE LIKE

Like button is shown in live chat popup. If you provide great support, your customers are more than willing to like and give some testimonials for your products/services.

AND MORE...

More functions in this plugin you can buy it to experience

2. Zopim Live Chat

10 best live chat plugins you should have for wordpress


Zopim is another leading WordPress live chat service provider. It is easy to setup with Zopim Live Chat plugin.
Also same like the wordpress support live chat other Zopim is the tool tool link between your business clients with customer.

In addition to adding live chat functionality to your site  Zopim also provides useful tools like user analytics, chat logs, and email transcripts  you will also easy to customise tune utility options to be possible to your theme you like your website.

Zopim comes with native apps for iOS and Android devices. These apps allow you to easily connect to Zopim dashboard from your mobile devices and provide live chat support from anywhere.

Pricing: Zopim offers a free plan which allows only one active chat at a time and limited features. Their basic plan starts at $14 per month per agent.

3.Live Chat

10 best live chat plugins you should have for wordpress

LiveChat is the industry leader in live chat support software. It’s very easy to set up and install with their free Live Chat plugin for WordPress.

LiveChat also offers beautifully designed applications that you and your agents can use on your laptops, tablets, and mobile devices. That means you can chat with customers while you’re on the go, without having to log in to your WordPress dashboard.

You can sample the survey before and after the chat session so you can evaluate how your support team is doing. During your off-hours your users can also conveniently send a support ticket directly from live chat.
LiveChat integrates with dozens of other services like popular CRM software, Google Analytics, Zendesk, all the most popular email marketing services, and many more. This will save you time since you won’t have to enter customer details manually into your other systems.
Perhaps the best feature of LiveChat is speed. It loads extremely fast, works on all devices, and offers a much better user experience than most other live chat software.
Pricing: LiveChat has different plans for businesses of all sizes. Their starter plan starts from $16 per agent per month billed annually, or $19 for month-to-month. Each plan comes with a 30 day free trial.

4. Formilla Live Chat

10 best live chat plugins you should have for wordpress


If you are looking for a wordpress support live chat .

Installs Instantly: Use the out-of-the-box Formilla Live Chat web interface to begin live chat online immediately. The live chat button will appear on your WordPress or WooCommerce site upon installation/activation of this plugin.

Mobile Apps for iPhone, iPad, and Android Devices: Live chat via your mobile device or tablet by using our iPhone/iPad or Android apps! Install our app and simply login to your Formilla Live Chat account to chat with customers from anywhere! This feature is available with any Premium package.

Mobile Ready Chat Widget: The Formilla.com Live Chat widget has a responsive design that adapts to smartphones of any size, making it easy for your website visitors to interact with.

Real-time Visitor Monitoring: Formilla Live Chat real-time visitor monitoring/tracking allows you to see the number of active visitors on your website, and initiate live chats with them. View what country the visitor is accessing your site from, their recently viewed web pages, operating system in use (Windows, Mac, iOS, Android, etc.), internet browser, referring site, new user vs. returning, IP address, and more. Formilla Live Chat visitor monitoring comes with any of our Premium account packages.
 Pricing: free

5. WP Live Chat Support

10 best live chat plugins you should have for wordpress

The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. No third party connections required. There’s no need to pay for live chat monthly subscriptions in order to better understand your visitors. This is a fully functional live chat plugin. Increase your conversion rates by communicating directly with your visitors when they’re ready to do so using WP Live Chat Support.

Features of wp live chat support.


Most popular WordPress live chat plugin
WP Live Chat Support is a fully functional live chat plugin
Unlimited simultaneous live chats
Live chat directly with your visitors
Easy to use interface for both the admin and the visitor
Edit all text fields shown on the live chat box
Users can drag the live chat box around their page
Change the colors of the live chat box
Fully responsive admin chat dashboard
Offline messages are now stored (When Live Chat is switched off)
6 predefined live chat box themes to choose from
Fully customizable live chat experience
Apply animations to the chat window
Access historical live chat records
Use our new powerful Node.js message relay server to improve
And more so on

6.Tawk.To WordPress Live Chat Plugin

10 best live chat plugins you should have for wordpress


tawk.to is a 100% FREE live chat app that lets you monitor and chat with visitors on your WordPress site. No catch. No spam. No wares. It’s truly free and always will be.

Gain valuable insight when you monitor your website visitors in real time.
Stay connected anywhere, be in touch with your customers from your computer, or your mobile.
Live Chat is convenient for your customers, helping them through pain points and as a result helping you generate better customer support and higher conversions.

7. Drift


10 best live chat plugins you should have for wordpress

Most of the visitors leave your website without any actions. A live chat plugin like Drift can convert visitors to customers and customers to potential assets. With live chat plugin like Drift, you can increase inbound leads by 200%.
Drift also enables you to send in-app messages which can increase the reachability of your messages. Most of the time the emails send by you left closed. With in-app messages, you can effectively communicate with your visitor to motivate him to make a sale.
If you have a small team, Drift enables you an offline mode where your visitor can leave the message and when you’re back online, you can simply revert them back. So, try Drift, a real time live chat plugin and increase your business.


8. Olark

10 best live chat plugins you should have for wordpress

Olark is a popular live chat solution for online businesses. It’s easy to use, and adding Olark to a WordPress site is simple. All you need to do is copy and paste a code snippet into your WordPress widget or in your child theme.
If you’d rather not work with code, then there is also a free Olark for WP plugin which makes setup even easier.
Olark offers integration with other services such as Salesforce, Zendesk, Highrise, etc.
There are third party mobile apps which allow you to connect to Olark chat from almost any iOS or Android device, so you can chat with customers on the go.

Pricing: Olark has different plans for businesses of all sizes. Their Bronze starter plan starts at $17 per month. All their plans have free trials, and you get a 10% discount if you pay for the whole year.


9. Chat Room

10 best live chat plugins you should have for wordpress

The Chat Room is wordpress live chat plugin allows administrators to easily create chat rooms for their users to participate in. Chat rooms are created via the WordPress administrative interface. After creation, users can access it via the permalink for the chat room.

The plugin currently will only support servers that have direct PHP filesystem access, which may not be available on all hosting environments.

Users will need to create an account on your WordPress site to join the chatroom. The chat rooms are public and any registered user with the chatroom URL can access the room, so this may not be an ideal solution if your customers want to chat privately.

10 My live Chat

10 best live chat plugins you should have for wordpress

My Live Chat is a free, fastest, high performance and most user-friendly live chat software solution. It allows you to live chat with website visitors, monitor site traffic, and analyze visitors web activities, including their search engine and keyword usage.
Visitors to your web site simply click a Live Help button and are connected with one of your representatives. Your representative then assists the visitor by providing information, links, graphics, or even guiding them through your web site.

Features of my live chat


Customize button and window to match the look of your site
A series of professionally designed built-in templates are also provided.
Easy to install, It only takes a few minutes!
During the free trial period all features are fully available.
When you subscribe, all customizations and settings will remain.

Last word

These are the best wordpress plugins me have ever used, and I recommend you should use them for your sales page, in addition, you should also find out what plugins needed for your web sales and theme for woocommerce of your web.

Related article


Saturday, July 29, 2017

10 very beautiful themes for woocommerce on wordpress


Premium themes for woocommerce on wordpress always the products worth to invest money, because it will help you build an extremely professional sales page on wordpress source code.

Premium themes for woocommerce usually range from $ 40 to $ 60 per edition, and when you buy a version you can use it for many different sites.

Today HATACHI will introduce to you some themes beautiful for the woocommerce on wordpress, all these themes are easy to install by looking at the documentation or importing the demo data into a nice website as demo with one click.

Premiumo-WooCommerce Shopping Theme

10 very beautiful themes for woocommerce on wordpress


Premiumo has the interface of modern magento, so evaluation of HATACHI it is a theme for wordpress is very beautiful and professional, it may be suitable to sell any product from technology to fashion.

With Product Search feature based on product catalog make it easier for users to find content, this is also an important development in the user experience (UX).

It is extremely suitable for many stores have many product.

More interesting that the products will be dropped below will be in the sidebar in addition to home page with countdown timer, make it stand out for the products you want to attract viewers.

In addition, it integrates many additional features that are also essential for a website sales, like most favorite products, product zoom, product comparison.

Celine - Responsive Shopping WordPress Theme

10 very beautiful themes for woocommerce on wordpress


Celine is a great theme for fashion website wordpress, It supports many different types of display for you can set up  in a way that you want in your own style.

Although highly customizable, But the installation and use of Celine is quite simple You can customize each component even the smallest one easily in Celine's Theme Options.

Mandala - Responsive Ecommerce WordPress Theme

10 very beautiful themes for woocommerce on wordpress


Added a theme for fashion website.

There are 6 completely different display styles from header to footer of Mandala and donate some other famous paid plugins, this will help you to have an extremely fashionable sales site.

There is a unique display style. Although this is a poor color theme with just two main colors but it is a very prominent feature of this theme.

Not only does it display beautiful products and blogs, Mandala also has a professional portfolio display feature.

WooMarket - Supermarket  WordPress WooCommerce Theme

10 very beautiful themes for woocommerce on wordpress


Also the same as Premiumo Theme. Supermarket themes are often designed for displaying a variety of products on the store. And WooMarket theme is one of them, a glance, this theme tends to display content as the popular ecommerce site today, and functions are similar.

Woomarker supports up to seven different display modes, And maybe more because you can freely customize the display of products outside the home page the paid plug-ins are also included in the benefits of customizing the theme.

Aloxo - Responsive WooCommerce Theme

10 very beautiful themes for woocommerce on wordpress


Aloxo is seen as a color theme suitable for kids fashion theme. Although the display and main functions in the theme does not seem very different from the theme I have introduced above, but the interface is simple but colorful, airy and very easy to install can make the comedy. Crush the users.

MixStore - MultiShop WooCommerce Theme

10 very beautiful themes for woocommerce on wordpress


If you own many different sales pages  or do website design services for customers then you should be equipped with this theme because you can make many sales pages on many different genres from electronics, fashion, sports, to gifts, movie discs or a one-stop shop just one click away from entering the sample data available in the theme package, you have the most complete sales page.

Jewelery - WooCommerce Responsive Theme

10 very beautiful themes for woocommerce on wordpress


This theme has nothing to say much, As the name of the Jewelery theme, this is a simple Woocommerce theme, but with a luxurious interface suitable for the website introducing / trading jewelry.

Home Shop – Premium WooCommerce Theme

10 very beautiful themes for woocommerce on wordpress


A website selling electronics, technology it will be very suitable for a flat metro interface like home shop.
This particular theme has many options for you to customize, there are 8 different plugins for wordpress to enhance power it, And a feature that shows popup ads really attract.

Aurum - Minimalist Shopping Theme

10 very beautiful themes for woocommerce on wordpress


Aurum is a modern theme, with up to 900 purchase only after a few months of launch, this theme is extremely simple design but the loading speed of aurum is extremely fast because the size of the website after accessing is quite light and does not have many polished functions.
Next comes the full WPML plugin integration to be a multi-language sales page, and there is support for RTL format languages, not only that Aurum has the ability to do different types of website sales each category has its own characteristics such as fashion, clock, computer, flower ...

Nielsen - The ultimate e-commerce theme

10 very beautiful themes for woocommerce on wordpress


Nielsen is one of the themes of YiThemes which is famous for its heavy e-commerce themes Complex but equally attractive and powerful.

 Nielsen integrates with you 12 different display modes that you can use with just a few basic settings, Each type of display will correspond to a different sales category.

The option of this theme also includes the PDS file of the design so that it can be revised if it is designed. Or use it for another e-commerce project without any additional fees.

Last word

This is the theme for woocommerce themselves quite good for many products There are also free best wordpress themes for websites Just as good.
Depending on the financial conditions, you have the options that really fit your sales page

Related articles

Wednesday, July 26, 2017

Meet GavernWP: Awesome Free Theme Framework for WordPress


In the previous post HATACHI has listed 10 free theme beautiful forum for wordpress You can re-read the article here, Today I would like to mention Meet GavernWP.

Perhaps those who have been using wordpress have heard through the Theme Framework right? And there are also representative names like Thesis Framework, Genesis Framework, These framework framework were many people like the world and use especially thesis framework with many features and advantages, and the support of seo is extremely good, but it has a slightly more difficult to use.
Outside the framework themes returned by, there are also free theme frameworks also not to be missed as Thematic, PressWork, Flexible…and so on. Although the framework is free but also full of features and extremely professional as other paid frameworks.

Meet GavernWP: Awesome Free Theme Framework for WordPress

 Meet GavernWP


 Meet GavernWP has many more advantages than other free frameworks need to mention. After downloading, installing, you can use right now basically it was beautiful.

I will list some features specific to this theme for you to see.

Responsive Design: Display visual content to devices by HTML5 and CSS3.

Custom Typography: Decorate articles with many types of lists, quote, dropcap, text block extremely beautiful and professional.

Custom Font: Use 3 types of fonts that are basic font, google font and squeril.

Custom Post Formats: Custom message format.

Social API: Integrates social networking API so that users can interact with their accounts on their blogs.

SEO Options: Improve SEO for your blog with extremely simple settings.

Cross-Browse Support: Show good on every browser now.

Shortcode: Display a variety of shortcode diversity and many different types to decorate the article more beautiful.

All these features are set up to create Coltrol Panel of the theme in WP-Admin.

Meet GavernWP: Awesome Free Theme Framework for WordPress

Meet GavernWP: Awesome Free Theme Framework for WordPress


There are other cool features that are waiting for you to explore and experience.

Meet GavernWP: Awesome Free Theme Framework for WordPress


You can add colors and widget styles to make the theme look better, i really like this feature in this framework, Imagine the widgets on your blog each have their own color and harmony white background color, very eye catching it :)

Meet GavernWP: Awesome Free Theme Framework for WordPress


With the location of various widgets on the blog, You can insert any content into any position you want to tailor your theme custom style.


This will be a cool choice for those who use the theme based on quality frameworks, it is also a good choice for those who want to own a good theme framework without having to pay any fees.


Related article


How to create shortcode from A to Z

How to create shortcode from A to Z


What is shortcode?

The shortcode is a short piece of code, This short code will do something that you set at creation of the shortcode, Eg show a loop, You can make this shortcode anywhere in the post, in the theme, except Excerpt and Widget.
Today shortcode is used quite commonly you can go to the wordpress plugins library and look for plugins with the shortcode keyword there are many plugins to appear it supports you with a number of full-length shortcodes required from decorating articles to making the tasks more complex.
And in many themes for wordpress it also supports some of its shortcode.

How to create a shortcode

All the code in this article you write into the functions.php file of the theme nhé.
To create a shortcode, we will have two main steps.
Step 1: Set the code execution function in the shortcode.
Step 2: Creates a shortcode based on the function created.
To figure out I'm going to give you a sample of this shortcode

//Initialize function for shortcode
function create_shortcode() {
        echo "Hello World!";
}
// Create a shortcode named [test_shortcode] and execute the code from the create_shortcode function
Add_shortcode ('test_shortcode', 'create_shortcode');
What matters is that I've put it all into code, Now if you write [test_shortcode] in the article content, Then it will show the hello world! instead of the shortcode you just wrote.
But one problem is the word Hello World! It will always be at the top of the article as we use the echo command.
If you want to show it right place the shortcode, you must use the return statement instead of echo.
You can fix echo "Hello World!" to return "Hello World!" Later when you write shortcode you should avoid using echo.
Similarly, we apply a little knowledge of Loop and Query to create a shortcode display 10 random articles offline.

function create_shortcode_randompost() {

        $random_query = new WP_Query(array(
                'posts_per_page' => 10,
                'orderby' => 'rand'
        ));

        ob_start();
        if ( $random_query->have_posts() ) :
                "<ol>";
                while ( $random_query->have_posts() ) :
                        $random_query->the_post();?>

                                <li><a href="<?php the_permalink(); ?>"><h5><?php the_title(); ?></h5></a></li>

                <?php endwhile;
                "</ol>";
        endif;
        $list_post = ob_get_contents(); // Take the entire contents above the $ list_post variable to return        

         ob_end_clean();

        return $list_post;
}
add_shortcode('random_post', 'create_shortcode_randompost');


You can see from paragraph 8 to paragraph 21 I wrote the loop in the function ob_start() and ob_end_clean(). Actually here I have to cache anything I’ll wrap that part to use the function ob_get_contents() Go to the $ list_post variable, then return this variable out because when you do shortcode you must use return. If anyone has a better way, let me know.
Now you write [random_post] the location where you need to display the list of random items is ok.

Create a shortcode using the parameter

In the previous section we only learn by creating a simple shortcode, which means it only shows what we wrote in the shortcode that does not allow customization of the user. If you want to let the user manually edit what is displayed, here we have to use the parameters.
For example, in the shortcode above we have shown 10 random posts. But if using the parameter, we can let the user customize the parameter in the number of posts displayed and can choose the sort order if you want.
To create a shortcode containing the parameters we create as follows.

function create_shortcode_ parameters1 ($args, $content) {
        return " this is number". $args[' parameters1'];
}
add_shortcode( 'shortcode_ parameters1', 'create_shortcode_ parameters1' );
First, in the function part, we have two arguments  $args and $content. The $args variable is the shortcode parameter and the  $content variable is the piece of content wrapped in code. You see the example below:
[shortcode_thamso thamso1="100]Đây là biến $content[/shortcode]
Thus, we have thamso1 as parameter and number 100 means the value of any parameter that the user can set. $content is wrapped inside the shortcode, but in the above paragraph we do not use the $content variable to print so even if you write like that, the $content section is not showing up yet.
Now you write the shortcode on the article it will show "this is 100" right, And that also makes the parameter shortcode.

function create_shortcode_tinhtong($args, $content) {
        $tong = $args['term1'] + $args['term2'];
        return "Total".$tong;
}
add_shortcode( 'total', 'create_shortcode_total' );
And when writing the shortcode we will write the following.
function create_shortcode_content($args, $content) {
        return strtoupper($content); //Prints all the content in the shortcode }
add_shortcode('shortcode_content', 'create_shortcode_content');
And now you try to write in this shortcode.
[shortcode_content]Viết cái gì đó vào đây[/shortcode_content]
Has it printed the entire text in the body of the shortcode?

So why does the example above use only $ content but have to declare both $ args? Because by default, if you just declare a parameter, it will know for itself that the variable is the first parameter, so it's best to declare both variables, of course you can set any name.
Summary:
$ Args will have a parameter structure of $ args ['arguments'], and the suffix is the parameter in the shortcode that you have to write in the same way.
$ Content is the variable that prints the entire contents of the open shortcode and shortcode tags.

How to write a shortcode into a PHP file

Shortcode only executes in the WordPress editor, but in other situations it does not understand. So if you want to insert a shortcode into a PHP file, you must use the do_shortcode () function to execute it. For example:
<?php echo do_shortcode('[test_shortcode]'); ?>

Examples of shortcode examples


Shortcode displays video from Youtube


By default, the embed code from YouTube will look like this.
01
<iframe src="//www.youtube.com/embed/0KJ60uJZ3-Q" height="480" width="640" allowfullscreen="" frameborder="0"></iframe>
So here we play three parameters:

Enter the ID of the video.
Parameter to adjust the width of the video.
Video horizontal adjustment parameter.
Ok let’t do it.

function create_youtube_shortcode( $args, $content ) {
        $content = '<iframe src="//www.youtube.com/embed/'.$args['id'].'" height=" '.$args['height'].'" width="'.$args['width'].'" allowfullscreen="" frameborder="0"></iframe>';
 return $content;
}
add_shortcode('youtube', 'create_youtube_shortcode');
And the shortcode would look like this:
[/youtube width="500" height="300" id="0KJ60uJZ3-Q"]
It will manually pass the parameters you entered into the shortcode.

Insert a full color notification box

This example will work with $ content in the shortcode.


function create_notification _shortcode($args, $content) {
        return "
<div class='notification '>".$content."</div>
";
}
add_shortcode( 'notification ', 'create_notification _shortcode' );

And add a little CSS to the style.css file

.thongbao {
     background: #585858;
     padding: 1.5em 2em;
     color: #FFF;
     border: 1px solid #C7C7C7;
}
Ok, now you can write in the content is [thongbao]Nội dung thông báo[/thongbao] Then see the results offline.

Shortcode retrieves Facebook information

In this example, the code will be a little too long to use get content from JSON through Facebook Graph. The shortcode structure will be [\fbgraph username="thachpham92"] The thachpham92 means the input parameter, ie the Facebook username needs to be displayed.

function create_fbgraph_shortcode($args, $content) {
        $get_info = wp_remote_get('https://graph.facebook.com/'.$args['username']);
        $get_avatar = "https://graph.facebook.com/".$args['username']."/picture?type=large";
        $dc_info = json_decode($get_info['body'], true);
        $dc_avatar = json_decode($get_avatar['data'], true);

        // Make variables easy to handle.
        $fb_id = $dc_info['id'];
        $fb_username = $dc_info['username'];
        $fb_url = $dc_info['link'];
        $fb_name = $dc_info['first_name'];
        // Write gender.
        if ($dc_info['gender'] == 'male') {
                $fb_gender = "male";
        } else if ($dc_info['gender'] == female) {
                $fb_gender = "female";
        } else {
                $fb_gender = " Undefined!";
        }

        ob_start();?>
<div class="fb-info">
<h5>your information <?php echo $fb_name; ?></h5>
<div class="avatar"><img alt="" src="<?php echo $get_avatar; ?>" /></div>
<div class="info"><strong>your ID: </strong> <?php echo $fb_id; ?>
 <strong>Username: </strong> <?php echo $fb_username; ?>
 <strong>sex: </strong> <?php echo $fb_gender; ?></div>
</div>
        <?php
        $result = ob_get_contents();
        ob_end_clean();

        return $result;

}
add_shortcode( 'fbgraph', 'create_fbgraph_shortcode' );

And a little CSS like demo

.fb-info {
overflow: hidden;
padding: 0.5em 1em;
background: #3B5998;
border: 1px solid #E8E8E8;
color: #FFF;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.fb-info .avatar {
width: 30%;
float: left;
margin-right: 5%;
padding: 10px;
background: #FFF;
border: 1px solid #F3F3F3;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.fb-info .info {
width: 60%;
float: right;
}
Ok, let's try it.

Last words

Thus, in this article you already know through how to create a shortcode basically like, then create a shortcode that use parameters and I also explained quite thoroughly about it (should post it new long this) .

Really shortcode in WordPress is an extremely powerful feature for you to insert something into the post quickly. But be careful when using it because if you have users in multiple threads, later you do not want it anymore shortcode off, then to really tired.


If you still have questions, please leave a comment offline.

 
loading...