Advertisement
Guest User

Untitled

a guest
Aug 15th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //* Start the engine
  3. include_once( get_template_directory() . '/lib/init.php' );
  4.  
  5. //* Set Localization (do not remove)
  6. load_child_theme_textdomain( 'lifestyle', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'lifestyle' ) );
  7.  
  8.  
  9. //* Child theme (do not remove)
  10. define( 'CHILD_THEME_NAME', __( 'Lifestyle Pro Theme', 'lifestyle' ) );
  11. define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/lifestyle/' );
  12. define( 'CHILD_THEME_VERSION', '3.0.0' );
  13.  
  14. //* Add HTML5 markup structure
  15. add_theme_support( 'html5' );
  16.  
  17. //* Add viewport meta tag for mobile browsers
  18. add_theme_support( 'genesis-responsive-viewport' );
  19.  
  20. //* Enqueue Droid Sans and Roboto Slab Google fonts
  21. add_action( 'wp_enqueue_scripts', 'lifestyle_google_fonts' );
  22. function lifestyle_google_fonts() {
  23.  
  24.     wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Droid+Sans:400,700|Roboto+Slab:400,300,700', array(), CHILD_THEME_VERSION );
  25.    
  26. }
  27.  
  28. //* Add new image sizes
  29. add_image_size( 'home-large', 634, 360, TRUE );
  30. add_image_size( 'home-small', 266, 160, TRUE );
  31.  
  32. function output_text() {
  33. ?>
  34. <h1 id="titleheader">Engaging stories of love, joy, comfort and friendship with proven scrumptious, healthy recipes, we celebrate LOVE as the secret ingredient for wonderful food! </h1>
  35. <?php }
  36. add_action('genesis_before_loop', 'output_text');
  37.  
  38.  
  39. //* Add support for custom background
  40. add_theme_support( 'custom-background', array(
  41.     'default-image' => get_stylesheet_directory_uri() . '/images/bg.png',
  42.     'default-color' => 'efefe9',
  43. ) );
  44.  
  45. //* Add support for custom header
  46. add_theme_support( 'custom-header', array(
  47.     'header_image'    => '',
  48.     'header-selector' => '.site-title a',
  49.     'header-text'     => true,
  50.     'height'          => 260,
  51.     'width'           => 960,
  52. ) );
  53.  
  54.  
  55. /**
  56. * Genesis Custom Header
  57. *
  58. * @author Geoffrey Rickaby
  59. * @since 1.8.0
  60. *
  61. */
  62.  
  63. remove_action('genesis_header', 'genesis_do_header');
  64. remove_action('genesis_header', 'genesis_header_markup_open', 5);
  65. remove_action('genesis_header', 'genesis_header_markup_close', 15);
  66.  
  67.  
  68. function custom_header() {
  69. ?>
  70. <div id="header">
  71. <div class="h-wrap">
  72. <a href="<?=get_bloginfo('home'); ?>" alt="<?php print get_bloginfo('name') .' - '. get_bloginfo('description'); ?>">
  73. <img src="<?=get_bloginfo('stylesheet_directory'); ?>/images/logo.png" title="<?php print get_bloginfo('name') .' - '. get_bloginfo('description'); ?>"></a>
  74. </div>
  75. </div>
  76. <?php }
  77.  
  78. add_action('genesis_header', 'custom_header');
  79.  
  80.  
  81. //* Add support for additional color style options
  82. add_theme_support( 'genesis-style-selector', array(
  83.     'lifestyle-pro-blue'    => __( 'Lifestyle Pro Blue', 'lifestyle' ),
  84.     'lifestyle-pro-green'   => __( 'Lifestyle Pro Green', 'lifestyle' ),
  85.     'lifestyle-pro-mustard' => __( 'Lifestyle Pro Mustard', 'lifestyle' ),
  86.     'lifestyle-pro-purple'  => __( 'Lifestyle Pro Purple', 'lifestyle' ),
  87.     'lifestyle-pro-red'     => __( 'Lifestyle Pro Red', 'lifestyle' ),
  88. ) );
  89.  
  90. //* Add support for 3-column footer widgets
  91. add_theme_support( 'genesis-footer-widgets', 3 );
  92.  
  93. remove_action( 'genesis_footer', 'genesis_do_footer' );
  94. add_action( 'genesis_footer', 'sp_custom_footer' );
  95. function sp_custom_footer() {
  96. ?>
  97. <p>&middot; All Rights Reserved &middot;<a href="http://lovethesecretingredient.net/about/disclaimer/">&copy; 2011-2014 Love- <span class="secret">the secret ingredient</span>. All rights reserved. Disclaimer |</a>
  98.             <a href="http://lovethesecretingredient.net/about/privacy-policy/">Privacy Policy</a>
  99.             <a href="http://lovethesecretingredient.net/about/disclosure-policy/">Disclosure Policy</a>
  100.             <a href="http://lovethesecretingredient.net/about/terms-conditions/">Terms &amp; Conditions</a></p>
  101. <?php
  102. }
  103.  
  104.  
  105. //* RELATED POSTS
  106.  
  107. add_image_size( 'related', 140, 140, true );
  108.  
  109. //for XHTML themes
  110. add_action( 'genesis_after_entry_content', 'child_related_posts' );
  111.  
  112. function child_related_posts() {
  113.      
  114.     if ( is_single ( ) ) {
  115.          
  116.         global $post;
  117.  
  118.         $count = 0;
  119.         $postIDs = array( $post->ID );
  120.         $related = '';
  121.         $tags = wp_get_post_tags( $post->ID );
  122.         $cats = wp_get_post_categories( $post->ID );
  123.          
  124.         if ( $tags ) {
  125.              
  126.             foreach ( $tags as $tag ) {
  127.                  
  128.                 $tagID[] = $tag->term_id;
  129.                  
  130.             }
  131.              
  132.             $args = array(
  133.                 'tag__in'               => $tagID,
  134.                 'post__not_in'          => $postIDs,
  135.                 'showposts'             => 5,
  136.                 'ignore_sticky_posts'   => 1,
  137.                 'tax_query'             => array(
  138.                     array(
  139.                                         'taxonomy'  => 'post_format',
  140.                                         'field'     => 'slug',
  141.                                         'terms'     => array(
  142.                                             'post-format-link',
  143.                                             'post-format-status',
  144.                                             'post-format-aside',
  145.                                             'post-format-quote'
  146.                                             ),
  147.                                         'operator'  => 'NOT IN'
  148.                     )
  149.                 )
  150.             );
  151.  
  152.             $tag_query = new WP_Query( $args );
  153.              
  154.             if ( $tag_query->have_posts() ) {
  155.                  
  156.                 while ( $tag_query->have_posts() ) {
  157.                      
  158.                     $tag_query->the_post();
  159.  
  160.                     $img = genesis_get_image() ? genesis_get_image( array( 'size' => 'related' ) ) : '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/related.png" alt="' . get_the_title() . '" />';
  161.  
  162.                     $related .= '<li><a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to' . get_the_title() . '">' . $img . get_the_title() . '</a></li>';
  163.                      
  164.                     $postIDs[] = $post->ID;
  165.  
  166.                     $count++;
  167.                 }
  168.             }
  169.         }
  170.  
  171.         if ( $count <= 4 ) {
  172.              
  173.             $catIDs = array( );
  174.  
  175.             foreach ( $cats as $cat ) {
  176.                  
  177.                 if ( 3 == $cat )
  178.                     continue;
  179.                 $catIDs[] = $cat;
  180.                  
  181.             }
  182.              
  183.             $showposts = 5 - $count;
  184.  
  185.             $args = array(
  186.                 'category__in'          => $catIDs,
  187.                 'post__not_in'          => $postIDs,
  188.                 'showposts'             => $showposts,
  189.                 'ignore_sticky_posts'   => 1,
  190.                 'orderby'               => 'rand',
  191.                 'tax_query'             => array(
  192.                                     array(
  193.                                         'taxonomy'  => 'post_format',
  194.                                         'field'     => 'slug',
  195.                                         'terms'     => array(
  196.                                             'post-format-link',
  197.                                             'post-format-status',
  198.                                             'post-format-aside',
  199.                                             'post-format-quote' ),
  200.                                         'operator' => 'NOT IN'
  201.                                     )
  202.                 )
  203.             );
  204.  
  205.             $cat_query = new WP_Query( $args );
  206.              
  207.             if ( $cat_query->have_posts() ) {
  208.                  
  209.                 while ( $cat_query->have_posts() ) {
  210.                      
  211.                     $cat_query->the_post();
  212.  
  213.                     $img = genesis_get_image() ? genesis_get_image( array( 'size' => 'related' ) ) : '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/related.png" alt="' . get_the_title() . '" />';
  214.  
  215.                     $related .= '<li><a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to' . get_the_title() . '">' . $img . get_the_title() . '</a></li>';
  216.                 }
  217.             }
  218.         }
  219.  
  220.         if ( $related ) {
  221.              
  222.             printf( '<div class="related-posts"><h3 class="related-title">You might also like:</h3><ul class="related-list">%s</ul></div>', $related );
  223.          
  224.         }
  225.          
  226.         wp_reset_query();
  227.          
  228.     }
  229. }
  230.  
  231. //* Reposition the primary navigation
  232. remove_action( 'genesis_before_header', 'genesis_do_nav' );
  233. add_action( 'genesis_after_header', 'genesis_do_nav' );
  234.  
  235. //* Hook after post widget after the entry content
  236. add_action( 'genesis_after_entry', 'lifestyle_after_entry', 5 );
  237. function lifestyle_after_entry() {
  238.  
  239.     if ( is_singular( 'post' ) )
  240.         genesis_widget_area( 'after-entry', array(
  241.             'before' => '<div class="after-entry widget-area">',
  242.             'after'  => '</div>',
  243.         ) );
  244.  
  245. }
  246.  
  247. //* Modify the size of the Gravatar in the author box
  248. add_filter( 'genesis_author_box_gravatar_size', 'lifestyle_author_box_gravatar' );
  249. function lifestyle_author_box_gravatar( $size ) {
  250.  
  251.     return 96;
  252.        
  253. }
  254.  
  255. //* Modify the size of the Gravatar in the entry comments
  256. add_filter( 'genesis_comment_list_args', 'lifestyle_comments_gravatar' );
  257. function lifestyle_comments_gravatar( $args ) {
  258.     $args['avatar_size'] = 60;
  259.     return $args;  
  260. }
  261.  
  262. //* Remove comment form allowed tags
  263. add_filter( 'comment_form_defaults', 'lifestyle_remove_comment_form_allowed_tags' );
  264. function lifestyle_remove_comment_form_allowed_tags( $defaults ) {
  265.    
  266.     $defaults['comment_notes_after'] = '';
  267.     return $defaults;
  268.  
  269. }
  270. //* Repositioning the Comments form
  271. remove_action( 'genesis_comments', 'genesis_do_comments' );
  272. add_action( 'genesis_after_comment_form', 'genesis_do_comments' );
  273. //* Register widget areas
  274. genesis_register_sidebar( array(
  275.     'id'          => 'home-top',
  276.     'name'        => __( 'Home - Top', 'lifestyle' ),
  277.     'description' => __( 'This is the top section of the homepage.', 'lifestyle' ),
  278. ) );
  279. genesis_register_sidebar( array(
  280.     'id'          => 'home-middle',
  281.     'name'        => __( 'Home - Middle', 'lifestyle' ),
  282.     'description' => __( 'This is the middle section of the homepage.', 'lifestyle' ),
  283. ) );
  284. genesis_register_sidebar( array(
  285.     'id'          => 'home-bottom-left',
  286.     'name'        => __( 'Home - Bottom Left', 'lifestyle' ),
  287.     'description' => __( 'This is the bottom left section of the homepage.', 'lifestyle' ),
  288. ) );
  289. genesis_register_sidebar( array(
  290.     'id'          => 'home-bottom-right',
  291.     'name'        => __( 'Home - Bottom Right', 'lifestyle' ),
  292.     'description' => __( 'This is the bottom right section of the homepage.', 'lifestyle' ),
  293. ) );
  294. genesis_register_sidebar( array(
  295.     'id'          => 'after-entry',
  296.     'name'        => __( 'After Entry', 'lifestyle' ),
  297.     'description' => __( 'This is the after entry widget area.', 'lifestyle' ),
  298. ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement