Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Customizing a widget... changing order of categories. WordPress

  • SOLVED

Firstly I apologize for people who read and answered my question earlier, I mixed up question so Im rewriting the question.

I bought a theme from www.templatic.com.
The theme is supposed to make an auto trader site but Im customizing it to be
Japanese customized automobile photo gallery.

The site is at" www.fnkyautobodykits.com " and is up.

My problem is that the widget "Manufacturers List" on the site is now set to be alphabetical order,
I want to make it in order of my control.

Ive been using MovableType but wordpress is very new to me...
Please help me I will provide any information if needed.

thanks before hand...

Johnnyquest.



*I found "widgets_functions.php" and posted below. Im assuming its the code for "Manufacturers List" but I'm not sure if its the right one. Please feel free to ask me for more code if needed. thx.


<?php

// Register widgetized areas
if ( function_exists('register_sidebar') ) {
register_sidebars(1,array('name' => 'Top Navigation','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Header Advt','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Main Navigation','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Front Page Banner','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Front Page Content','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Front Sidebar Left','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Front Sidebar Right','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Content Page Sidebar Left','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Content Page Right','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Vehicle Listing Page Sidebar Left','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Vehicle Listing Page Right','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Vehicle Detail Page Sidebar Left','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Blog Listing Page Sidebar Left','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Blog Listing Page Right','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Blog Detail Page Sidebar Left','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
register_sidebars(1,array('name' => 'Blog Detail Page Sidebar Right','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));
}

// Check for widgets in widget-ready areas http://wordpress.org/support/topic/190184?replies=7#post-808787
// Thanks to Chaos Kaizer http://blog.kaizeku.com/
function is_sidebar_active( $index = 1){
$sidebars = wp_get_sidebars_widgets();
$key = (string) 'sidebar-'.$index;

return (isset($sidebars[$key]));
}

// =============================== Newcar Widget (particular category) ======================================
class newcardeals extends WP_Widget {
function newcardeals() {
//Constructor
$widget_ops = array('classname' => 'widget Latest News', 'description' => 'List of New Car Deals' );
$this->WP_Widget('newcardeals', 'PT &rarr; New Car Deals', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$category = empty($instance['category']) ? '' : apply_filters('widget_category', $instance['category']);
$post_number = empty($instance['post_number']) ? '10' : apply_filters('widget_post_number', $instance['post_number']);
$post_link = empty($instance['post_link']) ? '' : apply_filters('widget_post_link', $instance['post_link']);
$character_cout = empty($instance['character_cout']) ? '15' : apply_filters('widget_character_cout', $instance['character_cout']);
?>
<h3> <?php echo $title; ?>
<?php if($post_link){echo $post_link;}?>
</h3>
<ul class="newcardeals">
<?php
global $post,$wpdb;

// $latest_menus = get_posts('numberposts='.$post_number.'postlink='.$post_link.'&category='.$category.'&post_type='.CUSTOM_POST_TYPE1);
if($category)
{
$sqlsql = "and p.ID in (select tr.object_id from $wpdb->term_relationships tr join $wpdb->term_taxonomy t on t.term_taxonomy_id=tr.term_taxonomy_id where t.term_id in ($category) )";
}
$sql = "select p.* from $wpdb->posts p where p.post_type='".CUSTOM_POST_TYPE1."' and p.post_status='publish' $sqlsql order by p.post_date desc,p.post_title asc limit $post_number";
$latest_menus = $wpdb->get_results($sql);

foreach($latest_menus as $post) :
setup_postdata($post);
?>
<?php $post_images = bdw_get_images($post->ID,'large');?>
<li class="clearfix" >
<?php
if(get_the_post_thumbnail( $post->ID, array())){?>
<a class="post_img" href="<?php the_permalink(); ?>">
<?php echo get_the_post_thumbnail( $post->ID, array(140,130),array('class' => "",));?>
</a>
<?php }else if($post_images[0]){ global $thumb_url;
$thumb_url1 = $thumb_url.get_image_cutting_edge($args);
?>
<a class="post_img" href="<?php the_permalink(); ?>">
<img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo $post_images[0];?>&amp;w=134&amp;h=100&amp;zc=1&amp;q=80<?php echo $thumb_url1;?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /> </a>
<?php
} else { ?>
<a href="<?php the_permalink(); ?>"> <span class="img_not_available"> <?php _e('Image Not Available ');?> </span> </a>
<?php }?>

<h3>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<span> <?php
if(get_post_meta($post->ID,'price',true)){
echo get_option('ptthemes_price_currency').get_post_meta($post->ID,'price',true);
}
?></span>
</h3>

<p class="highlight_text">
<?php
$carinfo = array();
if(get_post_meta($post->ID,'mileage',true)){
$carinfo[] = get_post_meta($post->ID,'mileage',true).' '.get_option('ptthemes_mileage_unit');
}
if(get_post_meta($post->ID,'urban_imperial',true)){
$carinfo[] = get_post_meta($post->ID,'urban_imperial',true);
}
if(get_post_meta($post->ID,'co2_emissions',true)){
$carinfo[] = get_post_meta($post->ID,'co2_emissions',true);
}
if(get_post_meta($post->ID,'color',true)){
$carinfo[] = get_post_meta($post->ID,'color',true);
}
if(get_post_meta($post->ID,'fuel',true)){
$carinfo[] = get_post_meta($post->ID,'fuel',true);
}
if($carinfo)
{
echo implode(' - ',$carinfo);
}
?>
</p>

<p><?php echo excerpt($character_cout); ?> </p>
<a href="<?php the_permalink(); ?>" class="b_viewdetails" > <?php _e('View Details');?> </a>
</li>
<?php endforeach; ?>
<?php
echo '</ul>';
echo $after_widget;
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['category'] = strip_tags($new_instance['category']);
$instance['post_number'] = strip_tags($new_instance['post_number']);
$instance['post_link'] = ($new_instance['post_link']);
$instance['character_cout'] = strip_tags($new_instance['character_cout']);
return $instance;

}

function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'category' => '', 'post_number' => '','character_cout' => '' ) );
$title = strip_tags($instance['title']);
$category = strip_tags($instance['category']);
$post_number = strip_tags($instance['post_number']);
$post_link = ($instance['post_link']);
$character_cout = strip_tags($instance['character_cout']);

?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:');?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Categories (IDs separated by commas):');?>
<input class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>" type="text" value="<?php echo attribute_escape($category); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts::');?>
<input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" name="<?php echo $this->get_field_name('post_number'); ?>" type="text" value="<?php echo attribute_escape($post_number); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('character_cout'); ?>"><?php _e('Post Content excerpt character count :');?>
<input class="widefat" id="<?php echo $this->get_field_id('character_cout'); ?>" name="<?php echo $this->get_field_name('character_cout'); ?>" type="text" value="<?php echo attribute_escape($character_cout); ?>" />
</label>
</p>

<p>
<label for="<?php echo $this->get_field_id('post_link'); ?>"><?php _e('View more Link. eg: &lt;a href="" class="more" &gt;View more&lt;/a&gt;.');?>
<textarea class="widefat" id="<?php echo $this->get_field_id('post_link'); ?>" name="<?php echo $this->get_field_name('post_link'); ?>"><?php echo attribute_escape($post_link); ?></textarea>
</label>
</p>
<?php
}

}

register_widget('newcardeals');



// =============================== Feedburner Subscribe widget ======================================
class subscribeWidget extends WP_Widget {
function subscribeWidget() {
//Constructor
$widget_ops = array('classname' => 'widget Subscribe', 'description' => 'Subscribe' );
$this->WP_Widget('widget_subscribeWidget', 'PT &rarr; Subscribe', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
?>

<div class="widget" >

<?php if ( $title <> "" ) { ?>
<h3><?php echo $title; ?></h3>
<?php } ?>

<?php if ( $text <> "" ) { ?>
<?php echo $text; ?>
<?php } ?>

<form class="subscribe_form" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $id; ?>', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
<input type="text" class="field" onblur="if (this.value == '') {this.value = 'Enter your email address';}" onfocus="if (this.value == '<?php _e('Enter your email address');?>') {this.value = '';}" value="<?php _e('Enter your email address');?>" name="email" />

<input type="hidden" value="<?php echo $id; ?>" name="uri"/><input type="hidden" name="loc" value="en_US"/>
<input class="btn_submit" type="submit" name="submit" value="<?php _e('');?>" />
</form>
</div>


<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['id'] = strip_tags($new_instance['id']);
$instance['title'] = ($new_instance['title']);
$instance['text'] = ($new_instance['text']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '','text' => '') );
$id = strip_tags($instance['id']);
$title = strip_tags($instance['title']);
$text = ($instance['text']);

?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo attribute_escape($title); ?>"></label></p>
<p><label for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description');?> <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo attribute_escape($text); ?></textarea></label></p>

<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID: (example:- templatic)');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('id'); ?>" name="<?php echo $this->get_field_name('id'); ?>" value="<?php echo attribute_escape($id); ?>"></label></p>

<?php
}}
register_widget('subscribeWidget');



// =============================== socialmedia widget ======================================
class socialmedia extends WP_Widget {
function socialmedia() {
//Constructor
$widget_ops = array('classname' => 'widget Bookmark Link', 'description' => 'Displays links to Social Media Sites' );
$this->WP_Widget('widget_socialmedia', 'PT &rarr; Social Media Links', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
$twitter = empty($instance['twitter']) ? '' : apply_filters('widget_twitter', $instance['twitter']);
$facebook = empty($instance['facebook']) ? '' : apply_filters('widget_facebook', $instance['facebook']);
$digg = empty($instance['digg']) ? '' : apply_filters('widget_digg', $instance['digg']);
$myspace = empty($instance['myspace']) ? '' : apply_filters('widget_myspace', $instance['myspace']);
$rss = empty($instance['rss']) ? '' : apply_filters('widget_rss', $instance['rss']);
?>




<div class="bookmark">
<?php if ( $title <> "" ) { ?>
<h3><?php echo $title; ?></h3>
<?php } ?>

<?php if ( $twitter <> "" ) { ?>
<a href="<?php echo $twitter; ?>"><img src="<?php bloginfo('template_directory'); ?>/images/i_twitter.png" alt="" /></a>
<?php } ?>

<?php if ( $facebook <> "" ) { ?>
<a href="<?php echo $facebook; ?>"><img src="<?php bloginfo('template_directory'); ?>/images/i_facebook.png" alt="" /></a>
<?php } ?>

<?php if ( $digg <> "" ) { ?>
<a href="<?php echo $digg; ?>"><img src="<?php bloginfo('template_directory'); ?>/images/i_digg.png" alt="" /></a>
<?php } ?>

<?php if ( $myspace <> "" ) { ?>
<a href="<?php echo $myspace; ?>"><img src="<?php bloginfo('template_directory'); ?>/images/i_myspace.png" alt="" /></a>
<?php } ?>

<?php if ( $id <> "" ) { ?>
<a href="http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $id; ?>"><img src="<?php bloginfo('template_directory'); ?>/images/i_rss.png" alt="" /></a>
<?php } ?>

</div>
<!-- social_media #end -->




<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['id'] = strip_tags($new_instance['id']);
$instance['title'] = ($new_instance['title']);
$instance['text'] = ($new_instance['text']);
$instance['twitter'] = ($new_instance['twitter']);
$instance['facebook'] = ($new_instance['facebook']);
$instance['digg'] = ($new_instance['digg']);
$instance['myspace'] = ($new_instance['myspace']);

return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'advt1' => '','text' => '','twitter' => '','facebook' => '','digg' => '','myspace' => '' ) );
$id = strip_tags($instance['id']);
$title = strip_tags($instance['title']);
$text = strip_tags($instance['text']);
$twitter = strip_tags($instance['twitter']);
$facebook = strip_tags($instance['facebook']);
$digg = strip_tags($instance['digg']);
$myspace = strip_tags($instance['myspace']);

?>

<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID: (example:- templatic)');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('id'); ?>" name="<?php echo $this->get_field_name('id'); ?>" value="<?php echo attribute_escape($id); ?>"></label></p>

<p><label for="<?php echo $this->get_field_id('twitter'); ?>"><?php _e('Twitter Full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('twitter'); ?>" name="<?php echo $this->get_field_name('twitter'); ?>" value="<?php echo attribute_escape($twitter); ?>"></label></p>
<p><label for="<?php echo $this->get_field_id('facebook'); ?>"><?php _e('Facebook Full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('facebook'); ?>" name="<?php echo $this->get_field_name('facebook'); ?>" value="<?php echo attribute_escape($facebook); ?>"></label></p>
<p><label for="<?php echo $this->get_field_id('myspace'); ?>"><?php _e('Myspace Full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('myspace'); ?>" name="<?php echo $this->get_field_name('myspace'); ?>" value="<?php echo attribute_escape($myspace); ?>"></label></p>

<?php
}}
register_widget('socialmedia');


// =============================== sidebar search ======================================
class SearchCar extends WP_Widget {
function SearchCar() {
//Constructor
$widget_ops = array('classname' => 'widget sidebar Find a Car', 'description' => 'Find a Car' );
$this->WP_Widget('SearchCar', 'PT &rarr; Find Car', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
$desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
?>
<form method="get" id="srch_frm" name="srch_frm" action="<?php echo get_option('siteurl');?>/">
<input type="hidden" id="s" name="s" value="search" />
<div class="search_sidebar">
<h3><?php echo $title; ?></h3>
<label>
<select name="srchmake" id="srchmake_id" onchange="set_models(this.value,'<?php echo $_REQUEST['srchmodels']?>');">
<option value=""><?php _e('All Make');?></option>
<?php get_make_dl_fun($_REQUEST['srchmake']);?>
</select>
<span id="get_model_ajax_indicator"></span>
</label>

<label>
<span id="srchmodels_span_id">
<select name="srchmodels" id="srchmodels_id">
<option value=""><?php _e('All Models');?></option>
</select>
</span>
</label>
<?php $currency = get_option('ptthemes_price_currency');?>
<label>
<select name="srchminprice" id="srchminprice">
<option value=""><?php _e('Min Price (in '.$currency.')');?></option>
<?php search_price_dl_fun($_REQUEST['srchminprice'])?>
</select>
</label>

<label>
<select name="srchmaxprice" id="srchmaxprice">
<option value=""><?php _e('Max Price (in '.$currency.')');?></option>
<?php search_price_dl_fun($_REQUEST['srchmaxprice'])?>
</select>
</label>

<label>
<select name="srchtype" id="srchtype">
<option value=""><?php _e('All Type');?></option>
<?php fuel_type_dl_fun($_REQUEST['srchtype']);?>
</select>
</label>
<input name="search" type="submit" class="b_searchcar" value="Search" />
</div> <!--search car #end -->
</form>
<script type="text/javascript">
var SITE_URL_PATH = '<?php echo site_url();?>'
</script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/js_functions.js"></script>
<script type="text/javascript">
if(eval(document.getElementById('srchmake_id')))
{
if(document.getElementById('srchmake_id').value)
{
set_models(document.getElementById('srchmake_id').value,'<?php echo $_REQUEST['srchmodels']?>');
}
}
</script>
<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['desc1'] = ($new_instance['desc1']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '' ) );
$title = strip_tags($instance['title']);
$desc1 = ($instance['desc1']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:');?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>


<?php
}}
register_widget('SearchCar');



// =============================== sidebar Car Models ======================================
class AllModels extends WP_Widget {
function AllModels() {
//Constructor
$widget_ops = array('classname' => 'widget sidebar All Car Models', 'description' => 'All Car Models' );
$this->WP_Widget('AllModels', 'PT &rarr; All Car Models', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
$desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
?>

<div class="widget">
<h3><?php echo $title; ?></h3>
<?php
global $wpdb;
$catinfo = $wpdb->get_col("select t.term_id from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"".CUSTOM_CATEGORY_TYPE1."\" and tt.parent=0 order by t.name");
?>



<ul>
<?php
if($catinfo)
{
$child_ids = implode(',',$catinfo);
if($child_ids)
{
$child_catinfo = $wpdb->get_results("select * from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"".CUSTOM_CATEGORY_TYPE1."\" and tt.parent in ($child_ids) order by t.name");
foreach($child_catinfo as $child_catinfo_obj)
{
?>
<li><a href="<?php echo get_term_link( $child_catinfo_obj, CUSTOM_CATEGORY_TYPE1 ) ;?>"><?php echo $child_catinfo_obj->name;?></a></li>
<?php
}
}
}
?>
</ul>


</div> <!-- #end -->

<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['desc1'] = ($new_instance['desc1']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '' ) );
$title = strip_tags($instance['title']);
$desc1 = ($instance['desc1']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:');?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>


<?php
}}
register_widget('AllModels');


// =============================== sidebar Top 5 or Featured Cars ======================================
class top5cars extends WP_Widget {
function top5cars() {
//Constructor
$widget_ops = array('classname' => 'widget sidebar Top 5 Cars', 'description' => 'Displays featured cars' );
$this->WP_Widget('top5cars', 'PT &rarr; Featured Cars', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
$number = empty($instance['number']) ? '5' : apply_filters('number', $instance['number']);
?>

<div class="widget">
<h3><?php echo $title; ?></h3>
<?php
global $wpdb;
$subsql = " and ID in (select post_id from $wpdb->postmeta where meta_key like 'is_featured' and meta_value like 'on')";
$sql = "select * from $wpdb->posts where post_type='".CUSTOM_POST_TYPE1."' and post_status = 'publish' $subsql order by post_date desc limit $number";
$res = $wpdb->get_results($sql);
if($res){
?>
<ul>
<?php foreach($res as $res_obj){?>
<li><a href="<?php echo get_permalink($res_obj->ID);?>"><?php echo get_the_title($res_obj->ID)?></a></li>
<?php }?>
</ul>
<?php }?>

</div> <!-- #end -->

<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['number'] = ($new_instance['number']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'number' => '5' ) );
$title = strip_tags($instance['title']);
$number = ($instance['number']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:');?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of records to be displayed :');?> <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo attribute_escape($number); ?>" /></label></p>


<?php
}}
register_widget('top5cars');


// =============================== sidebar New Cars by Manufactures ======================================
class Manufactures extends WP_Widget {
function Manufactures() {
//Constructor
$widget_ops = array('classname' => 'widget sidebar New Cars by Manufactures', 'description' => 'Manufacturers List with car count - Home Page' );
$this->WP_Widget('Manufactures', 'PT &rarr; Manufacturers List - Home Page', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
$desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
?>

<div class="widget">
<h3><?php echo $title; ?></h3>

<?php
global $wpdb;
$catinfo = get_make_info_fun();
if($catinfo)
{
?>

<ul class="manufactures_by">
<?php foreach($catinfo as $catinfo_obj){?>
<li><a href="<?php echo get_term_link( $catinfo_obj->slug, 'make' ) ;?>"><?php echo $catinfo_obj->name;?></a> <?php /*?>(<?php echo $catinfo_obj->pcount;?>)<?php */?></li>
<?php } ?>
</ul>

<?php }?>
</div> <!-- #end -->

<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['desc1'] = ($new_instance['desc1']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '' ) );
$title = strip_tags($instance['title']);
$desc1 = ($instance['desc1']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:');?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>


<?php
}}
register_widget('Manufactures');



// =============================== single advt section ======================================
class singleadvt extends WP_Widget {
function singleadvt() {
//Constructor
$widget_ops = array('classname' => 'widget sidebar advt section', 'description' => 'Sidebar google ads & advertisement code here' );
$this->WP_Widget('singleadvt', 'PT &rarr; Advertise', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
$desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
?>

<?php /*?><h3><?php echo $title; ?> </h3><?php */?>

<div class="advt_single">
<?php if ( $desc1 <> "" ) { ?>
<?php echo $desc1; ?>
<?php } ?>
</div>



<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['desc1'] = ($new_instance['desc1']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '' ) );
$title = strip_tags($instance['title']);
$desc1 = ($instance['desc1']);
?>
<p><label for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your advt code : (ex.google ads & sample ex. html code here -&gt; &lt;a href="http://templatic.com" &gt;&lt;img src="http://templatic.com/banner.png" alt="" /&gt; &lt;/a&gt;)');?> <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>" name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo attribute_escape($desc1); ?></textarea></label></p>

<?php
}}
register_widget('singleadvt');


// =============================== advertise header & call us text ======================================
class headeradvt extends WP_Widget {
function headeradvt() {
//Constructor
$widget_ops = array('classname' => 'widget Advertise', 'description' => 'Header top advertise, google ads & call us text' );
$this->WP_Widget('headeradvt', 'PT &rarr; Advertise & Call Us text', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
$advt1 = empty($instance['advt1']) ? '&nbsp;' : apply_filters('widget_advt1', $instance['advt1']);
$call = empty($instance['call']) ? '&nbsp;' : apply_filters('widget_call', $instance['call']);
?>


<?php if ( $advt1 <> "" ) { ?>
<div class="header_banner">
<?php echo $advt1; ?>
</div>
<?php } ?>


<?php if ( $call <> "" ) { ?>
<div class="callnow">
<?php echo $call; ?>

</div>
<?php } ?>

<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['advt1'] = ($new_instance['advt1']);
$instance['call'] = ($new_instance['call']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'advt1' => '', 'call' => '') );
$title = strip_tags($instance['title']);
$advt1 = ($instance['advt1']);
$call = ($instance['call']);
?>

<p><label for="<?php echo $this->get_field_id('advt1'); ?>"><?php _e('Advt (ex.google ads & sample ex. html code here -&gt; &lt;a href="http://templatic.com" &gt;&lt;img src="http://templatic.com/banner.png" alt="" /&gt; &lt;/a&gt; )');?><textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('advt1'); ?>" name="<?php echo $this->get_field_name('advt1'); ?>"><?php echo attribute_escape($advt1); ?></textarea></label></p>
<p><label for="<?php echo $this->get_field_id('call'); ?>"><?php _e('Call Us text : (sample ex. html code here -&gt; &lt;span&gt;Call Us&lt;/span&gt;&lt;br /&gt;999 999 9999 )');?>
<textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('call'); ?>" name="<?php echo $this->get_field_name('call'); ?>"><?php echo attribute_escape($call); ?></textarea></label></p>
<?php
}}
register_widget('headeradvt');


// =============================== Flickr widget ======================================

class flickrWidget extends WP_Widget {
function flickrWidget() {
//Constructor
$widget_ops = array('classname' => 'widget Flickr Photos ', 'description' => 'Flickr Photos' );
$this->WP_Widget('widget_flickrwidget', 'PT &rarr; Flickr Photos', $widget_ops);
}

function widget($args, $instance) {
// prints the widget

extract($args, EXTR_SKIP);
echo $before_widget;
$id = empty($instance['id']) ? '&nbsp;' : apply_filters('widget_id', $instance['id']);
$number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);

?>

<h3 ><span>Photo Gallery</span> </h3>
<div class="flickr clearfix">

<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=<?php echo $number; ?>&amp;display=latest&amp;size=s&amp;layout=x&amp;source=user&amp;user=<?php echo $id; ?>"></script>

</div>
</div>

<?php
}

function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['id'] = strip_tags($new_instance['id']);
$instance['number'] = strip_tags($new_instance['number']);
return $instance;

}

function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array('title' => '', 'id' => '', 'number' => '') );
$id = strip_tags($instance['id']);
$number = strip_tags($instance['number']);
?>

<p>
<label for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID (<a href="http://www.idgettr.com">idGettr</a>):');?>
<input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" name="<?php echo $this->get_field_name('id'); ?>" type="text" value="<?php echo attribute_escape($id); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:');?>
<input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo attribute_escape($number); ?>" />
</label>
</p>
<?php
}

}

register_widget('flickrWidget');


// =============================== Popular Posts Widget ======================================

function PopularPostsSidebar()
{

$settings_pop = get_option("widget_popularposts");

$name = $settings_pop['name'];
$number = $settings_pop['number'];
if ($name <> "") { $popname = $name; } else { $popname = 'Popular Posts'; }
if ($number <> "") { $popnumber = $number; } else { $popnumber = '10'; }

?>

<div class="widget">
<h3 class="popular" ><?php echo $popname; ?></h3>

<ul id="recentcomments">
<?php
global $wpdb;
$now = gmdate("Y-m-d H:i:s",time());
$lastmonth = gmdate("Y-m-d H:i:s",gmmktime(date("H"), date("i"), date("s"), date("m")-12,date("d"),date("Y")));
$popularposts = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'stammy' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' AND post_date < '$now' AND post_date > '$lastmonth' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT $popnumber";
$posts = $wpdb->get_results($popularposts);
$popular = '';
if($posts){
foreach($posts as $post){
$post_title = stripslashes($post->post_title);
$guid = get_permalink($post->ID);

$first_post_title=substr($post_title,0,26);
?>
<?php $post_images = bdw_get_images($post->ID,'large');?>

<li class="clearfix">
<a href="<?php echo $guid; ?>" title="<?php echo $post_title; ?>"><?php echo $post_title; ?></a>
</li>
<?php } } ?>

</ul>

</div>

<?php
}
function PopularPostsAdmin() {

$settings_pop = get_option("widget_popularposts");

// check if anything's been sent
if (isset($_POST['update_popular'])) {
$settings_pop['name'] = strip_tags(stripslashes($_POST['popular_name']));
$settings_pop['number'] = strip_tags(stripslashes($_POST['popular_number']));

update_option("widget_popularposts",$settings_pop);
}

echo '<p>
<label for="popular_name">Title:
<input id="popular_name" name="popular_name" type="text" class="widefat" value="'.$settings_pop['name'].'" /></label></p>';
echo '<p>
<label for="popular_number">Number of popular posts:
<input id="popular_number" name="popular_number" type="text" class="widefat" value="'.$settings_pop['number'].'" /></label></p>';
echo '<input type="hidden" id="update_popular" name="update_popular" value="1" />';

}

register_sidebar_widget('PT &rarr; Popular Posts', 'PopularPostsSidebar');
register_widget_control('PT &rarr; Popular Posts', 'PopularPostsAdmin', 250, 200);






// =============================== Twitter widget ======================================
// Plugin Name: Twitter Widget
// Plugin URI: http://seanys.com/2007/10/12/twitter-wordpress-widget/
// Description: Adds a sidebar widget to display Twitter updates (uses the Javascript <a href="http://twitter.com/badges/which_badge">Twitter 'badge'</a>)
// Version: 1.0.3
// Author: Sean Spalding
// Author URI: http://seanys.com/
// License: GPL
class twitter extends WP_Widget {
function twitter() {
//Constructor
$widget_ops = array('classname' => 'Twitter', 'description' => 'Twitter' );
$this->WP_Widget('widget_Twidget', 'PT &rarr; Twitter', $widget_ops);
}

function widget($args, $instance) {
// prints the widget

extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
$account = empty($instance['account']) ? '&nbsp;' : apply_filters('widget_account', $instance['account']);
$show = empty($instance['show']) ? '&nbsp;' : apply_filters('widget_show', $instance['show']);
$follow = empty($instance['follow']) ? '&nbsp;' : apply_filters('widget_follow', $instance['follow']);

// Output
//echo $before_widget ;

// start
echo '<div id="twitter"> <h3>'.$title.'</h3>';
echo '<ul id="twitter_update_list"><li></li></ul>
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>';
echo '<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/'.$account.'.json?callback=twitterCallback2&amp;count='.$show.'"></script>';
echo '<p><a href="http://www.twitter.com/'.$account.'/" title="'.$follow.'">Follow us Now </a></p></div>';


// echo widget closing tag
echo $after_widget;
}

function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['account'] = strip_tags($new_instance['account']);
$instance['follow'] = strip_tags($new_instance['follow']);
$instance['show'] = strip_tags($new_instance['show']);
return $instance;
}

function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array('account'=>'rbhavesh', 'title'=>'Twitter Updates', 'show'=>'3' ) );
$title = strip_tags($instance['title']);
$show = strip_tags($instance['show']);
$follow = strip_tags($instance['follow']);
$account = strip_tags($instance['account']);
?>
<p>
<label for="<?php echo $this->get_field_id('account'); ?>"><?php _e('Twitter Account ID')?>:
<input class="widefat" id="<?php echo $this->get_field_id('account'); ?>" name="<?php echo $this->get_field_name('account'); ?>" type="text" value="<?php echo attribute_escape($account); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title')?>:
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
</label>
</p>

<p>
<label for="<?php echo $this->get_field_id('show'); ?>"><?php _e('Show Twitter Posts')?>:
<input class="widefat" id="<?php echo $this->get_field_id('show'); ?>" name="<?php echo $this->get_field_name('show'); ?>" type="text" value="<?php echo attribute_escape($show); ?>" />
</label>
</p>

<?php
}

}

register_widget('twitter');


// =============================== Home Page Banner Widget ======================================

class homebannerwidget extends WP_Widget {
function homebannerwidget() {
//Constructor
$widget_ops = array('classname' => 'widget Home Banner', 'description' => 'Home banner with slider' );
$this->WP_Widget('widget_homebannerwidget', 'PT &rarr; Home Banner', $widget_ops);
}
function widget($args, $instance) {
// prints the widget
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$actionbtn = empty($instance['actionbtn']) ? '' : apply_filters('widget_actionbtn', $instance['actionbtn']);
$actionlink = empty($instance['actionlink']) ? '' : apply_filters('widget_actionlink', $instance['actionlink']);
$s1 = empty($instance['s1']) ? '' : apply_filters('widget_s1', $instance['s1']);
$s1link = empty($instance['s1link']) ? '' : apply_filters('widget_s1', $instance['s1link']);
$s2 = empty($instance['s2']) ? '' : apply_filters('widget_s2', $instance['s2']);
$s2link = empty($instance['s2link']) ? '' : apply_filters('widget_s2link', $instance['s2link']);
$s3 = empty($instance['s3']) ? '' : apply_filters('widget_s3', $instance['s3']);
$s3link = empty($instance['s3link']) ? '' : apply_filters('widget_s3link', $instance['s3link']);
$s4 = empty($instance['s4']) ? '' : apply_filters('widget_s4', $instance['s4']);
$s4link = empty($instance['s4link']) ? '' : apply_filters('widget_s4link', $instance['s4link']);
$s5 = empty($instance['s5']) ? '' : apply_filters('widget_s5', $instance['s5']);
$s5link = empty($instance['s5link']) ? '' : apply_filters('widget_s5link', $instance['s5link']);
$s6 = empty($instance['s6']) ? '' : apply_filters('widget_s6', $instance['s6']);
$s6link = empty($instance['s6link']) ? '' : apply_filters('widget_s6link', $instance['s6link']);
$s7 = empty($instance['s7']) ? '' : apply_filters('widget_s7', $instance['s7']);
$s7link = empty($instance['s7link']) ? '' : apply_filters('widget_s7link', $instance['s7link']);
$s8 = empty($instance['s8']) ? '' : apply_filters('widget_s8', $instance['s8']);
$s8link = empty($instance['s8link']) ? '' : apply_filters('widget_s8link', $instance['s8link']);
$s9 = empty($instance['s9']) ? '' : apply_filters('widget_s9', $instance['s9']);
$s9link = empty($instance['s9link']) ? '' : apply_filters('widget_s9link', $instance['s9link']);
$s10 = empty($instance['s10']) ? '' : apply_filters('widget_s10', $instance['s10']);
$s10link = empty($instance['s10link']) ? '' : apply_filters('widget_s10link', $instance['s10link']);

$effect = empty($instance['effect']) ? 'random' : apply_filters('widget_effect', $instance['effect']);
$slices = empty($instance['slices']) ? '15' : apply_filters('widget_slices', $instance['slices']);
$animSpeed = empty($instance['animSpeed']) ? '700' : apply_filters('widget_animSpeed', $instance['animSpeed']);
$pauseTime = empty($instance['pauseTime']) ? '3000' : apply_filters('widget_pauseTime', $instance['pauseTime']);
$startSlide = empty($instance['startSlide']) ? '' : apply_filters('widget_startSlide', $instance['startSlide']);
$directionNavHide = empty($instance['directionNavHide']) ? '' : apply_filters('widget_directionNavHide', $instance['directionNavHide']);
$slider_img = empty($instance['slider_img']) ? 'No' : apply_filters('widget_slider_img', $instance['slider_img']);

$slider_img_width = empty($instance['slider_img_width']) ? '716' : apply_filters('widget_slider_img_width', $instance['slider_img_width']);
$slider_img_height = empty($instance['slider_img_height']) ? '430' : apply_filters('widget_slider_img_height', $instance['slider_img_height']);
?>

<script type="text/javascript" language="javascript">
$(window).load(function() {
$('#slider').nivoSlider({
effect:'<?php if (($effect) <> "" ) { echo (($effect)); } else { echo 'random'; } ?>', //Specify sets like: 'random,fold,fade,sliceDown'
slices:<?php if (($slices) <> "" ) { echo (($slices)); } else { echo '15'; } ?>,
animSpeed:<?php if (($animspeed) <> "" ) { echo (($animspeed)); } else { echo '700'; } ?>,
pauseTime:<?php if (($pauseTime) <> "" ) { echo (($pauseTime)); } else { echo '3000'; } ?>,
startSlide:0, //Set starting Slide (0 index)
directionNav:true, //Next and Prev
directionNavHide:<?php if (($directionNavHide) <> "" ) { echo stripslashes(($fadin)); } else { echo 'false'; } ?>, //Only show on hover
controlNav:true, //1,2,3...
controlNavThumbs:false, //Use thumbnails for Control Nav
controlNavThumbsFromRel:false, //Use image rel for thumbs
controlNavThumbsSearch: '.jpg', //Replace this with...
controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
keyboardNav:true, //Use left and right arrows
pauseOnHover:true, //Stop animation while hovering
manualAdvance:false, //Force manual transitions
captionOpacity:0.8, //Universal caption opacity
beforeChange: function(){},
afterChange: function(){},
slideshowEnd: function(){} //Triggers after all slides have been shown
});
});
</script>

<div id="banner">
<div id="slider" >

<?php if ( $s1 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s1link; ?>"><img src="<?php echo $s1; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s2 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s2link; ?>"><img src="<?php echo $s2; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s3 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s3link; ?>"><img src="<?php echo $s3; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s4 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s4link; ?>"><img src="<?php echo $s4; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s5 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s5link; ?>"><img src="<?php echo $s5; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s6 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s6link; ?>"><img src="<?php echo $s6; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s7 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s7link; ?>"><img src="<?php echo $s7; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s8 <> "" ) { ?>
<a class="nivo-imageLink" href="<?php echo $s8link; ?>"><img src="<?php echo $s8; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s9 <> "" ) { ?>
<a style="display:block;" class="nivo-imageLink" href="<?php echo $s9link; ?>"><img src="<?php echo $s9; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>

<?php if ( $s10 <> "" ) { ?>
<a style="display:block;" class="nivo-imageLink" href="<?php echo $s10link; ?>"><img src="<?php echo $s10; ?>" alt="" width="<?php echo $slider_img_width; ?>"
height="<?php echo $slider_img_height; ?>" /></a>
<?php } ?>
</div>
</div>



<?php
}
function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['desc'] = ($new_instance['desc']);
$instance['actionbtn'] = ($new_instance['actionbtn']);
$instance['slider_img_width'] = ($new_instance['slider_img_width']);
$instance['slider_img_height'] = ($new_instance['slider_img_height']);
$instance['actionlink'] = ($new_instance['actionlink']);
$instance['s1'] = ($new_instance['s1']);
$instance['s1link'] = ($new_instance['s1link']);
$instance['s2'] = ($new_instance['s2']);
$instance['s2link'] = ($new_instance['s2link']);
$instance['s3'] = ($new_instance['s3']);
$instance['s3link'] = ($new_instance['s3link']);
$instance['s4'] = ($new_instance['s4']);
$instance['s4link'] = ($new_instance['s4link']);
$instance['s5'] = ($new_instance['s5']);
$instance['s5link'] = ($new_instance['s5link']);
$instance['s6'] = ($new_instance['s6']);
$instance['s6link'] = ($new_instance['s6link']);
$instance['s7'] = ($new_instance['s7']);
$instance['s7link'] = ($new_instance['s7link']);
$instance['s8'] = ($new_instance['s8']);
$instance['s8link'] = ($new_instance['s8link']);
$instance['s9'] = ($new_instance['s9']);
$instance['s9link'] = ($new_instance['s9link']);
$instance['s10'] = ($new_instance['s10']);
$instance['s10link'] = ($new_instance['s10link']);

$instance['effect'] = ($new_instance['effect']);
$instance['slices'] = ($new_instance['slices']);
$instance['animSpeed'] = ($new_instance['animSpeed']);
$instance['pauseTime'] = ($new_instance['pauseTime']);
$instance['startSlide'] = ($new_instance['startSlide']);
$instance['directionNavHide'] = ($new_instance['directionNavHide']);
$instance['slider_img'] = ($new_instance['slider_img']);
return $instance;
}
function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'desc' => '','actionbtn' => '','actionlink' => '','s1' => '','s2' => '','s3' => '','s4' => '','s5' => '','s6' => '','s7' => '','s8' => '','s9' => '','s10' => '','s1link' => '','s2link' => '','s3link' => '','s4link' => '','s5link' => '','s6link' => '','s7link' => '','s8link' => '','s9link' => '','s10link' => '', 'effect' => '','slices' => '','animSpeed' => '','pauseTime' => '','startSlide' => '','directionNavHide' => '', 'slider_img' => '', 'slider_img_width' => '', 'slider_img_height' => '' ) );
$title = strip_tags($instance['title']);
$desc = ($instance['desc']);
$slider_img_width = ($instance['slider_img_width']);
$slider_img_height = ($instance['slider_img_height']);
$s1 = ($instance['s1']);
$s1link = ($instance['s1link']);
$s2 = ($instance['s2']);
$s2link = ($instance['s2link']);
$s3 = ($instance['s3']);
$s3link = ($instance['s3link']);
$s4 = ($instance['s4']);
$s4link = ($instance['s4link']);
$s5 = ($instance['s5']);
$s5link = ($instance['s5link']);
$s6 = ($instance['s6']);
$s6link = ($instance['s6link']);
$s7 = ($instance['s7']);
$s7link = ($instance['s7link']);
$s8 = ($instance['s8']);
$s8link = ($instance['s8link']);
$s9 = ($instance['s9']);
$s9link = ($instance['s9link']);
$s10 = ($instance['s9']);
$s10link = ($instance['s10link']);

$effect = ($instance['effect']);
$slices = ($instance['slices']);
$animSpeed = ($instance['animSpeed']);
$pauseTime = ($instance['pauseTime']);
$startSlide = ($instance['startSlide']);
$directionNavHide = ($instance['directionNavHide']);
$slider_img = ($instance['slider_img']);
?>


<p><label for="<?php echo $this->get_field_id('slider_img_width'); ?>"><?php _e('Banner Images Width ( maximum slider image width 716 px):');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('slider_img_width'); ?>" name="<?php echo $this->get_field_name('slider_img_width'); ?>" value="<?php echo attribute_escape($slider_img_width); ?>"></label>
</p>

<p><label for="<?php echo $this->get_field_id('slider_img_height'); ?>"><?php _e('Banner Images Height ( minimum slider image height 150px)');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('slider_img_height'); ?>" name="<?php echo $this->get_field_name('slider_img_height'); ?>" value="<?php echo attribute_escape($slider_img_height); ?>"></label>
</p>


<p><label for="<?php echo $this->get_field_id('slices'); ?>"><?php _e('Banner Images slices (slider images slice effect):');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('slices'); ?>" name="<?php echo $this->get_field_name('slices'); ?>" value="<?php echo attribute_escape($slices); ?>"></label>
</p>

<p><label for="<?php echo $this->get_field_id('animSpeed'); ?>"><?php _e('Banner Slider image in time :');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('animSpeed'); ?>" name="<?php echo $this->get_field_name('animSpeed'); ?>" value="<?php echo attribute_escape($animSpeed); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('pauseTime'); ?>"><?php _e('Banner Slider image out time :');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('pauseTime'); ?>" name="<?php echo $this->get_field_name('pauseTime'); ?>" value="<?php echo attribute_escape($pauseTime); ?>"></label>
</p>


<p><label for="<?php echo $this->get_field_id('s1'); ?>"><?php _e('Banner Slider Image 1 full URL (size : w754xh430 pixel) (ex.http://templatic.com/images/banner1.png) : ');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s1'); ?>" name="<?php echo $this->get_field_name('s1'); ?>" value="<?php echo attribute_escape($s1); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s1link'); ?>"><?php _e('Banner Slider Image 1 Link (ex.http://templatic.com) :');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s1link'); ?>" name="<?php echo $this->get_field_name('s1link'); ?>" value="<?php echo attribute_escape($s1link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s2'); ?>"><?php _e('Banner Slider Image 2 full URL :');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s2'); ?>" name="<?php echo $this->get_field_name('s2'); ?>" value="<?php echo attribute_escape($s2); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s2link'); ?>"><?php _e('Banner Slider Image 2 Link :');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s2link'); ?>" name="<?php echo $this->get_field_name('s2link'); ?>" value="<?php echo attribute_escape($s2link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s3'); ?>"><?php _e('Banner Slider Image 3 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s3'); ?>" name="<?php echo $this->get_field_name('s3'); ?>" value="<?php echo attribute_escape($s3); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s3link'); ?>"><?php _e('Banner Slider Image 3 Link ');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s3link'); ?>" name="<?php echo $this->get_field_name('s3link'); ?>" value="<?php echo attribute_escape($s3link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s4'); ?>"><?php _e('Banner Slider Image 4 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s4'); ?>" name="<?php echo $this->get_field_name('s4'); ?>" value="<?php echo attribute_escape($s4); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s4link'); ?>"><?php _e('Banner Slider Image 4 Link');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s4link'); ?>" name="<?php echo $this->get_field_name('s4link'); ?>" value="<?php echo attribute_escape($s4link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s5'); ?>"><?php _e('Banner Slider Image 5 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s5'); ?>" name="<?php echo $this->get_field_name('s5'); ?>" value="<?php echo attribute_escape($s5); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s5link'); ?>"><?php _e('Banner Slider Image 5 Link');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s5link'); ?>" name="<?php echo $this->get_field_name('s5link'); ?>" value="<?php echo attribute_escape($s5link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s6'); ?>"><?php _e('Banner Slider Image 6 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s6'); ?>" name="<?php echo $this->get_field_name('s6'); ?>" value="<?php echo attribute_escape($s6); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s6link'); ?>"><?php _e('Banner Slider Image 6 Link');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s6link'); ?>" name="<?php echo $this->get_field_name('s6link'); ?>" value="<?php echo attribute_escape($s6link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s7'); ?>"><?php _e('Banner Slider Image 7 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s7'); ?>" name="<?php echo $this->get_field_name('s7'); ?>" value="<?php echo attribute_escape($s7); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s7link'); ?>"><?php _e('Banner Slider Image 7 Link');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s7link'); ?>" name="<?php echo $this->get_field_name('s7link'); ?>" value="<?php echo attribute_escape($s7link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s8'); ?>"><?php _e('Banner Slider Image 8 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s8'); ?>" name="<?php echo $this->get_field_name('s8'); ?>" value="<?php echo attribute_escape($s8); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s8link'); ?>"><?php _e('Banner Slider Image 8 Link');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s8link'); ?>" name="<?php echo $this->get_field_name('s8link'); ?>" value="<?php echo attribute_escape($s8link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s9'); ?>"><?php _e('Banner Slider Image 9 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s9'); ?>" name="<?php echo $this->get_field_name('s9'); ?>" value="<?php echo attribute_escape($s9); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s9link'); ?>"><?php _e('Banner Slider Image 9 Link');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s9link'); ?>" name="<?php echo $this->get_field_name('s9link'); ?>" value="<?php echo attribute_escape($s9link); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s10'); ?>"><?php _e('Banner Slider Image 10 full URL');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s10'); ?>" name="<?php echo $this->get_field_name('s10'); ?>" value="<?php echo attribute_escape($s10); ?>"></label>
</p>
<p><label for="<?php echo $this->get_field_id('s10link'); ?>"><?php _e('Banner Slider Image 10 Link');?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('s10link'); ?>" name="<?php echo $this->get_field_name('s10link'); ?>" value="<?php echo attribute_escape($s10link); ?>"></label>
</p>
<?php
}}
register_widget('homebannerwidget');




?>

Answers (4)

2012-07-22

Manoj Raj answers:

To have your own order of Manufacturers, Install this plugin

http://wordpress.org/extend/plugins/taxonomy-terms-order/

Once you have installed this plugin,

Go To settings -> Taxonomy Terms Order

<blockquote>There will be an option "Auto Sort" -> change it to OFF ...</blockquote>

Then,

You will have a "Taxonomy Order" in the submenu of your custom post type -> Vehicles I guess

There you have the option to drag and drop the order of the custom taxonomy... It will have the sub categories listed as well.. You need not worry as the widget you are using is just listing the parent categories. Just arrange in the order you need...

Then go to your <strong>function get_make_info_fun()</strong> -> I don't know where exactly it is located...

You will have a Query in the function which will end like this <strong>order by t.name</strong>

Change it to <strong>order by t.term_order</strong>

Thats all.. You are done... It will now have the order you manually did...

If you have any doubts, do let me know....


Manoj Raj comments:

I can do the install and change the function if you wish...


Jun Hoshino comments:

Very well!! It sure did work! Thank you very much Raj!

2012-07-22

Arnav Joy answers:

if you do not want to show parent category then try using this code , i am not sure what you want to achive


<?php
global $wpdb;
$catinfo = $wpdb->get_col("select t.term_id from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"".CUSTOM_CATEGORY_TYPE1."\" and tt.parent!=0 order by t.name");
?>


Jun Hoshino comments:

I apologize for my bad explonation skill.
What I want to active is to display only parent categories and not child categories.

thank you


Arnav Joy comments:

i think you are missing some code , to provide here , you have provided only this

global $wpdb;
$catinfo = $wpdb->get_col("select t.term_id from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"".CUSTOM_CATEGORY_TYPE1."\" and tt.parent=0 order by t.name");


please provide the full code


Jun Hoshino comments:

Oh, Im so sorry, guys!!!!!!!!!! the "Manufacturers List" widget is already set to display only parent categories... I mixed up questions... my big apologize!! I change question on the board so please help me with that. thx


Arnav Joy comments:

can you tell me what do you customize in the widget?

2012-07-22

Hai Bui answers:

The piece of code you posted would show the parent categories only
<?php
global $wpdb;
$catinfo = $wpdb->get_col("select t.term_id from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"".CUSTOM_CATEGORY_TYPE1."\" and tt.parent=0 order by t.name");
?>


But I don't know if it is used for the widget, where do you get it? You should find the definition of the get_make_info_fun() function and post it here.

2012-07-22

lhesselinherb answers:

Liebo Selbst-Anbau im Frühjahr und Sommer 2012 einfarbig stricke - &euro;40.02 :