PageRenderTime 68ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/ifeature/functions.php

https://github.com/Bochet/festival_lgbt
PHP | 325 lines | 252 code | 29 blank | 44 comment | 14 complexity | 4d844b973dfb92819e63bd0be324812c MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Theme Functions
  4. *
  5. * Please do not edit this file. This file is part of the Cyber Chimps Framework and all modifications
  6. * should be made in a child theme.
  7. *
  8. * @category CyberChimps Framework
  9. * @package Framework
  10. * @since 1.0
  11. * @author CyberChimps
  12. * @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
  13. * @link http://www.cyberchimps.com/
  14. */
  15. // Load Core
  16. require_once( get_template_directory() . '/cyberchimps/init.php' );
  17. // Set the content width based on the theme's design and stylesheet.
  18. if ( ! isset( $content_width ) )
  19. $content_width = 640; /* pixels */
  20. function ifeature_add_site_info() { ?>
  21. <p>&copy; Company Name</p>
  22. <?php }
  23. add_action('cyberchimps_site_info', 'ifeature_add_site_info');
  24. if ( ! function_exists( 'cyberchimps_comment' ) ) :
  25. // Template for comments and pingbacks.
  26. // Used as a callback by wp_list_comments() for displaying the comments.
  27. function cyberchimps_comment( $comment, $args, $depth ) {
  28. $GLOBALS['comment'] = $comment;
  29. switch ( $comment->comment_type ) :
  30. case 'pingback' :
  31. case 'trackback' :
  32. ?>
  33. <li class="post pingback">
  34. <p><?php _e( 'Pingback:', 'cyberchimps' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'cyberchimps' ), ' ' ); ?></p>
  35. <?php
  36. break;
  37. default :
  38. ?>
  39. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  40. <article id="comment-<?php comment_ID(); ?>" class="comment">
  41. <footer>
  42. <div class="comment-author vcard">
  43. <?php echo get_avatar( $comment, 40 ); ?>
  44. <?php printf( '%1$s <span class="says">%2$s</span>', sprintf( '<cite class="fn">%1$s</cite>',
  45. get_comment_author_link() ),
  46. __( 'says', 'cyberchimps' ) ); ?>
  47. </div><!-- .comment-author .vcard -->
  48. <?php if ( $comment->comment_approved == '0' ) : ?>
  49. <em><?php _e( 'Your comment is awaiting moderation.', 'cyberchimps' ); ?></em>
  50. <br />
  51. <?php endif; ?>
  52. <div class="comment-meta commentmetadata">
  53. <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><time pubdate datetime="<?php comment_time( 'c' ); ?>">
  54. <?php
  55. /* translators: 1: date, 2: time */
  56. printf( __( '%1$s at %2$s', 'cyberchimps' ), get_comment_date(), get_comment_time() ); ?>
  57. </time></a>
  58. <?php edit_comment_link( __( '(Edit)', 'cyberchimps' ), ' ' );
  59. ?>
  60. </div><!-- .comment-meta .commentmetadata -->
  61. </footer>
  62. <div class="comment-content"><?php comment_text(); ?></div>
  63. <div class="reply">
  64. <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  65. </div><!-- .reply -->
  66. </article><!-- #comment-## -->
  67. <?php
  68. break;
  69. endswitch;
  70. }
  71. endif; // ends check for cyberchimps_comment()
  72. // set up next and previous post links for lite themes only
  73. function cyberchimps_next_previous_posts() {
  74. if( get_next_posts_link() || get_previous_posts_link() ): ?>
  75. <div class="more-content">
  76. <div class="row-fluid">
  77. <div class="span6 previous-post">
  78. <?php previous_posts_link(); ?>
  79. </div>
  80. <div class="span6 next-post">
  81. <?php next_posts_link(); ?>
  82. </div>
  83. </div>
  84. </div>
  85. <?php
  86. endif;
  87. }
  88. add_action( 'cyberchimps_after_content', 'cyberchimps_next_previous_posts' );
  89. if ( ! function_exists( 'cyberchimps_theme_check' ) ) :
  90. // core options customization Names and URL's
  91. //Pro or Free has to stay prepended with cyberchimps_
  92. function cyberchimps_theme_check() {
  93. $level = 'free';
  94. return $level;
  95. }
  96. endif;
  97. //Theme Name
  98. function ifeature_options_theme_name(){
  99. $text = 'iFeature';
  100. return $text;
  101. }
  102. //Doc's URL
  103. function ifeature_options_documentation_url() {
  104. $url = 'http://cyberchimps.com/help/';
  105. return $url;
  106. }
  107. // Support Forum URL
  108. function ifeature_options_support_forum() {
  109. $url = 'http://cyberchimps.com/forum/pro/';
  110. return $url;
  111. }
  112. //Page Options Help URL
  113. function ifeature_options_page_options_help() {
  114. $url = 'http://cyberchimps.com/element-how-tos/';
  115. return $url;
  116. }
  117. // Slider Options Help URL
  118. function ifeature_options_slider_options_help() {
  119. $url = 'http://cyberchimps.com/faq/how-to-use-the-ifeature-pro-slider/';
  120. return $url;
  121. }
  122. add_filter( 'cyberchimps_current_theme_name', 'ifeature_options_theme_name', 1 );
  123. add_filter( 'cyberchimps_documentation', 'ifeature_options_documentation_url' );
  124. add_filter( 'cyberchimps_support_forum', 'ifeature_options_support_forum' );
  125. add_filter( 'cyberchimps_page_options_help', 'ifeature_options_page_options_help' );
  126. add_filter( 'cyberchimps_slider_options_help', 'ifeature_options_slider_options_help' );
  127. //upgrade bar
  128. function ifeature_upgrade_title(){
  129. $title = 'iFeature Pro 5';
  130. return $title;
  131. }
  132. function ifeature_upgrade_link(){
  133. $link = 'http://cyberchimps.com/ifeaturepro/';
  134. return $link;
  135. }
  136. add_filter( 'cyberchimps_upgrade_pro_title', 'ifeature_upgrade_title' );
  137. add_filter( 'cyberchimps_upgrade_link', 'ifeature_upgrade_link' );
  138. // Help Section
  139. function ifeature_options_help_header() {
  140. $text = 'iFeature';
  141. return $text;
  142. }
  143. function ifeature_options_help_sub_header(){
  144. $text = __( 'iFeature Responsive Drag and Drop WordPress Theme', 'cyberchimps' );
  145. return $text;
  146. }
  147. add_filter( 'cyberchimps_help_heading', 'ifeature_options_help_header' );
  148. add_filter( 'cyberchimps_help_sub_heading', 'ifeature_options_help_sub_header' );
  149. // Branding images and defaults
  150. // Banner default
  151. function ifeature_banner_default() {
  152. $url = '/images/branding/banner.jpg';
  153. return $url;
  154. }
  155. add_filter( 'cyberchimps_banner_img', 'ifeature_banner_default' );
  156. //slider defaults
  157. function ifeature_slider_image_1() {
  158. $image = '/images/branding/ifp5slider.jpg';
  159. return $image;
  160. }
  161. //add same image to all 3 slider image filters
  162. add_filter( 'cyberchimps_slide_pro_img1', 'ifeature_slider_image_1' );
  163. add_filter( 'cyberchimps_slide_pro_img2', 'ifeature_slider_image_1' );
  164. add_filter( 'cyberchimps_slide_pro_img3', 'ifeature_slider_image_1' );
  165. // default background color
  166. function ifeature_default_background_color() {
  167. $color = 'f7f7f7';
  168. return $color;
  169. }
  170. add_filter( 'default_background_color', 'ifeature_default_background_color' );
  171. // default header option
  172. function ifeature_header_drag_and_drop_default() {
  173. $option = array(
  174. 'cyberchimps_logo' => __( 'Logo', 'cyberchimps' )
  175. );
  176. return $option;
  177. }
  178. add_filter( 'header_drag_and_drop_default', 'ifeature_header_drag_and_drop_default' );
  179. // set searchbar by default
  180. function ifeature_searchbar_default() {
  181. $default = 'checked';
  182. return $default;
  183. }
  184. add_filter( 'searchbar_default', 'ifeature_searchbar_default' );
  185. //theme specific skin options in array. Must always include option default
  186. function ifeature_skin_color_options( $options ) {
  187. $options = array(
  188. 'default' => __( 'Default', 'cyberchimps' ),
  189. 'green' => __( 'Green', 'cyberchimps' )
  190. );
  191. return $options;
  192. }
  193. add_filter( 'cyberchimps_skin_color', 'ifeature_skin_color_options', 1 );
  194. // theme specific background images
  195. function ifeature_background_image( $options ) {
  196. $imagepath = get_template_directory_uri() . '/cyberchimps/lib/images/';
  197. $options = array(
  198. 'none' => $imagepath . 'backgrounds/thumbs/none.png',
  199. 'noise' => $imagepath . 'backgrounds/thumbs/noise.png',
  200. 'blue' => $imagepath . 'backgrounds/thumbs/blue.png',
  201. 'dark' => $imagepath . 'backgrounds/thumbs/dark.png',
  202. 'space' => $imagepath . 'backgrounds/thumbs/space.png'
  203. );
  204. return $options;
  205. }
  206. add_filter( 'cyberchimps_background_image', 'ifeature_background_image' );
  207. // theme specific typography options
  208. function ifeature_typography_sizes( $sizes ) {
  209. $sizes = array( '8','9','10','12','14','16','20' );
  210. return $sizes;
  211. }
  212. function ifeature_typography_faces( $faces ) {
  213. $faces = array(
  214. 'Arial, Helvetica, sans-serif' => 'Arial',
  215. 'Arial Black, Gadget, sans-serif' => 'Arial Black',
  216. 'Comic Sans MS, cursive' => 'Comic Sans MS',
  217. 'Courier New, monospace' => 'Courier New',
  218. 'Georgia, serif' => 'Georgia',
  219. 'Impact, Charcoal, sans-serif' => 'Impact',
  220. 'Lucida Console, Monaco, monospace' => 'Lucida Console',
  221. 'Lucida Sans Unicode, Lucida Grande, sans-serif' => 'Lucida Sans Unicode',
  222. 'Palatino Linotype, Book Antiqua, Palatino, serif' => 'Palatino Linotype',
  223. 'Tahoma, Geneva, sans-serif' => 'Tahoma',
  224. 'Times New Roman, Times, serif' => 'Times New Roman',
  225. 'Trebuchet MS, sans-serif' => 'Trebuchet MS',
  226. 'Verdana, Geneva, sans-serif' => 'Verdana',
  227. 'Symbol' => 'Symbol',
  228. 'Webdings' => 'Webdings',
  229. 'Wingdings, Zapf Dingbats' => 'Wingdings',
  230. 'MS Sans Serif, Geneva, sans-serif' => 'MS Sans Serif',
  231. 'MS Serif, New York, serif' => 'MS Serif',
  232. );
  233. return $faces;
  234. }
  235. function ifeature_typography_styles( $styles ) {
  236. $styles = array( 'normal' => 'Normal','bold' => 'Bold' );
  237. return $styles;
  238. }
  239. add_filter( 'cyberchimps_typography_sizes', 'ifeature_typography_sizes' );
  240. add_filter( 'cyberchimps_typography_faces', 'ifeature_typography_faces' );
  241. add_filter( 'cyberchimps_typography_styles', 'ifeature_typography_styles' );
  242. function ifeature_post_tags( $tags ) {
  243. $tag = trim( $tags, 'Tags:' );
  244. $tag = explode( ',', $tag );
  245. $tag = implode( ' ', $tag );
  246. return $tag;
  247. }
  248. add_filter( 'cyberchimps_post_tags', 'ifeature_post_tags' );
  249. /* remove meta seperator */
  250. function ifeature_seperator( $sep ) {
  251. $sep = ' ';
  252. return $sep;
  253. }
  254. add_filter( 'cyberchimps_entry_meta_sep', 'ifeature_seperator' );
  255. //add imenu section
  256. function ifeature_sections_filter( $sections ) {
  257. $new_sections = array( array( 'id' => 'cyberchimps_imenu_section',
  258. 'label' => __('iMenu Options', 'cyberchimps'),
  259. 'heading' => 'cyberchimps_header_heading'
  260. )
  261. );
  262. $sections = array_merge( $sections, $new_sections );
  263. return $sections;
  264. }
  265. add_filter( 'cyberchimps_sections_filter', 'ifeature_sections_filter' );
  266. // add top bar option and add contact information
  267. function ifeature_fields_filter( $fields ) {
  268. $new_fields = array( array( 'name' => __('Menu Home Icon', 'cyberchimps'),
  269. 'id' => 'menu_home_button',
  270. 'type' => 'toggle',
  271. 'std' => 1,
  272. 'section' => 'cyberchimps_imenu_section',
  273. 'heading' => 'cyberchimps_header_heading'
  274. ),
  275. );
  276. $fields = array_merge( $fields, $new_fields );
  277. foreach( $fields as $key => $value ):
  278. // move the search bar to imenu section
  279. if( $value['id'] == 'searchbar' ):
  280. $fields[$key]['section'] = 'cyberchimps_imenu_section';
  281. endif;
  282. endforeach;
  283. return $fields;
  284. }
  285. add_filter( 'cyberchimps_field_filter', 'ifeature_fields_filter', 2 );
  286. //add home button to menu
  287. function ifeature_add_home_menu( $menu, $args ) {
  288. //check if the toggle is set. And if it is, then add the home button to the start of the primary menu.
  289. $is_home = cyberchimps_get_option( 'menu_home_button', 1 );
  290. if( $is_home == 1 && $args->theme_location == 'primary' ) {
  291. $home = '<li id="menu-item-ifeature-home"><a href="'. home_url() .'"><img src="'. get_template_directory_uri() .'/images/home.png" alt="Home" /></a></li>';
  292. $menu = $home . $menu;
  293. }
  294. return $menu;
  295. }
  296. add_filter( 'wp_nav_menu_items', 'ifeature_add_home_menu', 10, 2 );