Getting traffic on Twitter and Facebook is amazing. Otherwise, you will not share, which shows that people enjoy your content! Although you can get some traffic from ordinary social plug-ins, how can you implement fast and fast code so that people can share citations in your posts? Maybe just as we help to get more social traffic, we help to get more social traffic. The implementation of the basic quotation quick code first requires valuable shared citations, but in order for readers to really find citations, citations must be explicitly created. The
For example, citations may highlight: The easiest way to get results is to put quotation marks in the shortcut code. If you use the excellent plug-in shortcodes ultimate, the quotation marks are [su\u quote]… [\/su\u quote]. To display a horizontal line above and below a quote, you must also add an male mark around the [su\u quote] shortcut code. To make things easier, the code is a function of the subtopic. You can add it to PHP and put the [su_quote] shortcut code and the male tag into the new shortcut code. The
Add\u shortcode (‘bhs\u quote’,’bhs\u quote’);
Function bhs_quote ($atts){
Return \
}After adding code, you can use [bhs_quote]… [\/bhs_quote] to obtain [su_quote] and androg effects. Functions of sub topics. Make sure you add code to PHP. The parent theme function, because the file will be overwritten when the theme is updated. Do not add to PHP. The
If the shortcodes ultimate plug-in is actively recommended but not installed, you can also create div as a CSS class, which can be bound with quotation marks. Here are some CSS that match the + theme and the desired style: function bhs\u quote ($atts){
Return \
}The citation of the post that added the social button to the short code is now obvious and easy to see. Very good. People can now easily share citations. The
To facilitate sharing, you can add Facebook and twitter buttons to the shortcut code, as shown below: The above cited screenshot is obtained from this interview when you want to confirm the shortcut code and buttons in real time. Before implementing the twitter button, let’s take a look at the twitter button. Twitter has an API that can be accessed using structured URLs, so it’s very easy to implement. You don’t need to start postman or something like that to test it. Just copy the URL and paste it into your browser. The
It is not difficult for PHP to build URLs. Just write the following function to generate a button that links to the twitter URL. Depending on the topic, there may be built-in shortcut codes for adding buttons. For example, if you use the flatsome theme, you can use the [button] shortcut code as follows: Features bhs\u twitter\u get\u button ($text){
$url =“ https:\/\/www.bulkhackers.com \
$twitter_link =“ https:\/\/twitter.com\/intent\/tweet?text= \
$output= \
‘left’link=’ \
Return $output;
}The code, like the short code written before, is a function of the sub topic. Must be added to the PHP file. The
If no other theme has flathome or built-in button shortcuts, you can create the following buttons: Male twitter male twitter button must be part of the shortcut code, so you must call the new bhs\twitter\get\u button function in the reference shortcut code and call the return value of the function added in the shortcut code output. Function bhs_quote ($atts){
Return \
}When readers share citations in this way, twitter will automatically display post images, which is worth noting. The
Male Facebook button implementation not everyone uses twitter, so you need to add a Facebook button to the reference shortcut code. Like Twitter, Facebook has APIs that can be accessed using structured URLs. Like Twitter, it can be tested in a browser. The strategy for creating Facebook buttons is the same as twitter buttons. First, you must create a function that generates a button to connect to the Facebook URL. Features bhs_facebook \u get\u button ($text){
$url =“ https:\/\/www.bulkhackers.com \
$facebook_link =“ https:\/\/www.facebook.com\/sharer\/sharer.php?u= \
$output= \
Return $output;
}Then, the function is added to the reference shortcut code and the return value is added to the shortcut code output. The
Function bhs_quote ($atts){
Return \
}Like Twitter, Facebook automatically displays post images when citations are shared. Male twitter and Facebook pictures most blog posts have recommended pictures for twitter and Facebook to share. The
If there is no recommended image, the first image published will usually be obtained from twitter and Facebook when the post is shared. However, when sharing posts, you can also add some code to make twitter and Facebook use different images. This is what we did to show our avatars in the twitter and Facebook screenshots above. To display additional images, you must focus on two tags in the source: Male
A good SEO plug-in may help to generate these tags, but it can also directly encode and set the images used when sharing posts. The
Since most people seem to use the yoast SEO plug-in, let’s see how to implement several yoast SEO filters to set up twitter and Facebook images. For twitter images: add\u filter (\
Yoast_image_twitter’;
Features bhs\u yoast\u image\u twitter ($image){
Back“ https:\/\/www.bulkhackers.com\/wp-content\/images\/stan-efferding-twitter.png \
}For Facebook images using opengraph images: add\u filter (\
Function bhs_yoast_image_opengraph ($image){
Back“ https:\/\/www.bulkhackers.com\/wp-content\/images\/stan-efferding-facebook.png \
}The above function is just a template, which shows the filters to be implemented. Of course, you cannot return the same image for all posts. Depending on the correct requirements, importing a specific image for each post may require several types of logic. No matter where the share button is, it is not a difficult coding task to use the share button to implement the Quick Quotation code. But why only help people share citations? Depending on your site, readers may want to share something from your woocomerce store. If you have contributors, you will want to share contributions, etc. The possibilities are infinite. In the traffic game, in order to spread rumors about the website, all small things are helpful! I hope this report can help. If you like, please confirm this report! How to use the twitter component to display the latest tweets in WordPress and provide colorful WordPress topics for better participation in all niche markets of WordPress questionnaire plug-ins