Advertisement
Guest User

Untitled

a guest
Jul 8th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.78 KB | None | 0 0
  1. <?php
  2. /*
  3. Author: Eddie Machado
  4. URL: htp://themble.com/bones/
  5.  
  6. This is where you can drop your custom functions or
  7. just edit things like thumbnail sizes, header images,
  8. sidebars, comments, ect.
  9. */
  10.  
  11. /************* INCLUDE NEEDED FILES ***************/
  12.  
  13. /*
  14. 1. library/bones.php
  15.     - head cleanup (remove rsd, uri links, junk css, ect)
  16.     - enqueueing scripts & styles
  17.     - theme support functions
  18.     - custom menu output & fallbacks
  19.     - related post function
  20.     - page-navi function
  21.     - removing <p> from around images
  22.     - customizing the post excerpt
  23.     - custom google+ integration
  24.     - adding custom fields to user profiles
  25. */
  26. require_once('library/bones.php'); // if you remove this, bones will break
  27. /*
  28. 2. library/custom-post-type.php
  29.     - an example custom post type
  30.     - example custom taxonomy (like categories)
  31.     - example custom taxonomy (like tags)
  32. */
  33. require_once('library/custom-post-design-portfolio.php');
  34. require_once('library/custom-post-web-portfolio.php');
  35. require_once('library/custom-post-video-portfolio.php');
  36. require_once('library/custom-post-testimonials.php'); // you can disable this if you like
  37. /*
  38. 3. library/admin.php
  39.     - removing some default WordPress dashboard widgets
  40.     - an example custom dashboard widget
  41.     - adding custom login css
  42.     - changing text in footer of admin
  43. */
  44. // require_once('library/admin.php'); // this comes turned off by default
  45. /*
  46. 4. library/translation/translation.php
  47.     - adding support for other languages
  48. */
  49. // require_once('library/translation/translation.php'); // this comes turned off by default
  50.  
  51. /* library/shortcodes.php
  52.     - adding shortcodes
  53. */
  54. require_once('library/shortcodes.php');
  55. require_once('library/widgets.php');
  56.  
  57. /************* THUMBNAIL SIZE OPTIONS *************/
  58.  
  59. // Thumbnail sizes
  60. add_image_size( 'bones-thumb-600', 600, 150, true );
  61. add_image_size( 'bones-thumb-300', 300, 100, true );
  62. add_image_size( '300x300', 300, 300, true );
  63. /*
  64. to add more sizes, simply copy a line from above
  65. and change the dimensions & name. As long as you
  66. upload a "featured image" as large as the biggest
  67. set width or height, all the other sizes will be
  68. auto-cropped.
  69.  
  70. To call a different size, simply change the text
  71. inside the thumbnail function.
  72.  
  73. For example, to call the 300 x 300 sized image,
  74. we would use the function:
  75. <?php the_post_thumbnail( 'bones-thumb-300' ); ?>
  76. for the 600 x 100 image:
  77. <?php the_post_thumbnail( 'bones-thumb-600' ); ?>
  78.  
  79. You can change the names and dimensions to whatever
  80. you like. Enjoy!
  81. */
  82.  
  83. /************* ACTIVE SIDEBARS ********************/
  84.  
  85. // Sidebars & Widgetizes Areas
  86. function bones_register_sidebars() {
  87.     register_sidebar(array(
  88.         'id' => 'sidebar1',
  89.         'name' => 'Sidebar 1',
  90.         'description' => 'The first (primary) sidebar.',
  91.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  92.         'after_widget' => '</div>',
  93.         'before_title' => '<h4 class="widgettitle">',
  94.         'after_title' => '</h4>',
  95.     ));
  96.     register_sidebar(array(
  97.         'id' => 'footer1',
  98.         'name' => 'Footer Area 1',
  99.         'before_widget' => '',
  100.         'after_widget' => '',
  101.         'before_title' => '<h3>',
  102.         'after_title' => '</h3>',
  103.     ));
  104.     register_sidebar(array(
  105.         'id' => 'footer2',
  106.         'name' => 'Footer Area 2',
  107.         'before_widget' => '',
  108.         'after_widget' => '',
  109.         'before_title' => '<h3>',
  110.         'after_title' => '</h3>',
  111.     ));
  112.     register_sidebar(array(
  113.         'id' => 'footer3',
  114.         'name' => 'Footer Area 3',
  115.         'before_widget' => '',
  116.         'after_widget' => '',
  117.         'before_title' => '<h3>',
  118.         'after_title' => '</h3>',
  119.     ));
  120.     register_sidebar(array(
  121.         'id' => 'footer4',
  122.         'name' => 'Footer Area 4',
  123.         'before_widget' => '',
  124.         'after_widget' => '',
  125.         'before_title' => '<h3>',
  126.         'after_title' => '</h3>',
  127.     ));
  128.    
  129.     /*
  130.     to add more sidebars or widgetized areas, just copy
  131.     and edit the above sidebar code. In order to call
  132.     your new sidebar just use the following code:
  133.    
  134.     Just change the name to whatever your new
  135.     sidebar's id is, for example:
  136.    
  137.     register_sidebar(array(
  138.         'id' => 'sidebar2',
  139.         'name' => 'Sidebar 2',
  140.         'description' => 'The second (secondary) sidebar.',
  141.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  142.         'after_widget' => '</div>',
  143.         'before_title' => '<h4 class="widgettitle">',
  144.         'after_title' => '</h4>',
  145.     ));
  146.    
  147.     To call the sidebar in your template, you can just copy
  148.     the sidebar.php file and rename it to your sidebar's name.
  149.     So using the above example, it would be:
  150.     sidebar-sidebar2.php
  151.    
  152.     */
  153. } // don't remove this bracket!
  154.  
  155.  
  156. /************* COMMENT LAYOUT *********************/
  157.        
  158. // Comment Layout
  159. function bones_comments($comment, $args, $depth) {
  160.    $GLOBALS['comment'] = $comment; ?>
  161.     <li <?php comment_class(); ?>>
  162.         <article id="comment-<?php comment_ID(); ?>" class="clearfix">
  163.             <header class="comment-author vcard">
  164.                 <?php /*
  165.                     this is the new responsive optimized comment image. It used the new HTML5 data-attribute to display comment gravatars on larger screens only. What this means is that on larger posts, mobile sites don't have a ton of requests for comment images. This makes load time incredibly fast! If you'd like to change it back, just replace it with the regular wordpress gravatar call:
  166.                     echo get_avatar($comment,$size='32',$default='<path_to_url>' );
  167.                 */ ?>
  168.                 <!-- custom gravatar call -->
  169.                 <?php $bgauthemail = get_comment_author_email(); ?>
  170.                 <img data-gravatar="http://www.gravatar.com/avatar/<?php echo md5($bgauthemail); ?>&s=32" class="load-gravatar avatar avatar-48 photo" src="<?php echo get_template_directory_uri(); ?>/library/images/nothing.gif" />
  171.                 <!-- end custom gravatar call -->
  172.                 <?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?>
  173.                 <time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time('F jS, Y'); ?> </a></time>
  174.                
  175.                 <?php edit_comment_link(__('(Edit)', 'bonestheme'),'  ','') ?>
  176.             </header>
  177.             <?php if ($comment->comment_approved == '0') : ?>
  178.                 <div class="alert info">
  179.                     <p><?php _e('Your comment is awaiting moderation.', 'bonestheme') ?></p>
  180.                 </div>
  181.             <?php endif; ?>
  182.             <section class="comment_content clearfix">
  183.                 <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  184.                 <?php comment_text() ?>
  185.                
  186.             </section>
  187.            
  188.         </article>
  189.     <!-- </li> is added by WordPress automatically -->
  190. <?php
  191. } // don't remove this bracket!
  192.  
  193. /************* SEARCH FORM LAYOUT *****************/
  194.  
  195. // Search Form
  196. function bones_wpsearch($form) {
  197.     $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
  198.    <label class="screen-reader-text" for="s">' . __('Search for:', 'bonestheme') . '</label>
  199.    <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="'.esc_attr__('Search the Site...','bonestheme').'" />
  200.    <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
  201.    </form>';
  202.     return $form;
  203. } // don't remove this bracket!
  204.  
  205. add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
  206. add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
  207.  
  208. function remove_width_attribute( $html ) {
  209.    $html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
  210.    return $html;
  211. }
  212.  
  213. // ini_set( 'mysql.trace_mode', 0 );
  214.  
  215. /*Remove empty paragraph tags from the_content*/
  216. function removeEmptyParagraphs($content) {
  217.  
  218.     $pattern = "/<p[^>]*><\\/p[^>]*>/";  
  219.     $content = preg_replace($pattern, '', $content);
  220.     $content = str_replace("<p></p>","",$content);
  221.     return $content;
  222. }
  223.  
  224. add_filter('the_content', 'removeEmptyParagraphs', 7);
  225.  
  226. /*
  227. add_filter("gform_pre_submission_filter_2", "split_name");
  228.  
  229. function split_name($entry){
  230.  
  231.     $name = $entry[1];
  232.    
  233.     $names = explode(" ", $name);
  234.  
  235.     $firstname = $names[0];
  236.     $lastname = end($names);
  237.  
  238.     //setting notification BCC field to the list of fields
  239.  
  240.     $entry["3.3"] = "O";
  241.     $entry["3.6"] = "B";
  242.  
  243.     //returning modified form object
  244.  
  245.     return $entry;
  246.  
  247. }
  248.  
  249. add_action("gform_post_submission", "set_post_content", 10, 2);
  250.  function set_post_content($entry, $form){
  251.  //Gravity Forms has validated the data
  252.  //Our Custom Form Submitted via PHP will go here
  253.  
  254.  // Lets get the IDs of the relevant fields and prepare an email message
  255.  $message = print_r($entry, true);
  256.  
  257.  // In case any of our lines are larger than 70 characters, we should use wordwrap()
  258.  $message = wordwrap($message, 70);
  259.  
  260.  // Send
  261.  mail('olly@rocksoliddesigns.co.uk', 'Getting the Gravity Form Field IDs', $message);
  262.  }
  263. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement