WordPress Plug in Tutorial

WordPress actively pushes articles to Baidu Bear Palm plug-in

Release time: 2018-07-01 18:12:23

Author:

Last updated on July 1, 2018

There is a small change in the push port of Baidu Bear account. Careful friends can see it at a glance. You must pay attention when changing.

First, we will find wp content plugins in the wordpress installation directory, create a new xiaozhang submit directory in this folder, and then create a new xiaozhang submit. php file in this directory with the same name.

The file content is posted below. You can change your appid and token when using it.

 <? php /*Plugin Name: Bear Palm Active Push *Description: Bear Palm Active Push in WordPress until version 4.7 *Author: small beast wordpress * Author URI:  https://www.seo628.com * Version: 0.1-beta */ define('APPID', '*********');// Define bear paw appid define('TOKEN', '*********');// Define bear paw push token if(! function_exists('Baidu_Submit') && function_exists('curl_init')) { function Baidu_Submit($post_ID) { //Articles that have been successfully pushed will not be pushed again global $post; if(empty($post_ID) || get_post_meta($post_ID,'Baidusubmit',true) == 1) return; $status = $post->post_status; if($status != '' && $ status != 'publish'){ $url = get_permalink($post_ID); $api = ' http://data.zz.baidu.com/urls?appid= '. APPID.'&token='.TOKEN.'&type=realtime'; $ch  = curl_init(); $options =  array( CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $url, CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), ); curl_setopt_array($ch, $options); $result = json_decode(curl_exec($ch),true); //If the push is successful, a user-defined column called Baidusubmit will be added to the article. The value is 1 if (array_key_exists('success',$result)) { add_post_meta($post_ID, 'Baidusubmit', 1, true); } } } add_action('publish_post', 'Baidu_Submit'); }

Small beast wordpress relies on years of Wordpress enterprise theme Production experience, adhering to the purpose of "wordpress theme born for users", has provided quality wordpress website building services for more than 100000 customers, and has received unanimous praise from customers. We always treat every customer with our heart. We firmly believe that "treat customers well, and they will become lifelong customers". Wordpress can persist for many years because we are always honest. We clearly mark the price( How much does wordpress cost to build a website )We never cheat any customer. Our quotation tenet is: "refuse to make excessive profits and only keep reasonable profits". If you have a need for website construction, website revision, website maintenance, etc., please immediately consult the online customer service on the right or call the hotline: 18907337671, and we will answer your questions one by one in detail.

Related articles

Why choose WordPress

Even the time input regardless of cost will never fail any customer.
Make the world a little better while making customers and themselves.

our story

WordPress, a small beast, is composed of a group of young people who are proficient in the development of WordPress. It belongs to the network of Num. It is a group of smart, open-minded, diligent, friendly and eager to overcome challenges.

Our mission

We hope to use WordPress, an excellent website building program, to help everyone build their own website and do Internet marketing well with high efficiency and low cost.

Our Values

We focus on doing our customers' things well and correctly, which means that we will consider the results when making decisions, and most importantly, we strive to be true.

Our Vision

We will become the best WordPress development company in China in the near future. Xiaoshou WordPress hopes to become friends with every customer and witness this beautiful future together.

 Why choose WordPress

No matter who you are, I will customize the site building scheme for you

We know that different people have different stages of building websites, some are novices, and some are veterans.
We know that different people have different purposes for websites, some are for display, and some are for marketing.

How to make online business go to the next level

 No WordPress website yet

No WordPress website yet

No matter what industry you are engaged in, WordPress will provide you with a professional theme template. There are thousands of free themes in the WordPress market, suitable for many small and medium-sized enterprises.

View all templates
 Already has a WordPress website

Already has a WordPress website

Small beast WordPress sincerely invites you to learn WordPress together, and is willing to work with all parties to upgrade and improve your WordPress website, and exchange website acceleration, website optimization and other issues.

Make a friend now
We can contact with each other in wechat
 chat Scan code to contact
Template construction
Pick Template
Website customization
Free diagnosis
Consulting hotline
Consulting hotline

189-0733-7671

Back to top