Showing posts with label Plugin-development. Show all posts
Showing posts with label Plugin-development. Show all posts

Sunday, 30 April 2017

View My Posts Alone - WordPress Plugin

Introduction


This is a WordPress Plugin which is used for the authors who write blogs in a Site. This can be mainly used for the Single Site Multi Author Concepts who does not want to share their writing with the others until it has been published. So for them this plugin can be very useful.

Plugin URL

  1. WordPress Plugin Repository: https://wordpress.org/plugins/view-my-posts-alone/ 
  2. GitHub Repository: https://github.com/Nareshkumar979/View-My-Posts-Alone

Plugin Description

  • This is a very simple and easiest of all the plugins. The View My Posts Alone plugin is specially designed for those who have many authors(contributors) or allow guest posts, custom user roles to access their blogs/articles. In WordPress, a contributor can write as much blogs and articles as they can and submit it and wait for review (i.e) to be published from the administrator or the Person who is in-charge of doing these things. But at the time when the contributor or the custom user role member visits the posts section or the custom post type he/she can see all the posts that has been presented in that site. If that happens there is no privacy for the contributors to write up their article and put up in the blog.
  • In order to overcome this type of problems alone this plugin has been written and it is very successful even for lots of users in that blog. It will restrict the posts or the CPT to view only the posts that has been published or which has been saved as draft by that user alone. It will never display other persons write ups onto the Dashboard of the Others.
  • The Administrator and the Blog Author can view all the posts that are being contributed to their site and confirm what are all the posts that can be published and what not to be published.
  • On the whole this will be fantastic for the Users who are onto the Blogging and make things secret from the other writers.

Sunday, 24 April 2016

Creating Custom Post type Plugin in Wordpress

8 Easy Steps of how to create a Custom Post type Plugin in WordPress

This post will provide you a very easiest way to create the custom post type plugin in WordPress which automatically creates your plugin with the default functionality that a WordPress plugin will have.

Plugin folder Structure:
  • wp-content
    • places_to_visit(folder-name)
    • index.php
      • css
        • style.css
      • js
        • jquery.js
      • images
        • logo.png

 Follow this Steps and you will find it Interesting of how easy the plugin creation is in WordPress.

Step:1 Create a New Folder inside the Plugins folder which you find it inside the wp-content.
Step:2 Name the New folder which you have created with the custom post-type plugins name that you are going to create.
Step:3 Open up your editor with a new file which you are using and paste the below code in that and save the file name as "index.php"

Index File Code:

<?php
/*
Plugin Name: Places to Visit
Plugin URI: http://nareshkumar979.blogspot.in/
Description: The plugin helps the tourists to know what are all the places available to visit when then plan to spend a vacation at a particular place.
Version: 1.0
Author: Naresh Kumar.P
Author URI: http://nareshkumar979.blogspot.in/
License: NK001
*/
//Starting of the Custom Post Type called "Places to Visit"
add_action( 'init', 'places_to_visit' );
function places_to_visit()
{
 $args = array(
            'labels' => array(
            'name' => 'Places to Visit',
            'singular_name' => 'Place to Visit',
            'add_new' => 'Add New',
            'add_new_item' => 'Add New Places to Visit',
            'edit' => 'Edit',
            'edit_item' => 'Edit Places to Visit',
            'new_item' => 'New Places to Visit',
            'view' => 'View',
            'view_item' => 'View Places to Visit',
            'search_items' => 'Search Places to Visit',
            'not_found' => 'No Places to Visit found',
            'not_found_in_trash' => 'No Places to Visit found in Trash',           
            ),          
            'menu_position' => 15,
            'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),           
            'menu_icon' => plugins_url( 'images/logo.png', __FILE__ ),
            'public' => true         
         );
         register_post_type( 'places_to_visit',$args);            
 }
 //End of the Custom Post Type called "Places to Visit"
?>

Points to Ponder:

Note: The plugin Index file should not contain any spaces between the codes. It should be coded as per my "index.php" file.
"If index.php file is coded with spaces it will create warning dialog at the time of plugin activation"

In this plugin the post type will be "places_to_visit".
"supports"-> This will decide what are all functionalities and input fields that your plugin can have.
(eg.) I have added
  • title:  will hold the Post Name 
  • editor: used for entering the contents for that particular posts.
  • thumbnail:  used for having a image for the post.
  • custom-fields: It will be displayed if you create the custom fields for the posts that you create(Will explain in the Later posts of how to create custom fields for the particular posts)
For placing the Image icon to your plugin continue the steps below.

Step:4 Create a folder called "images" inside the custom post-type folder and place the image which you want to keep as icon for you plugin.
Note: the icon size should be either (24X24 or 32X32). Other than this size the icon will not fit in the menu place.
Step:5 For adding the css and js create seperate folder as you done for the images and include it in the pages which you need.
Step:6 At last after doing all this you go to the WordPress dashboard by logging in and move to the Plugins Menu.
Step:7 You will find the Name of the Plugin which you have created under the "Activate" mode.
Step:8 If you click on Activate your plugin will be activated and you will find your plugin in Sidebar Menu.


Email Code PHP

This is a Simple Code which is written in the PHP for Sending Emails from One Server to all the Other Domains. It is very easy and little C...