folder details
1.template 2.js 3.css
Files Details
1.Index File 2.Function.php
index.php
<?php
ob_start();
session_start();
/**
* Plugin Name: Wps Fronted Post
* Plugin URI:
* Description: custom plugin for Fronted post
* Version: 1.0.1
* Author: Webplanetsoft
*/
class WPS_QUIZ_PLUGIN
{
public function __construct()
{
add_action( 'admin_menu', array($this, 'add_wps_admin_menu'));
//add_shortcode('wps_search_form',array($this, 'wps_search_form'));
//add_action( 'admin_enqueue_scripts', array(&$this,'scripts1' ));
//register_activation_hook( __FILE__, array($this,'activation_wps_plugin') );
//register_uninstall_hook( __FILE__, array($this,'uninstall_wps_plugin' ));
add_action( 'wp_ajax_wps_category', array($this,'wps_quiz_category'));
add_action('wp_ajax_nopriv_wps_category', array($this,'wps_quiz_category'));
}
public function add_wps_admin_menu()
{
add_menu_page(__( 'Frontend Post', 'wps_frontend_post_lang' ),'Frontend post','manage_options','frontend_post',array($this,'wps_frontend_post'));
add_submenu_page('frontend_post',__( 'Plugin Options', 'frontend_post_lang' ),'Plugin Options','manage_options','wps-plugin_options',array($this,'wps_plugin_options'));
}
public function wps_frontend_post($aParams = array())
{
echo $this->set_template('postindex',$aParams);
}
public function wps_plugin_options($aParams = array())
{
echo $this->set_template('configuration',$aParams);
}
public function scripts1()
{
wp_enqueue_script('bootstrapmin', plugins_url('js/newjs.js', __FILE__), array('jquery'));
}
public function set_template($aTemplate,$aParams=array())
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/header.php";
include_once "template/{$aTemplate}.php";
return ob_get_clean();
}
function activation_wps_plugin()
{
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
}
function uninstall_wps_plugin()
{
global $wpdb;
}
function wps_quiz_category()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getcategories.php";
exit();
}
function wps_quiz_category1()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getchildcategories.php";
exit();
}
function wps_quiz_category2()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getchildcategories1.php";
exit();
}
function wps_quiz_category3()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getchildcategories2.php";
exit();
}
function wps_ajax_data()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/get_ajax.php";
exit();
}
public function wps_quiz_editor()
{
$id = "custom-editor-".$_REQUEST['nextId'];
$ssid = "ansd-".$_REQUEST['nextId'];
$tsid = "ansdt-".$_REQUEST['nextId'];
$fsid = "ansdf-".$_REQUEST['nextId'];
$ffsid = "ansdff-".$_REQUEST['nextId'];
$lentab = $_POST['tablenth'];
//wp_editor( '', $id,$settings = array("editor_height" => "100px" , "textarea_name" => "childVal[0]" , 'media_buttons' => true , 'teeny' => false) );
?>
<div class="noval">
<div class="leftmain">Child Question</div><div class="rightmain">
<?php wp_editor( '', $id,$settings = array("editor_height" => "100px" , "textarea_name" => "childVal[$lentab]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); ?>
</div>
<div class="leftmain">Answer Option</div>
<div class="rightmain">
<table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /*wp_editor( '', $ssid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][0]"></br></td></tr></table><table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /*wp_editor( '', $tsid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][1]"></br></td></tr></table><table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /* wp_editor( '', $fsid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][2]"></br></td></tr></table><table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /*wp_editor( '', $ffsid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][3]">
</td></tr>
</table>
</div></div>
<?php
exit();
}
public function wps_quiz_editor2()
{
$anslan = $_POST['anslenth'];
$fid = "custom-ansoption-".$_REQUEST['nextId'];
?>
<table class="tablediv"><tr><td>
<input type="text" value="" name="ival[<?php echo $anslan; ?>]">
<?php /* wp_editor( '', $fid,$settings = array("editor_height" => "100px" , "textarea_name" => "ival[$anslan]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input class="qcheck questionfirstbox" type="checkbox" name="aval[<?php echo $anslan; ?>]" value="1"></td></tr>
</table>
<?php
exit();
}
public function load_tiny_mce() {
wp_tiny_mce(false, array(
'mode' => 'specific_textareas',
'editor_selector' => 'tinymce-textarea'
));
}
}
function wps_frontend_post()
{
require_once('template/postindex.php');
}
add_shortcode('wps_frontend_post','wps_frontend_post');
$wpsObj = new WPS_QUIZ_PLUGIN;
create a function.php file for Your All plugin Functions
<?php
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link rel="stylesheet" href="<?php echo plugins_url( 'css/style.css', dirname(__FILE__) ); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo plugins_url( 'css/jquery.dataTables.css', dirname(__FILE__) ); ?>" type="text/css" media="screen" />
<script src="<?php echo plugins_url( 'js/customizer.js', dirname(__FILE__) ); ?>" type="text/javascript"></script>
<script src="<?php echo plugins_url( 'js/jquery.dataTables.js', dirname(__FILE__) ); ?>" type="text/javascript"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<h1>Post Header </h1>
<?php
?>
create a css file for styling your plugin
create a js file
echo "hello index file";
?>
1.template 2.js 3.css
Files Details
1.Index File 2.Function.php
index.php
<?php
ob_start();
session_start();
/**
* Plugin Name: Wps Fronted Post
* Plugin URI:
* Description: custom plugin for Fronted post
* Version: 1.0.1
* Author: Webplanetsoft
*/
class WPS_QUIZ_PLUGIN
{
public function __construct()
{
add_action( 'admin_menu', array($this, 'add_wps_admin_menu'));
//add_shortcode('wps_search_form',array($this, 'wps_search_form'));
//add_action( 'admin_enqueue_scripts', array(&$this,'scripts1' ));
//register_activation_hook( __FILE__, array($this,'activation_wps_plugin') );
//register_uninstall_hook( __FILE__, array($this,'uninstall_wps_plugin' ));
add_action( 'wp_ajax_wps_category', array($this,'wps_quiz_category'));
add_action('wp_ajax_nopriv_wps_category', array($this,'wps_quiz_category'));
}
public function add_wps_admin_menu()
{
add_menu_page(__( 'Frontend Post', 'wps_frontend_post_lang' ),'Frontend post','manage_options','frontend_post',array($this,'wps_frontend_post'));
add_submenu_page('frontend_post',__( 'Plugin Options', 'frontend_post_lang' ),'Plugin Options','manage_options','wps-plugin_options',array($this,'wps_plugin_options'));
}
public function wps_frontend_post($aParams = array())
{
echo $this->set_template('postindex',$aParams);
}
public function wps_plugin_options($aParams = array())
{
echo $this->set_template('configuration',$aParams);
}
public function scripts1()
{
wp_enqueue_script('bootstrapmin', plugins_url('js/newjs.js', __FILE__), array('jquery'));
}
public function set_template($aTemplate,$aParams=array())
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/header.php";
include_once "template/{$aTemplate}.php";
return ob_get_clean();
}
function activation_wps_plugin()
{
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
}
function uninstall_wps_plugin()
{
global $wpdb;
}
function wps_quiz_category()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getcategories.php";
exit();
}
function wps_quiz_category1()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getchildcategories.php";
exit();
}
function wps_quiz_category2()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getchildcategories1.php";
exit();
}
function wps_quiz_category3()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/getchildcategories2.php";
exit();
}
function wps_ajax_data()
{
ob_start();
include_once "function.php";
$wpsFunObj = new WPS_PLUGIN_FUNCTIONS;
include_once "template/get_ajax.php";
exit();
}
public function wps_quiz_editor()
{
$id = "custom-editor-".$_REQUEST['nextId'];
$ssid = "ansd-".$_REQUEST['nextId'];
$tsid = "ansdt-".$_REQUEST['nextId'];
$fsid = "ansdf-".$_REQUEST['nextId'];
$ffsid = "ansdff-".$_REQUEST['nextId'];
$lentab = $_POST['tablenth'];
//wp_editor( '', $id,$settings = array("editor_height" => "100px" , "textarea_name" => "childVal[0]" , 'media_buttons' => true , 'teeny' => false) );
?>
<div class="noval">
<div class="leftmain">Child Question</div><div class="rightmain">
<?php wp_editor( '', $id,$settings = array("editor_height" => "100px" , "textarea_name" => "childVal[$lentab]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); ?>
</div>
<div class="leftmain">Answer Option</div>
<div class="rightmain">
<table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /*wp_editor( '', $ssid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][0]"></br></td></tr></table><table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /*wp_editor( '', $tsid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][1]"></br></td></tr></table><table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /* wp_editor( '', $fsid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][2]"></br></td></tr></table><table>
<tr><td>
<input type="text" value="" name="cival[<?php echo $lentab; ?>][]">
<?php /*wp_editor( '', $ffsid,$settings = array("editor_height" => "100px" , "textarea_name" => "cival[$lentab][]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input type="checkbox" value="1" class="checkclass questioncheckbox" name="aval[<?php echo $lentab; ?>][3]">
</td></tr>
</table>
</div></div>
<?php
exit();
}
public function wps_quiz_editor2()
{
$anslan = $_POST['anslenth'];
$fid = "custom-ansoption-".$_REQUEST['nextId'];
?>
<table class="tablediv"><tr><td>
<input type="text" value="" name="ival[<?php echo $anslan; ?>]">
<?php /* wp_editor( '', $fid,$settings = array("editor_height" => "100px" , "textarea_name" => "ival[$anslan]" , 'media_buttons' => true , 'teeny' => false,'quicktags'=>true) ); */?></td><td>
<input class="qcheck questionfirstbox" type="checkbox" name="aval[<?php echo $anslan; ?>]" value="1"></td></tr>
</table>
<?php
exit();
}
public function load_tiny_mce() {
wp_tiny_mce(false, array(
'mode' => 'specific_textareas',
'editor_selector' => 'tinymce-textarea'
));
}
}
function wps_frontend_post()
{
require_once('template/postindex.php');
}
add_shortcode('wps_frontend_post','wps_frontend_post');
$wpsObj = new WPS_QUIZ_PLUGIN;
function.php
create a function.php file for Your All plugin Functions
Header.php
template/header.php<?php
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link rel="stylesheet" href="<?php echo plugins_url( 'css/style.css', dirname(__FILE__) ); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo plugins_url( 'css/jquery.dataTables.css', dirname(__FILE__) ); ?>" type="text/css" media="screen" />
<script src="<?php echo plugins_url( 'js/customizer.js', dirname(__FILE__) ); ?>" type="text/javascript"></script>
<script src="<?php echo plugins_url( 'js/jquery.dataTables.js', dirname(__FILE__) ); ?>" type="text/javascript"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<h1>Post Header </h1>
<?php
?>
css file
create a css file for styling your plugin
js file
create a js file
main plugin desc
postindex.php
<?phpecho "hello index file";
?>
Comments
Post a Comment