Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.43 KB | None | 0 0
  1. <?php
  2.  
  3. /* Widgetable Functions */
  4.  
  5. if ( function_exists('register_sidebar') )
  6. register_sidebar(array(
  7. 'ID' => 'homepage',
  8. 'name'=>'Homepage Sidebar',
  9. 'before_widget' => '<div class="sidebox-top"></div><div class="sidebox"><div id="%1$s" class="widgets %2$s">',
  10. 'after_widget' => '</div></div>',
  11. 'before_title' => '<h3>',
  12. 'after_title' => '</h3>'
  13. ));
  14.  
  15. if ( function_exists('register_sidebar') )
  16. register_sidebar(array(
  17. 'ID' => 'homepagebox1',
  18. 'name'=>'Homepage Box 1',
  19. 'before_widget' => '<div id="%1$s" class="widgets %2$s">',
  20. 'after_widget' => '</div>',
  21. 'before_title' => '<h3>',
  22. 'after_title' => '</h3>'
  23. ));
  24.  
  25. if ( function_exists('register_sidebar') )
  26. register_sidebar(array(
  27. 'ID' => 'homepagebox2',
  28. 'name'=>'Homepage Box 2',
  29. 'before_widget' => '<div id="%1$s" class="widgets">',
  30. 'after_widget' => '</div>',
  31. 'before_title' => '<h3>',
  32. 'after_title' => '</h3>'
  33. ));
  34. if ( function_exists('register_sidebar') )
  35. register_sidebar(array(
  36. 'ID' => 'sidebar',
  37. 'name'=>'General Sidebar',
  38. 'before_widget' => '<div class="sidebox-top"></div><div class="sidebox"><div id="%1$s" class="widgets %2$s">',
  39. 'after_widget' => '</div></div>',
  40. 'before_title' => '<h3>',
  41. 'after_title' => '</h3>'
  42. ));
  43.  
  44. if ( function_exists('register_sidebar') )
  45. register_sidebar(array(
  46. 'name'=>'About Page',
  47. 'before_widget' => '<div class="sidebox-top"></div><div class="sidebox"><div id="%1$s" class="widgets %2$s">',
  48. 'after_widget' => '</div></div>',
  49. 'before_title' => '<h3>',
  50. 'after_title' => '</h3>'
  51. ));
  52. if ( function_exists('register_sidebar') )
  53. register_sidebar(array(
  54. 'name'=>'Services Page',
  55. 'before_widget' => '<div class="sidebox-top"></div><div class="sidebox"><div id="%1$s" class="widgets %2$s">',
  56. 'after_widget' => '</div></div>',
  57. 'before_title' => '<h3>',
  58. 'after_title' => '</h3>'
  59. ));
  60. if ( function_exists('register_sidebar') )
  61. register_sidebar(array(
  62. 'name'=>'Blog Sidebar',
  63. 'before_widget' => '<div class="sidebox-top"></div><div class="sidebox"><div id="%1$s" class="widgets %2$s">',
  64. 'after_widget' => '</div></div>',
  65. 'before_title' => '<h3>',
  66. 'after_title' => '</h3>'
  67. ));
  68. if ( function_exists('register_sidebar') )
  69. register_sidebar(array(
  70. 'name'=>'Single Post',
  71. 'before_widget' => '<div class="sidebox-top"></div><div class="sidebox"><div id="%1$s" class="widgets %2$s">',
  72. 'after_widget' => '</div></div>',
  73. 'before_title' => '<h3>',
  74. 'after_title' => '</h3>'
  75. ));
  76. if ( function_exists('register_sidebar') )
  77. register_sidebar(array(
  78. 'name'=>'Contact Sidebar',
  79. 'before_widget' => '<div class="sidebox-top"></div><div class="sidebox"><div id="%1$s" class="widgets %2$s">',
  80. 'after_widget' => '</div></div>',
  81. 'before_title' => '<h3>',
  82. 'after_title' => '</h3>'
  83. ));
  84.  
  85. /* Testimonial Widget */
  86. class Testimonial_Widget extends WP_Widget {
  87. function Testimonial_Widget() {
  88. $widgets_opt = array('description'=>'Testimonial Centita Theme Widget');
  89. parent::WP_Widget(false,$name= "Centita Testimonial",$widgets_opt);
  90. }
  91.  
  92. function form($instance) {
  93. global $post;
  94.  
  95. $catid = esc_attr($instance['catid']);
  96. $testititle = esc_attr($instance['testititle']);
  97. $numtesti = esc_attr($instance['numtesti']);
  98.  
  99. $categories_list = get_categories('hide_empty=0');
  100.  
  101. $categories = array();
  102. foreach ($categories_list as $catlist) {
  103. $categories[$catlist->cat_ID] = $catlist->cat_name;
  104. }
  105.  
  106. ?>
  107. <p><label for="testititle"><?php echo __('Title','centita');?>:
  108. <input id="<?php echo $this->get_field_id('testititle'); ?>" name="<?php echo $this->get_field_name('testititle'); ?>" type="text" class="widefat" value="<?php echo $testititle;?>" /></label></p>
  109. <p><small><?php echo __('Please select category for Testimonial.','centita');?></small>
  110. <select name="<?php echo $this->get_field_name('catid'); ?>" id="<?php echo $this->get_field_id('catid'); ?>" >
  111. <?php foreach ($categories as $opt => $val) { ?>
  112. <option value="<?php echo $opt ;?>" <?php if ( $catid == $opt) { echo ' selected="selected" '; }?>><?php echo $val; ?></option>
  113. <?php } ?>
  114. </select>
  115. </label></p>
  116. <p><label for="numtesti"><small><?php echo __('Number to display:','centita');?></small>
  117. <input id="<?php echo $this->get_field_id('numtesti'); ?>" name="<?php echo $this->get_field_name('numtesti'); ?>" type="text" class="widefat" value="<?php echo $numtesti;?>" /></label></p>
  118. <?php
  119. }
  120.  
  121. function update($new_instance, $old_instance) {
  122. return $new_instance;
  123. }
  124.  
  125. function widget( $args, $instance ) {
  126. global $post,$ID;
  127.  
  128. extract($args);
  129.  
  130. $catid = apply_filters('catid',$instance['catid']);
  131. $testititle = apply_filters('testititle',$instance['testititle']);
  132. $numtesti = apply_filters('numtesti',$instance['numtesti']);
  133.  
  134. if ($testititle == "") $testititle = __("Testimonials",'centita');
  135. if ($numtesti == "") $numtesti = 2;
  136.  
  137. $testis = new WP_Query('cat='.$catid.'&showposts='.$numtesti);
  138. ?>
  139. <?php if ($ID == "homepagebox1" || $ID == "homepagebox2") { ?>
  140. <div class="box-main">
  141. <div class="sidebox-top"></div>
  142. <div id="testimonials" class="scroll clearfix">
  143. <?php } else { ?>
  144. <div class="sidebox-top"></div>
  145. <div id="testimonials" class="scroll clearfix">
  146. <?php } ?>
  147. <?php echo $before_title.'<a href="'.get_category_link($catid).'">'.$testititle.'</a>'.$after_title;?>
  148. <ul>
  149. <?php
  150. while ( $testis->have_posts() ) : $testis->the_post();
  151. ?>
  152. <li>
  153. <blockquote>
  154. <?php excerpt(25);?>
  155. </blockquote><br />
  156. <strong><?php the_title();?></strong>
  157. </li>
  158. <?php endwhile;?>
  159. </ul>
  160. <ol>
  161. <li class="previous"><a href="#">Previous</a></li>
  162. <li class="next"><a href="#">Next</a></li>
  163. </ol>
  164. <?php if ($ID == "homepagebox1" || $ID == "homepagebox2") echo '</div></div>'; else echo '</div>'; ?>
  165.  
  166. <?php
  167. wp_reset_query();
  168. }
  169. }
  170.  
  171. add_action('widgets_init', create_function('', 'return register_widget("Testimonial_Widget");'));
  172.  
  173. /* Office Adress Widget */
  174. class OfficeAdress_Widget extends WP_Widget {
  175. function OfficeAdress_Widget() {
  176. $widgets_opt = array('description'=>'Office Adress Centita Theme Widget');
  177. parent::WP_Widget(false,$name= "Centita Office Adress",$widgets_opt);
  178. }
  179.  
  180. function form($instance) {
  181. global $post;
  182.  
  183. $contact_title = esc_attr($instance['contact_title']);
  184. $contact_email = esc_attr($instance['contact_email']);
  185. $contact_phone = esc_attr($instance['contact_phone']);
  186. $contact_address = esc_attr($instance['contact_address']);
  187. $contact_desc = esc_attr($instance['contact_desc']);
  188.  
  189. ?>
  190. <p><label for="contact_title"><?php echo __('Title','centita');?>:
  191. <input id="<?php echo $this->get_field_id('contact_title'); ?>" name="<?php echo $this->get_field_name('contact_title'); ?>" type="text" class="widefat" value="<?php echo $contact_title;?>"/></label></p>
  192. <p><label for="contact_phone"><?php echo __('Phone','centita');?>:
  193. <input id="<?php echo $this->get_field_id('contact_phone'); ?>" name="<?php echo $this->get_field_name('contact_phone'); ?>" type="text" class="widefat" value="<?php echo $contact_phone;?>" /></label></p>
  194. <p><label for="contact_email"><?php echo __('Email','centita');?>:
  195. <input id="<?php echo $this->get_field_id('contact_email'); ?>" name="<?php echo $this->get_field_name('contact_email'); ?>" type="text" class="widefat" value="<?php echo $contact_email;?>" /></label></p>
  196. <p><label for="contact_address"><?php echo __('Address','centita');?>:</label>
  197. <textarea id="<?php echo $this->get_field_id('contact_address'); ?>" name="<?php echo $this->get_field_name('contact_address'); ?>" class="widefat" rows="6" cols="20" ><?php echo $contact_address;?></textarea></p>
  198. <p><label for="contact_desc"><?php echo __('Short Description','centita');?>:</label>
  199. <textarea id="<?php echo $this->get_field_id('contact_desc'); ?>" name="<?php echo $this->get_field_name('contact_desc'); ?>" class="widefat" rows="6" cols="20" ><?php echo $contact_desc;?></textarea></p>
  200. <?php
  201. }
  202.  
  203. function update($new_instance, $old_instance) {
  204. return $new_instance;
  205. }
  206.  
  207. function widget( $args, $instance ) {
  208. global $post;
  209.  
  210. extract($args);
  211.  
  212. $contact_title = apply_filters('contact_title',$instance['contact_title']);
  213.  
  214. echo $before_widget;
  215.  
  216. $info_phone = get_option('centita_info_phone');
  217. $info_fax = get_option('centita_info_fax');
  218. $info_address = get_option('centita_info_address');
  219. $info_website = get_option('centita_info_website');
  220. $info_email = get_option('centita_info_email');
  221. $info_latitude = get_option('centita_info_latitude');
  222. $info_longitude = get_option('centita_info_longitude');
  223. $replace_char= array(",");
  224.  
  225. if ($contact_title == "") $contact_title =__("Our Detail Contact",'centita');
  226. ?>
  227.  
  228. <script type="text/javascript">
  229. jQuery(document).ready(function($) {
  230. jQuery("#contactmap").gMap({
  231. zoom: 15,
  232. markers:[{
  233. address: "",
  234. latitude: <?php echo $info_latitude;?>,
  235. longitude: <?php echo $info_longitude;?>,
  236. html: "<?php echo str_replace($replace_char,'<br/>',$info_address);?>",
  237. popup: true
  238. }],
  239. controls: [],
  240. maptype: G_NORMAL_MAP,
  241. scrollwheel:true
  242. });
  243. });
  244. </script>
  245.  
  246. <?php echo $before_title.$contact_title.$after_title;?>
  247. <div id="contactmap"></div>
  248. <div id="address">
  249. <ul>
  250. <li class="mail"><a href="mailto:<?php echo $info_email;?>"><?php echo $info_email;?></a></li>
  251. <li class="phone"><?php echo ($info_phone) ? $info_phone : $info_phone;?></li>
  252. <li class="address"><?php if ($info_address!="") echo stripslashes($info_address);?></li>
  253. </ul>
  254. </div>
  255. <?php
  256. echo $after_widget;
  257. }
  258. }
  259.  
  260. add_action('widgets_init', create_function('', 'return register_widget("OfficeAdress_Widget");'));
  261.  
  262. /* Office Adress Widget */
  263. class NewsLetter_Widget extends WP_Widget {
  264. function NewsLetter_Widget() {
  265. $widgets_opt = array('description'=>'NewsLetter for Centita Theme Widget');
  266. parent::WP_Widget(false,$name= "Centita NewsLetter",$widgets_opt);
  267. }
  268.  
  269. function form($instance) {
  270. global $post;
  271.  
  272. $newsletter_title = esc_attr($instance['newsletter_title']);
  273. $feedburner_id = esc_attr($instance['feedburner_id']);
  274. $newsletter_desc = esc_attr($instance['newsletter_desc']);
  275.  
  276. ?>
  277. <p><label for="newsletter_title"><?php echo __('Title','centita');?>:
  278. <input id="<?php echo $this->get_field_id('newsletter_title'); ?>" name="<?php echo $this->get_field_name('newsletter_title'); ?>" type="text" class="widefat" value="<?php echo $newsletter_title;?>"/></label></p>
  279. <p><label for="feedburner_id"><?php echo __('Feedburner ID','centita');?>:
  280. <input id="<?php echo $this->get_field_id('feedburner_id'); ?>" name="<?php echo $this->get_field_name('feedburner_id'); ?>" type="text" class="widefat" value="<?php echo $feedburner_id;?>" /></label></p>
  281. <p><label for="newsletter_desc"><?php echo __('Short Description','centita');?>:</label>
  282. <textarea id="<?php echo $this->get_field_id('newsletter_desc'); ?>" name="<?php echo $this->get_field_name('newsletter_desc'); ?>" class="widefat" rows="6" cols="20" ><?php echo $newsletter_desc;?></textarea></p>
  283. <?php
  284. }
  285.  
  286. function update($new_instance, $old_instance) {
  287. return $new_instance;
  288. }
  289.  
  290. function widget( $args, $instance ) {
  291. global $post;
  292.  
  293. extract($args);
  294.  
  295. $newsletter_title = apply_filters('newsletter_title',$instance['newsletter_title']);
  296. $feedburner_id = apply_filters('feedburner_id',$instance['feedburner_id']);
  297. $newsletter_desc = apply_filters('newsletter_desc',$instance['newsletter_desc']);
  298. if ($feedburner_id == "") $feedburner_id = __('Newsletter','centita');
  299. ?>
  300. <div class="sidebox-top"></div>
  301. <div class="sidebox">
  302. <?php echo $before_title.$newsletter_title.$after_title;?>
  303. <p><?php echo stripslashes($newsletter_desc);?></p>
  304. <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 $feedburner_id;?>', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" id="newsletter">
  305. <fieldset>
  306. <input type="hidden" value="<?php echo $feedburner_id;?>" name="uri"/>
  307. <input type="hidden" value="<?php bloginfo('name'); ?>" name="title"/>
  308. <input type="hidden" name="loc" value="en_US"/>
  309. <input name="email" type="text" class="inputbox01" value="<?php echo __('enter your email address','centita');?>" onblur="if(this.value=='') this.value='<?php echo __('enter your email address','centita');?>';" onfocus="if(this.value=='<?php echo __('enter your email address','centita');?>') this.value='';" />
  310. <input type="image" src="<?php echo get_template_directory_uri();?>/images/but-send.gif" class="but" />
  311. </fieldset>
  312. </form>
  313. </div><!-- end of sidebox -->
  314. <?php
  315. }
  316. }
  317.  
  318. add_action('widgets_init', create_function('', 'return register_widget("NewsLetter_Widget");'));
  319.  
  320. /* Featured Project Widget */
  321. class FeaturedProject_Widget extends WP_Widget {
  322. function FeaturedProject_Widget () {
  323. $widgets_opt = array('description'=>'Featured Project Centita Theme Widget');
  324. parent::WP_Widget(false,$name= "Centita Featured Project",$widgets_opt);
  325. }
  326.  
  327. function form($instance) {
  328. global $post;
  329.  
  330. $portotitle = esc_attr($instance['portotitle']);
  331. $numporto = esc_attr($instance['numporto']);
  332.  
  333. $categories_list = get_categories('hide_empty=0');
  334.  
  335. $categories = array();
  336. foreach ($categories_list as $catlist) {
  337. $categories[$catlist->cat_ID] = $catlist->cat_name;
  338. }
  339.  
  340. ?>
  341. <p><label for="portotitle"><?php echo __('Title','centita');?>:
  342. <input id="<?php echo $this->get_field_id('portotitle'); ?>" name="<?php echo $this->get_field_name('portotitle'); ?>" type="text" class="widefat" value="<?php echo $portotitle;?>" /></label></p>
  343. <p><label for="numporto"><small><?php echo __('Number to display','centita');?>:</small>
  344. <input id="<?php echo $this->get_field_id('numporto'); ?>" name="<?php echo $this->get_field_name('numporto'); ?>" type="text" class="widefat" value="<?php echo $numporto;?>" /></label></p>
  345. <?php
  346. }
  347.  
  348. function update($new_instance, $old_instance) {
  349. return $new_instance;
  350. }
  351.  
  352. function widget( $args, $instance ) {
  353. global $post, $ID;
  354.  
  355. extract($args);
  356.  
  357. $portotitle = apply_filters('portotitle',$instance['portotitle']);
  358. $numporto = apply_filters('numporto',$instance['numporto']);
  359.  
  360. if ($portotitle == "") $portotitle = __("Featured Project",'centita');
  361. if ($numporto == "") $numporto = 2;
  362.  
  363. if (post_type_exists('portfolio')) {
  364. query_posts(array( 'post_type' => 'portfolio', 'showposts' => $numporto,'orderby'=>'rand'));
  365. }
  366. ?>
  367. <?php if ($ID == "homepagebox1" || $ID == "homepagebox2") { ?>
  368. <div class="box-main">
  369. <div class="sidebox-top"></div>
  370. <div class="sidebox">
  371. <?php } else { ?>
  372. <div class="sidebox-top"></div>
  373. <div class="sidebox">
  374. <?php } ?>
  375.  
  376. <?php echo $before_title.$portotitle.$after_title;?>
  377.  
  378. <?php while ( have_posts() ) : the_post();?>
  379.  
  380. <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {?>
  381. <img src="<?php echo get_template_directory_uri();?>/timthumb.php?src=<?php echo thumb_url();?>&amp;h=60&amp;w=60&amp;zc=1" alt="" class="imgleft" />
  382. <?php } ?>
  383. <strong><a href="<?php the_permalink();?>"><?php the_title();?></a></strong><br />
  384. <p><?php the_excerpt();?></p>
  385. <div class="clr"></div><br />
  386. <?php endwhile;?>
  387. <?php wp_reset_query();?>
  388. <?php if ($ID == "homepagebox1" || $ID == "homepagebox2") echo '</div></div>'; ?>
  389. </div>
  390. <?php
  391. }
  392. }
  393.  
  394. add_action('widgets_init', create_function('', 'return register_widget("FeaturedProject_Widget");'));
  395.  
  396. /* Latest News Widget */
  397. class LatestNews_Widget extends WP_Widget {
  398. function LatestNews_Widget() {
  399. $widgets_opt = array('description'=>'Latest News Centita Theme Widget');
  400. parent::WP_Widget(false,$name= "Centita Latest News",$widgets_opt);
  401. }
  402.  
  403. function form($instance) {
  404. global $post;
  405.  
  406. $newsid = esc_attr($instance['newsid']);
  407. $newstitle = esc_attr($instance['newstitle']);
  408. $numnews = esc_attr($instance['numnews']);
  409.  
  410. $categories_list = get_categories('hide_empty=0');
  411.  
  412. $categories = array();
  413. foreach ($categories_list as $catlist) {
  414. $categories[$catlist->cat_ID] = $catlist->cat_name;
  415. }
  416.  
  417. ?>
  418. <p><label for="newstitle"><?php echo __('Title','centita');?>:
  419. <input id="<?php echo $this->get_field_id('newstitle'); ?>" name="<?php echo $this->get_field_name('newstitle'); ?>" type="text" class="widefat" value="<?php echo $newstitle;?>" /></label></p>
  420. <p><small><?php echo __('Please select category for News.','centita');?></small>
  421. <select name="<?php echo $this->get_field_name('newsid'); ?>" id="<?php echo $this->get_field_id('newsid'); ?>" >
  422. <?php foreach ($categories as $opt => $val) { ?>
  423. <option value="<?php echo $opt ;?>" <?php if ( $newsid == $opt) { echo ' selected="selected" '; }?>><?php echo $val; ?></option>
  424. <?php } ?>
  425. </select>
  426. </label></p>
  427. <p><label for="numnews"><small><?php echo __('Number to display','centita');?>:</small>
  428. <input id="<?php echo $this->get_field_id('numnews'); ?>" name="<?php echo $this->get_field_name('numnews'); ?>" type="text" class="widefat" value="<?php echo $numnews;?>" /></label></p>
  429. <?php
  430. }
  431.  
  432. function update($new_instance, $old_instance) {
  433. return $new_instance;
  434. }
  435.  
  436. function widget( $args, $instance ) {
  437. global $post, $ID;
  438.  
  439. extract($args);
  440.  
  441. $newsid = apply_filters('newsid',$instance['newsid']);
  442. $newstitle = apply_filters('newstitle',$instance['newstitle']);
  443. $numnews = apply_filters('numnews',$instance['numnews']);
  444.  
  445. if ($newstitle == "") $newstitle = __("Latest News",'centita');
  446. if ($numnews == "") $numnews = 2;
  447.  
  448. $latestnews = new WP_Query('cat='.$newsid.'&showposts='.$numnews);
  449. ?>
  450. <?php if ($ID == "homepagebox1" || $ID == "homepagebox2") { ?>
  451. <div class="box-main">
  452. <div class="sidebox-top"></div>
  453. <div id="latest-news" class="scroll clearfix">
  454. <?php } else { ?>
  455. <div class="sidebox-top"></div>
  456. <div id="latest-news" class="scroll clearfix">
  457. <?php } ?>
  458. <?php echo $before_title.$newstitle.$after_title;?>
  459. <ul>
  460. <?php
  461. while ( $latestnews->have_posts() ) : $latestnews->the_post();
  462. ?>
  463. <li>
  464. <a href="<?php the_permalink();?>">
  465. <strong><?php the_title();?></strong></a>
  466. <div class="clr"></div>
  467. <span style="margin-bottom:8px;"><?php the_time( get_option('date_format') ); ?></span>
  468. <div class="clr"></div>
  469. <?php the_excerpt();?>
  470. </li>
  471. <?php endwhile;?>
  472. <?php wp_reset_query();?>
  473. </ul>
  474. <ol>
  475. <li class="previous"><a href="#">Previous</a></li>
  476. <li class="next"><a href="#">Next</a></li>
  477. </ol>
  478. </div>
  479. <?php if ($ID == "homepagebox1" || $ID == "homepagebox2") echo '</div>'; ?>
  480. <?php
  481. }
  482. }
  483.  
  484. add_action('widgets_init', create_function('', 'return register_widget("LatestNews_Widget");'));
  485.  
  486. /* Company Info Widget */
  487. class CompanyInfo_Widget extends WP_Widget {
  488. function CompanyInfo_Widget() {
  489. $widgets_opt = array('description'=>'Company Info Theme Widget');
  490. parent::WP_Widget(false,$name= "Centita Company Info",$widgets_opt);
  491. }
  492.  
  493. function form($instance) {
  494. global $post;
  495.  
  496. $companyinfotitle = esc_attr($instance['companyinfotitle']);
  497. $aboutpid = esc_attr($instance['aboutpid']);
  498. $servicespid = esc_attr($instance['servicespid']);
  499.  
  500. $pages = get_pages();
  501. $listpages = array();
  502. foreach ($pages as $pagelist ) {
  503. $listpages[$pagelist->ID] = $pagelist->post_title;
  504. }
  505.  
  506. ?>
  507. <p><label for="companyinfotitle"><?php echo __('Title','centita');?>:
  508. <input id="<?php echo $this->get_field_id('companyinfotitle'); ?>" name="<?php echo $this->get_field_name('companyinfotitle'); ?>" type="text" class="widefat" value="<?php echo $companyinfotitle;?>" /></label></p>
  509. <p><small><?php echo __('Your About Page.','centita');?></small>
  510. <select name="<?php echo $this->get_field_name('aboutpid'); ?>" id="<?php echo $this->get_field_id('aboutpid'); ?>" >
  511. <?php foreach ($listpages as $opt => $val) { ?>
  512. <option value="<?php echo $opt ;?>" <?php if ( $aboutpid == $opt) { echo ' selected="selected" '; }?>><?php echo $val; ?></option>
  513. <?php } ?>
  514. </select>
  515. </label></p>
  516. <p><small><?php echo __('Your Services Page','centita');?></small>
  517. <select name="<?php echo $this->get_field_name('servicespid'); ?>" id="<?php echo $this->get_field_id('servicespid'); ?>" >
  518. <?php foreach ($listpages as $opt => $val) { ?>
  519. <option value="<?php echo $opt ;?>" <?php if ( $servicespid == $opt) { echo ' selected="selected" '; }?>><?php echo $val; ?></option>
  520. <?php } ?>
  521. </select>
  522. </label></p>
  523. <?php
  524. }
  525.  
  526. function update($new_instance, $old_instance) {
  527. return $new_instance;
  528. }
  529.  
  530. function widget( $args, $instance ) {
  531. global $post;
  532.  
  533. extract($args);
  534.  
  535. $companyinfotitle = apply_filters('companyinfotitle',$instance['companyinfotitle']);
  536. $aboutpid = apply_filters('aboutpid',$instance['aboutpid']);
  537. $servicespid = apply_filters('servicespid',$instance['servicespid']);
  538. if ($companyinfotitle=="") $companyinfotitle = __("Company Profile",'centita');
  539. ?>
  540. <div class="sidebox-top"></div>
  541. <div class="sidebox">
  542. <?php echo $before_title.$companyinfotitle.$after_title;?>
  543. <?php
  544. $aboutpage = new WP_Query('showposts=1&page_id='.$aboutpid);
  545. while ($aboutpage->have_posts()) : $aboutpage->the_post();
  546. ?>
  547. <p><?php excerpt(20);?></p>
  548. <?php endwhile;?>
  549. <ul class="about-list">
  550. <?php
  551. $servicespage = new WP_Query('post_type=page&post_parent='.$servicespid);
  552. while ($servicespage->have_posts()) : $servicespage->the_post();
  553. ?>
  554. <li><a href="<?php the_permalink();?>"><?php the_title();?></a></li>
  555. <?php endwhile;?>
  556. </ul>
  557. </div><!-- end of sidebox -->
  558. <?php
  559. wp_reset_query();
  560. }
  561. }
  562.  
  563. add_action('widgets_init', create_function('', 'return register_widget("CompanyInfo_Widget");'));
  564.  
  565. /* Page to Homepage Box or Sidebar Box Widget */
  566.  
  567. class PageToBox_Widget extends WP_Widget {
  568.  
  569. function PageToBox_Widget() {
  570. $widgets_opt = array('class'=>'box','description'=>'Centita Theme Widget for displaying page as homepage box or sidebar box');
  571. parent::WP_Widget(false,$name= "Centita Page to Box",$widgets_opt);
  572. }
  573.  
  574. function form($instance) {
  575. global $post;
  576.  
  577. $pageid = esc_attr($instance['pageid']);
  578. $check_opt = $instance['check_opt'];
  579.  
  580. $pages = get_pages();
  581. $listpages = array();
  582. foreach ($pages as $pagelist ) {
  583. $listpages[$pagelist->ID] = $pagelist->post_title;
  584. }
  585. ?>
  586. <p><small><?php echo __('Please select a page to display in box.','centita');?></small></p>
  587. <select name="<?php echo $this->get_field_name('pageid'); ?>" id="<?php echo $this->get_field_id('pageid'); ?>" >
  588. <?php foreach ($listpages as $opt => $val) { ?>
  589. <option value="<?php echo $opt ;?>" <?php if ( $pageid == $opt) { echo ' selected="selected" '; }?>><?php echo $val; ?></option>
  590. <?php } ?>
  591. </select>
  592. </label></p>
  593. <p>
  594. <input class="checkbox" type="checkbox" <?php if ($check_opt == "on") echo "checked";?> id="<?php echo $this->get_field_id('check_opt'); ?>" name="<?php echo $this->get_field_name('check_opt'); ?>" />
  595. <label for="<?php echo $this->get_field_id('check_opt'); ?>"><?php echo __('Show Image Thumbnail?','centita');?></label><br />
  596. </p>
  597. <?php
  598. }
  599.  
  600. function update($new_instance, $old_instance) {
  601. return $new_instance;
  602. }
  603.  
  604. function widget( $args, $instance ) {
  605. global $post;
  606.  
  607. extract($args);
  608.  
  609. $pageid = apply_filters('pageid',$instance['pageid']);
  610. $check_opt = apply_filters('check_opt',$instance['check_opt']);
  611. if ($ID == 'homepagebox1' || $ID == 'homepagebox2' ) { ?>
  612. <div class="box-main">
  613. <?php
  614. query_posts('post_type=page&page_id='.$pageid);
  615. while (have_posts()) : the_post();
  616. ?>
  617. <?php if ($check_opt == "on") { ?>
  618. <div class="icon">
  619. <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {?>
  620. <img src="<?php echo get_template_directory_uri();?>/timthumb.php?src=<?php echo thumb_url();?>&amp;h=90&amp;w=66&amp;zc=1" alt="" class="imgleft"/>
  621. <?php } ?>
  622. </div>
  623. <?php } ?>
  624. <p>
  625. <strong><a href="<?php the_permalink();?>"><?php echo the_title();?></a></strong><br />
  626. <?php excerpt(30);?>
  627. </p>
  628. <span class="read-more"><a href="<?php the_permalink();?>"><img src="<?php echo get_template_directory_uri();?>/images/read-more.gif" alt="" /></a></span>
  629. <br />
  630. <div class="clr"></div>
  631. <?php endwhile;?>
  632. </div>
  633. <?php } else {
  634. echo $before_widget;
  635. $pagetitle = "<a href='".get_permalink($pageid)."'>".get_the_title($pageid)."</a>";
  636. echo $before_title.$pagetitle.$after_title;
  637. if ($pageid) {
  638. query_posts('post_type=page&page_id='.$pageid);
  639. while (have_posts()) : the_post();
  640. ?>
  641. <?php if ($check_opt == "on") { ?>
  642. <div class="icon">
  643. <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {?>
  644. <img src="<?php echo get_template_directory_uri();?>/timthumb.php?src=<?php echo thumb_url();?>&amp;h=60&amp;w=60&amp;zc=1" alt="" class="imgleft"/>
  645. <?php } ?>
  646. </div>
  647. <?php }?>
  648. <?php excerpt(30)."<br />";?>
  649. <span class="read-more"><a href="<?php the_permalink();?>"><img src="<?php echo get_template_directory_uri();?>/images/read-more.gif" alt="" /></a></span>
  650.  
  651. <br />
  652. <div class="clr"></div>
  653. <?php
  654. endwhile;
  655. wp_reset_query();
  656. }
  657. echo $after_widget;
  658.  
  659. }
  660. }
  661. }
  662.  
  663. add_action('widgets_init', create_function('', 'return register_widget("PageToBox_Widget");'));
  664.  
  665. /* Post to Homepage Box or Sidebar Box Widget */
  666.  
  667. class PostToBox_Widget extends WP_Widget {
  668.  
  669. function PostToBox_Widget() {
  670. $widgets_opt = array('class'=>'box','description'=>'Centita Theme Widget for displaying post as homepage box or sidebar box');
  671. parent::WP_Widget(false,$name= "Centita Post to Box",$widgets_opt);
  672. }
  673.  
  674. function form($instance) {
  675. global $post;
  676.  
  677. $postid = esc_attr($instance['postid']);
  678. $check_opt = $instance['check_opt'];
  679.  
  680. $centitaposts = get_posts('numberposts=-1')
  681. ?>
  682. <p><small><?php echo __('Please select a page to display in box.','centita');?></small></p>
  683. <select name="<?php echo $this->get_field_name('postid'); ?>" id="<?php echo $this->get_field_id('postid'); ?>" >
  684. <?php foreach ($centitaposts as $post) { ?>
  685. <option value="<?php echo $post->ID;?>" <?php if ( $postid == $post->ID) { echo ' selected="selected" '; }?>><?php echo the_title(); ?></option>
  686. <?php } ?>
  687. </select>
  688. </label></p>
  689. <p>
  690. <input class="checkbox" type="checkbox" <?php if ($check_opt == "on") echo "checked";?> id="<?php echo $this->get_field_id('check_opt'); ?>" name="<?php echo $this->get_field_name('check_opt'); ?>" />
  691. <label for="<?php echo $this->get_field_id('check_opt'); ?>"><small><?php echo __('Show Image Thumbnail?','centita');?></small></label><br />
  692. </p>
  693. <?php
  694. }
  695.  
  696. function update($new_instance, $old_instance) {
  697. return $new_instance;
  698. }
  699.  
  700. function widget( $args, $instance ) {
  701. global $post;
  702.  
  703. extract($args);
  704.  
  705. $postid = apply_filters('postid', $instance['postid']);
  706. $check_opt = apply_filters('check_opt', $instance['check_opt']);
  707.  
  708. if ($ID == 'homepagebox1' || $ID == 'homepagebox2' ) { ?>
  709. <div class="box-main">
  710. <?php
  711. query_posts('p='.$postid);
  712. while (have_posts()) : the_post();
  713. ?>
  714. <?php if ($check_opt == "on") { ?>
  715. <div class="icon">
  716. <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {?>
  717. <img src="<?php echo get_template_directory_uri();?>/timthumb.php?src=<?php echo thumb_url();?>&amp;h=90&amp;w=66&amp;zc=1" alt="" class="imgleft"/>
  718. <?php } ?>
  719. </div>
  720. <?php }?>
  721. <p>
  722. <strong><a href="<?php the_permalink();?>"><?php echo the_title();?></a></strong>
  723. <br />
  724. <?php excerpt(30);?>
  725. </p>
  726. <span class="read-more"><a href="<?php the_permalink();?>"><img src="<?php echo get_template_directory_uri();?>/images/read-more.gif" alt="" /></a></span>
  727. <br />
  728. <div class="clr"></div>
  729. <?php endwhile;?>
  730. </div>
  731.  
  732. <?php } else {
  733. echo $before_widget;
  734. $posttitle = "<a href='".get_permalink($postid)."'>".get_the_title($postid)."</a>";
  735. echo $before_title.$posttitle.$after_title;
  736. query_posts('p='.$postid);
  737. while (have_posts()) : the_post();
  738. ?>
  739. <?php if ($check_opt == "on") { ?>
  740. <div class="icon">
  741. <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {?>
  742. <img src="<?php echo get_template_directory_uri();?>/timthumb.php?src=<?php echo thumb_url();?>&amp;h=60&amp;w=60&amp;zc=1" alt="" class="imgleft"/>
  743. <?php } ?>
  744. </div>
  745. <?php }?>
  746. <?php excerpt(30)."<br />";?>
  747. <span class="read-more"><a href="<?php the_permalink();?>"><img src="<?php echo get_template_directory_uri();?>/images/read-more.gif" alt="" /></a></span>
  748. <br />
  749. <div class="clr"></div>
  750. <?php
  751. endwhile;
  752. echo $after_widget;
  753. wp_reset_query();
  754. }
  755. }
  756. }
  757.  
  758. add_action('widgets_init', create_function('', 'return register_widget("PostToBox_Widget");'));
  759. ?>
  760.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement