Simple Create WordPress Plugin Tutorial

Today, We want to share with you Simple Create WordPress Plugin Tutorial.In this post we will show you Create a Live Demo of Your WordPress Plugin, hear for how to create plugin in wordpress step by step with example we will give you demo and example for implement.In this post, we will learn about How to Build WordPress Plugin – Example App and Live Demo with an example.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Simple Create WordPress Plugin Tutorial

There are the Following The simple About Simple Create WordPress Plugin Tutorial Full Information With Example and source code.

As I will cover this Post with live Working example to develop create wordpress plugin from scratch, so the create wordpress plugin with database for this example is following below.

Structure of the WordPress Plugin

| – readme.txt
| – auto-post-hook.php

Coding WordPress Plugin

auto-post-hook.php

<?php
/*
Plugin Name: Auto post hook.
Description: This plugin acts as a hook for auto post Web Service.
Author: Jd Angularjs KING
Author URI: https://www.pakainfo.com/about
Version: 1.0.1
*/
function autopost_retrieve_random_post() {
  $autopostArguement = array('posts_per_page' => 1,'orderby' => 'rand');
  $autopostRandomPost = get_posts($autopostArguement);
  if (empty($autopostRandomPost)) {
        return null;
  }
  $autopostPost = $autopostRandomPost[0];
  $autopostPost->permalink = get_permalink($autopostPost->ID);
  $autopostPost->hash_tags = wp_get_post_tags($autopostPost->ID,array( 'fields' => 'names' ));
  return $autopostPost;
}
add_action('rest_api_init', function(){
        register_rest_route( 'autopost/v1', '/posts/', array(
                'methods' => 'GET',
                'callback' => 'autopost_retrieve_random_post',
        ));
});
?>

Running our WordPress AutoPOST Plugin

http://your_domain_name.com/jdk_wp/index.php/wp-json/autopost/v1/posts

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Create Word-Press Plugin Tutorial.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1.   How to Create, Access and Delete Cookies in VueJS
  2.   Create First WordPress Plugin Step by Step for Beginners
  3.   how to create plugin in wordpress with example
  4.   Wordpress Plugin uninstall hook - register_uninstall_hook()
  5.   Automatically Post On Facebook Using PHP with Graph API
  6.   failed to load resource: the server responded with a status of 404 (not found)
  7.   ajax live search table generation using codeigniter
  8.   Fatal error: Call to undefined function sqlsrv_connect()
  9.   How to disable/turn off specific css in wordpress?
  10.   ng-table Pagination using Angular Example

Leave a Reply

Your email address will not be published. Required fields are marked *