Hello friend you can easily make a simple widget by the given format
You have only to give you condition query for the particular data to display from your data base or you can easily set it in your wp side bar by dra and drop .
Code given below is
<?php
/*
Plugin Name: Per Page Post
Plugin URI: http://dhanjalsolution.com/
Description: per page Post widget
Author: Vikas Gautam
Version: 2
Author URI: http://dhanjalsolution.com/
*/
function sampleeventcategory()
{
$page_name="index.php"; // If you use this code with a different page ( or file ) name then change this
$start=$_GET['start'];
if(strlen($start) > 0 and !is_numeric($start)){
echo "Data Error";
exit;
}
$eu = ($start - 0);
$limit = 2; // No of records to be shown per page.
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
$pname = $_REQUEST['event'];
/// here you have to give your query and show your date or call data from data base
And after that you have to put the code
function widget_myeventcategory($args) {
extract($args);
$options = get_option("widget_myeventcategory");
if (!is_array( $options ))
{
$options = array(
'title' => 'My Widget Title'
);
}
echo $before_widget;
echo $before_title;
echo $options['title'];
echo $after_title;
//Our Widget Content
sampleeventcategory();
echo $after_widget;
}
function myeventcategory_control()
{
$options = get_option("widget_myeventcategory");
if (!is_array( $options ))
{
$options = array(
'title' => 'My Widget Title'
);
}
if ($_POST['myeventcategory-Submit'])
{
$options['title'] = htmlspecialchars($_POST['myeventcategory-WidgetTitle']);
update_option("widget_myeventcategory", $options);
}
?>
<p>
<label for="myeventcategory-WidgetTitle">Widget Title: </label>
<input type="text" id="myeventcategory-WidgetTitle" name="myeventcategory-WidgetTitle" value="<?php echo $options['title'];?>" />
<input type="hidden" id="myeventcategory-Submit" name="myeventcategory-Submit" value="1" />
</p>
<?php
}
function myeventcategory_init()
{
register_sidebar_widget(__(' per page Post '), 'widget_myeventcategory');
register_widget_control( ' per page Post ', 'myeventcategory_control', 300, 200 );
}
add_action("plugins_loaded", "myeventcategory_init");
?>
$sq="DELETE tb_city,tb_citydetail,tb_hotel,tb_hotelprice,tb_nearhotel,tb_price,tb_tour,tb_weather,tb_package FROM tb_city LEFT JOIN tb_citydetail ON tb_city.id = tb_citydetail.Cityname
ReplyDeleteLEFT JOIN tb_hotel ON tb_city.id = tb_hotel.Cityname
LEFT JOIN tb_hotelprice ON tb_city.id = tb_hotelprice.Cityname
LEFT JOIN tb_nearhotel ON tb_city.id = tb_nearhotel.Cityname
LEFT JOIN tb_price ON tb_city.id = tb_price.Cityname
LEFT JOIN tb_tour ON tb_city.id = tb_tour.Cityname
LEFT JOIN tb_weather ON tb_city.id = tb_weather.Cityname
LEFT JOIN tb_package ON tb_city.id = tb_package.Cityname
WHERE tb_city.id = $id";