SHARE
TWEET

Functions.php

a guest Sep 19th, 2013 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function languages_list_header(){
  3.     $languages = icl_get_languages('skip_missing=0&orderby=code&order=desc');
  4.     if(!empty($languages)){
  5.         echo '<div id="header_language_list"><ul>';
  6.         foreach($languages as $l){
  7.             echo '<li>';
  8.             if(!$l['active']) echo '<a href="'.$l['url'].'">';
  9.             echo icl_disp_language($l['native_name'], $l['translated_name']);
  10.             if(!$l['active']) echo '</a>';
  11.             echo '</li>';
  12.         }
  13.         echo '</ul></div>';
  14.     }
  15. }
  16.  
  17. add_action("login_head", "change_my_wp_login_image");
  18.  
  19. if ( function_exists( 'add_theme_support' ) ) {
  20.         add_theme_support( 'post-thumbnails' );
  21.         set_post_thumbnail_size( 208, 138, true );
  22. }
  23.  
  24. remove_filter('term_description','wpautop');
  25.  
  26. function my_function_admin_bar(){
  27.     return false;
  28. }
  29. add_filter( 'show_admin_bar' , 'my_function_admin_bar');
  30.  
  31.  
  32. if ( function_exists('register_sidebar') )
  33. register_sidebar(array(
  34. 'name' => __( 'Homepage Feature' ),
  35.         'id' => 'home-feature',
  36.         'description' => __( 'This is the introductory chunk of text on the homepage. You can edit the text in each language but don\'t change or add anything else.' ),
  37.         'before_title' => '<div class="feature-title">',
  38.         'after_title' => '</div>',
  39.         'before_widget' => '<div class="feature">',
  40.         'after_widget' => '</div>',
  41. ));
  42.  
  43. register_sidebar(array(
  44. 'name' => __( 'Homepage Voyages' ),
  45.         'description' => __( 'This sets up the introductory display of upcoming voyages on the homepage. Don\'t change anything here! To change info and descriptions click the Events tab on the admin menu.' ),
  46.         'before_title' => '<h1 class="listing-title">',
  47.         'after_title' => '</h1>',
  48.         'before_widget' => '',
  49.         'after_widget' => '',
  50. ));
  51.  
  52. register_sidebar(array(
  53. 'name' => __( 'Advertisement' ),
  54.         'description' => __( 'Here you can change the advertisement image if you\'ve already uploaded it somewhere (like the Media library) and you have the url. If the image is 900x150px you\'ll only need to change the url. 900px wide max!' ),
  55.         'before_title' => '<div class="feature-title">',
  56.         'after_title' => '</div>',
  57.         'before_widget' => '<div id="advertisement">',
  58.         'after_widget' => '</div>',
  59. ));
  60.  
  61. register_sidebar(array(
  62. 'name' => __( 'Footer' ),
  63.         'id' => 'footer-widgets',
  64.         'description' => __( 'You don\'t need to change anything here. You can adjust menu on the footer by selecting Footer Navigation on the menu screen.' ),
  65.         'before_title' => '<div class="footer-title">',
  66.         'after_title' => '</div>',
  67.         'before_widget' => '<div class="footer-widget">',
  68.         'after_widget' => '</div>',
  69. ));
  70.  
  71. add_filter( 'testimonials_widget_testimonial_html', 'my_testimonials_widget_testimonial_html', 10, 5 );
  72.  
  73. function my_testimonials_widget_testimonial_html( $content, $testimonial, $atts, $is_list = true, $is_first = false, $widget_number = null ) {
  74. // do stuff… see Testimonials_Widget::get_testimonial_html for default processing
  75. if ( false )
  76. return $content;
  77.  
  78. // display attributes
  79. $char_limit     = ( is_numeric( $atts['char_limit'] ) && 0 <= intval( $atts['char_limit'] ) ) ? intval( $atts['char_limit'] ) : false;
  80. $content_more   = apply_filters( 'testimonials_widget_content_more', __( '…', 'testimonials-widget' ) );
  81. $do_company     = ( 'true' != $atts['hide_company'] ) && ! empty( $testimonial['testimonial_company'] );
  82. $do_content     = ( 'true' != $atts['hide_content'] ) && ! empty( $testimonial['testimonial_content'] );
  83. $do_email       = ( 'true' != $atts['hide_email'] ) && ! empty( $testimonial['testimonial_email'] ) && is_email( $testimonial['testimonial_email'] );
  84. $do_image       = ( 'true' != $atts['hide_image'] ) && ! empty( $testimonial['testimonial_image'] );
  85. $do_source      = ( 'true' != $atts['hide_source'] || 'true' == $atts['hide_author'] ) && ! empty( $testimonial['testimonial_source'] );
  86. $do_title       = ( 'true' != $atts['hide_title'] ) && ! empty( $testimonial['testimonial_title'] );
  87. $do_url = ( 'true' != $atts['hide_url'] ) && ! empty( $testimonial['testimonial_url'] );
  88. $keep_whitespace        = ( 'true' == $atts['keep_whitespace'] );
  89.  
  90. $html   = '<div class="testimonialswidget_testimonial';
  91.  
  92. if ( $is_list ) {
  93. $html   .= ' testimonialswidget_testimonial_list';
  94. } elseif ( $is_first ) {
  95. $html   .= ' testimonialswidget_active';
  96. } elseif ( ! $is_first ) {
  97. $html   .= ' testimonialswidget_display_none';
  98. }
  99.  
  100. $html   .= '">';
  101.  
  102. if ( $do_content ) {
  103. $content        = $testimonial['testimonial_content'];
  104. $content        = self::format_content( $content, $widget_number, $keep_whitespace );
  105.  
  106. if ( $char_limit ) {
  107. $content        = self::testimonials_truncate( $content, $char_limit, ' ', $content_more );
  108. $content        = force_balance_tags( $content );
  109. }
  110.  
  111. $content        = apply_filters( 'testimonials_widget_content', $content, $widget_number, $testimonial, $atts );
  112. $content        = make_clickable( $content );
  113.  
  114. $html   .= '<q>';
  115. $html   .= $content;
  116. $html   .= '</q>';
  117. }
  118.  
  119. if ( $do_image ) {
  120. $html   .= '<span class="testimonialswidget_image">';
  121. $html   .= $testimonial['testimonial_image'];
  122. $html   .= '</span>';
  123. }
  124.  
  125. $cite   = '';
  126. $done_url       = false;
  127.  
  128. if ( $do_source && $do_email ) {
  129. $cite   .= '<span class="testimonialswidget_author">';
  130. $cite   .= '<a href="mailto:' . $testimonial['testimonial_email'] . '">';
  131. $cite   .= $testimonial['testimonial_source'];
  132. $cite   .= '</a>';
  133. $cite   .= '</span>';
  134. } elseif ( $do_source && ! $do_company && $do_url ) {
  135. $cite   .= '<span class="testimonialswidget_author">';
  136. $cite   .= '<a href="' . $testimonial['testimonial_url'] . '">';
  137. $cite   .= $testimonial['testimonial_source'];
  138. $cite   .= '</a>';
  139. $cite   .= '</span>';
  140. $done_url       = true;
  141. } elseif ( $do_source ) {
  142. $cite   .= '<span class="testimonialswidget_author">';
  143. $cite   .= $testimonial['testimonial_source'];
  144. $cite   .= '</span>';
  145. } elseif ( $do_email ) {
  146. $cite   .= '<span class="testimonialswidget_email">';
  147. $cite   .= make_clickable( $testimonial['testimonial_email'] );
  148. $cite   .= '</span>';
  149. }
  150.  
  151. if ( $do_title && $cite )
  152. $cite   .= '<span class="testimonialswidget_join_title"></span>';
  153.  
  154. if ( $do_title ) {
  155. $cite   .= '<span class="testimonialswidget_title">';
  156. $cite   .= $testimonial['testimonial_title'];
  157. $cite   .= '</span>';
  158. }
  159.  
  160. if ( ( $do_company || ( $do_url && ! $done_url ) ) && $cite )
  161. $cite   .= '<span class="testimonialswidget_join"></span>';
  162.  
  163. if ( $do_company && $do_url ) {
  164. $cite   .= '<span class="testimonialswidget_company">';
  165. $cite   .= '<a href="' . $testimonial['testimonial_url'] . '">';
  166. $cite   .= $testimonial['testimonial_company'];
  167. $cite   .= '</a>';
  168. $cite   .= '</span>';
  169. } elseif ( $do_company ) {
  170. $cite   .= '<span class="testimonialswidget_company">';
  171. $cite   .= $testimonial['testimonial_company'];
  172. $cite   .= '</span>';
  173. } elseif ( $do_url && ! $done_url ) {
  174. $cite   .= '<span class="testimonialswidget_url">';
  175. $cite   .= make_clickable( $testimonial['testimonial_url'] );
  176. $cite   .= '</span>';
  177. }
  178.  
  179. if ( ! empty( $cite ) )
  180. $cite   = '<cite>' . $cite . '</cite>';
  181.  
  182. $html   .= $cite;
  183.  
  184. if ( ! empty( $testimonial['testimonial_extra'] ) ) {
  185. $html   .= '<div class="testimonialswidget_extra">';
  186. $html   .= $testimonial['testimonial_extra'];
  187. $html   .= '</div>';
  188. }
  189.  
  190. if ( ! empty( $atts['widget_text'] ) ) {
  191. $html .= '<div class="testimonialswidget_widget_text">';
  192. $html .= $atts['widget_text'];
  193. $html .= '</div>';
  194. }
  195.  
  196. $html   .= '</div>';
  197.  
  198. return $html;
  199. }
  200.  
  201. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top