Advertisement
Guest User

Functions.php sample

a guest
Apr 24th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.62 KB | None | 0 0
  1. <?php
  2. /** Start the engine */
  3. require_once( get_template_directory() . '/lib/init.php' );
  4.  
  5. /** Child theme (do not remove) */
  6. define( 'CHILD_THEME_NAME', 'News Theme' );
  7. define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/news' );
  8.  
  9. /** Add Viewport meta tag for mobile browsers */
  10. add_action( 'genesis_meta', 'news_add_viewport_meta_tag' );
  11. function news_add_viewport_meta_tag() {
  12.     echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
  13. }
  14.  
  15. $content_width = apply_filters( 'content_width', 580, 430, 910 );
  16.  
  17. /** Create additional color style options */
  18. add_theme_support( 'genesis-style-selector', array(
  19.     'news-green'        => 'Green',
  20.     'news-orange'   => 'Orange',
  21.     'news-pink'         => 'Pink',
  22.     'news-purple'       => 'Purple',
  23.     'news-red'          => 'Red',
  24.     'news-teal'         => 'Teal'
  25. ) );
  26.  
  27. /** Add support for structural wraps */
  28. add_theme_support( 'genesis-structural-wraps', array(
  29.     'header',
  30.     'nav',
  31.     'subnav',
  32.     'inner',
  33.     'footer-widgets',
  34.     'footer'
  35. ) );
  36.  
  37. /** Add after post ad section */
  38. add_action( 'genesis_after_post_content', 'news_after_post_ad', 9 );
  39. function news_after_post_ad() {
  40.     if ( is_single() && is_active_sidebar( 'after-post-ad' ) ) {
  41.     echo '<div class="after-post-ad">';
  42.     dynamic_sidebar( 'after-post-ad' );
  43.     echo '</div><!-- end .after-post-ad -->';
  44.     }
  45. }
  46.  
  47. /** Add new image sizes */
  48. add_image_size( 'home-bottom', 110, 110, TRUE );
  49. add_image_size( 'home-middle-left', 280, 165, TRUE );
  50. add_image_size( 'home-middle-right', 50, 50, TRUE );
  51. add_image_size( 'home-tabs', 150, 220, TRUE );
  52.  
  53. /** Add support for custom header */
  54. add_theme_support( 'genesis-custom-header', array(
  55.     'width' => 960,
  56.     'height'    => 100
  57. ) );
  58.  
  59. /** Add support for custom background */
  60. add_theme_support( 'custom-background' );
  61.  
  62. /** Remove the post meta function */
  63. remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
  64.  
  65.  
  66.  
  67. /** Modify the author box title */
  68. add_filter( 'genesis_author_box_title', 'author_box_title' );
  69. function author_box_title() {
  70.     return '<h2>About the Author</h2>';
  71. }
  72.  
  73. /** Customize the entire footer */
  74. remove_action( 'genesis_footer', 'genesis_do_footer' );
  75. add_action( 'genesis_footer', 'custom_footer' );
  76. function custom_footer() {
  77.     ?>
  78.     <p>&copy; Copyright 2013 <a href="http://www.virtualizationsoftware.com/">VirtualizationSoftware.com</a> &middot; All Rights Reserved</p>
  79.     <?php
  80. }
  81.  
  82. //***Customize the Post Info**/
  83. add_filter( 'genesis_post_info', 'bourncreative_post_info_filter' );
  84. function bourncreative_post_info_filter( $post_info ) {
  85.  
  86.     return 'By [post_author_posts_link] | [post_date] | <a href="' . get_permalink() . '#disqus_thread">View Comments</a>';
  87. }
  88.  
  89.  
  90. /** Reposition the secondary navigation */
  91. remove_action( 'genesis_after_header', 'genesis_do_subnav' );
  92. add_action( 'genesis_before', 'genesis_do_subnav' );
  93.  
  94.  
  95. /** Add after content ad section */
  96. add_action( 'genesis_before_footer', 'news_after_content_ad' );
  97. function news_after_content_ad() {
  98.     if ( is_active_sidebar( 'after-content-ad' ) ) {
  99.     echo '<div class="after-content-ad">';
  100.     dynamic_sidebar( 'after-content-ad' );
  101.     echo '</div><!-- end .after-content-ad -->';
  102.     }
  103. }
  104.  
  105.  
  106. /** Customize the post meta function */
  107. add_filter( 'genesis_post_meta', 'post_meta_filter' );
  108. function post_meta_filter($post_meta) {
  109. if ( !is_page() ) {
  110.     $post_meta = '[post_tags before="Dive Deeper: "]';
  111.     return $post_meta;
  112. }}
  113.  
  114. /** Add support for 3-column footer widgets */
  115. add_theme_support( 'genesis-footer-widgets', 3 );
  116.  
  117. /** Register widget areas */
  118. genesis_register_sidebar( array(
  119.     'id'                => 'home-top',
  120.     'name'          => __( 'Home Top', 'news' ),
  121.     'description'   => __( 'This is the home top section.', 'news' ),
  122. ) );
  123. genesis_register_sidebar( array(
  124.     'id'                => 'home-middle-left',
  125.     'name'          => __( 'Home Middle Left', 'news' ),
  126.     'description'   => __( 'This is the home middle left section.', 'news' ),
  127. ) );
  128. genesis_register_sidebar( array(
  129.     'id'                => 'home-middle-right',
  130.     'name'          => __( 'Home Middle Right', 'news' ),
  131.     'description'   => __( 'This is the home middle right section.', 'news' ),
  132. ) );
  133. genesis_register_sidebar( array(
  134.     'id'                => 'home-bottom',
  135.     'name'          => __( 'Home Bottom', 'news' ),
  136.     'description'   => __( 'This is the home bottom section.', 'news' ),
  137. ) );
  138. genesis_register_sidebar( array(
  139.     'id'                => 'after-post-ad',
  140.     'name'          => __( 'After Post Ad', 'news' ),
  141.     'description'   => __( 'This is the after post ad section.', 'news' ),
  142. ) );
  143. genesis_register_sidebar( array(
  144.     'id'                => 'after-content-ad',
  145.     'name'          => __( 'After Content Ad', 'news' ),
  146.     'description'   => __( 'This is the after content ad section.', 'news' ),
  147. ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement