Advertisement
Guest User

Focus Child Theme functions.php w/code added

a guest
Nov 6th, 2013
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.36 KB | None | 0 0
  1. <?php
  2.  
  3. /** Start the engine */
  4.  
  5. require_once( get_template_directory() . '/lib/init.php' );
  6.  
  7.  
  8.  
  9. /** Child theme (do not remove) */
  10.  
  11. define( 'CHILD_THEME_NAME', 'Focus Child Theme' );
  12.  
  13. define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/focus' );
  14.  
  15.  
  16.  
  17. /** Add Viewport meta tag for mobile browsers */
  18.  
  19. add_action( 'genesis_meta', 'focus_add_viewport_meta_tag' );
  20.  
  21. function focus_add_viewport_meta_tag() {
  22.  
  23.     echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
  24.  
  25. }
  26.  
  27.  
  28.  
  29. /** Create additional color style options */
  30.  
  31. add_theme_support( 'genesis-style-selector', array( 'focus-brown' => 'Brown', 'focus-gray' => 'Gray' ) );
  32.  
  33.  
  34.  
  35. /** Add support for structural wraps */
  36.  
  37. add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) );
  38.  
  39.  
  40.  
  41. /** Add new image sizes */
  42.  
  43. add_image_size( 'grid-thumbnail', 280, 100, TRUE );
  44.  
  45.  
  46.  
  47. /** Add support for custom background */
  48.  
  49. add_custom_background();
  50.  
  51.  
  52.  
  53. /** Add support for custom header */
  54.  
  55. add_theme_support( 'genesis-custom-header', array( 'width' => 1060, 'height' => 120 ) );
  56.  
  57.  
  58.  
  59. /** Reposition the primary navigation */
  60.  
  61. remove_action( 'genesis_after_header', 'genesis_do_nav' );
  62.  
  63. add_action( 'genesis_before_header', 'genesis_do_nav' );
  64.  
  65.  
  66.  
  67. /** Reposition the breadcrumbs */
  68.  
  69. remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
  70.  
  71. add_action( 'genesis_after_header', 'genesis_do_breadcrumbs' );
  72.  
  73.  
  74.  
  75. /** Customize breadcrumbs display */
  76.  
  77. add_filter( 'genesis_breadcrumb_args', 'streamline_breadcrumb_args' );
  78.  
  79. function streamline_breadcrumb_args( $args ) {
  80.  
  81.     $args['home'] = 'Home';
  82.  
  83.     $args['sep'] = ' ';
  84.  
  85.     $args['list_sep'] = ', '; // Genesis 1.5 and later
  86.  
  87.     $args['prefix'] = '<div class="breadcrumb"><div class="inner">';
  88.  
  89.     $args['suffix'] = '</div></div>';
  90.  
  91.     $args['labels']['prefix'] = '';
  92.  
  93.     return $args;
  94.  
  95. }
  96.  
  97.  
  98.  
  99. /** Customize the post info function */
  100.  
  101. add_filter( 'genesis_post_info', 'post_info_filter' );
  102.  
  103. function post_info_filter($post_info) {
  104.  
  105. if (!is_page()) {
  106.  
  107.     $post_info = 'Posted on [post_date] Written by [post_author_posts_link] [post_comments] [post_edit]';
  108.  
  109.     return $post_info;
  110.  
  111. }}
  112.  
  113.  
  114.  
  115. /** Customize the post meta function */
  116.  
  117. add_filter( 'genesis_post_meta', 'post_meta_filter' );
  118.  
  119. function post_meta_filter($post_meta) {
  120.  
  121. if ( !is_page() ) {
  122.  
  123.     $post_meta = '[post_categories before="Filed Under: "] [post_tags before="Tagged: "]';
  124.  
  125.     return $post_meta;
  126.  
  127. }}
  128.  
  129.  
  130.  
  131. /** Modify the size of the Gravatar in the author box */
  132.  
  133. add_filter( 'genesis_author_box_gravatar_size', 'focus_author_box_gravatar_size' );
  134.  
  135. function focus_author_box_gravatar_size($size) {
  136.  
  137.     return '80';
  138.  
  139. }
  140.  
  141.  
  142.  
  143. /** Add the after post section */
  144.  
  145. add_action( 'genesis_after_post_content', 'focus_after_post' );
  146.  
  147. function focus_after_post() {
  148.  
  149.     if ( ! is_singular( 'post' ) )
  150.  
  151.     return;
  152.  
  153.     genesis_widget_area( 'after-post', array(
  154.  
  155.         'before' => '<div class="after-post widget-area">',
  156.  
  157.    ) );
  158.  
  159. }
  160.  
  161.  
  162.  
  163. /** Add support for 3-column footer widgets */
  164.  
  165. add_theme_support( 'genesis-footer-widgets', 3 );
  166.  
  167.  
  168.  
  169. /** Register widget areas */
  170.  
  171. genesis_register_sidebar( array(
  172.  
  173.     'id'                => 'after-post',
  174.  
  175.     'name'          => __( 'After Post', 'focus' ),
  176.  
  177.     'description'   => __( 'This is the after post section.', 'focus' ),
  178.  
  179. ) );
  180.  
  181.  
  182. /** Make event espresso Payment Overview page link you to the events alternate registration URL if it has one - jshields */
  183.  
  184. function espresso_prepare_event_link_fixed ($payment_data) {
  185.     global $wpdb;
  186.     remove_filter('filter_hook_espresso_prepare_event_link', 'espresso_prepare_event_link');
  187.     $sql = "SELECT  ea.event_id, ed.event_name, ed.externalURL FROM " . EVENTS_ATTENDEE_TABLE . " ea";
  188.     $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=ea.event_id";
  189.     $sql .= " WHERE ea.attendee_session='" . $payment_data['attendee_session'] . "'";
  190.     $events = $wpdb->get_results($sql, OBJECT_K);
  191.     $payment_data['event_link'] = '';
  192.     foreach ($events as $event) {
  193.         if (empty($event->externalURL)) {
  194.             $event_url = espresso_reg_url($event->event_id);
  195.         } else {
  196.             $event_url = $event->externalURL;
  197.         }
  198.         $payment_data['event_link'] .= '<a href="' . $event_url . '">' . $event->event_name . '</a><br />';
  199.     }
  200.     return $payment_data;
  201. }
  202. add_filter('filter_hook_espresso_prepare_event_link', 'espresso_prepare_event_link_fixed', 5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement