PageRenderTime 53ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/sharpmachine/wakeupmedia.com
PHP | 717 lines | 397 code | 66 blank | 254 comment | 22 complexity | 2b45a8a209fbd0843c2c6162c916433b MD5 | raw file
  1. <?php remove_action('wp_head', 'wp_generator'); ?>
  2. <?php
  3. /**
  4. * TwentyTen functions and definitions
  5. *
  6. * Sets up the theme and provides some helper functions. Some helper functions
  7. * are used in the theme as custom template tags. Others are attached to action and
  8. * filter hooks in WordPress to change core functionality.
  9. *
  10. * The first function, twentyten_setup(), sets up the theme by registering support
  11. * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
  12. *
  13. * When using a child theme (see http://codex.wordpress.org/Theme_Development and
  14. * http://codex.wordpress.org/Child_Themes), you can override certain functions
  15. * (those wrapped in a function_exists() call) by defining them first in your child theme's
  16. * functions.php file. The child theme's functions.php file is included before the parent
  17. * theme's file, so the child theme functions would be used.
  18. *
  19. * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
  20. * to a filter or action hook. The hook can be removed by using remove_action() or
  21. * remove_filter() and you can attach your own function to the hook.
  22. *
  23. * We can remove the parent theme's hook only after it is attached, which means we need to
  24. * wait until setting up the child theme:
  25. *
  26. * <code>
  27. * add_action( 'after_setup_theme', 'my_child_theme_setup' );
  28. * function my_child_theme_setup() {
  29. * // We are providing our own filter for excerpt_length (or using the unfiltered value)
  30. * remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
  31. * ...
  32. * }
  33. * </code>
  34. *
  35. * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
  36. *
  37. * @package WordPress
  38. * @subpackage Twenty_Ten
  39. * @since Twenty Ten 1.0
  40. */
  41. /**
  42. * Set the content width based on the theme's design and stylesheet.
  43. *
  44. * Used to set the width of images and content. Should be equal to the width the theme
  45. * is designed for, generally via the style.css stylesheet.
  46. */
  47. if ( ! isset( $content_width ) )
  48. $content_width = 915;
  49. /** Tell WordPress to run twentyten_setup() when the 'after_setup_theme' hook is run. */
  50. add_action( 'after_setup_theme', 'twentyten_setup' );
  51. if ( ! function_exists( 'twentyten_setup' ) ):
  52. /**
  53. * Sets up theme defaults and registers support for various WordPress features.
  54. *
  55. * Note that this function is hooked into the after_setup_theme hook, which runs
  56. * before the init hook. The init hook is too late for some features, such as indicating
  57. * support post thumbnails.
  58. *
  59. * To override twentyten_setup() in a child theme, add your own twentyten_setup to your child theme's
  60. * functions.php file.
  61. *
  62. * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
  63. * @uses register_nav_menus() To add support for navigation menus.
  64. * @uses add_custom_background() To add support for a custom background.
  65. * @uses add_editor_style() To style the visual editor.
  66. * @uses load_theme_textdomain() For translation/localization support.
  67. * @uses add_custom_image_header() To add support for a custom header.
  68. * @uses register_default_headers() To register the default custom header images provided with the theme.
  69. * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
  70. *
  71. * @since Twenty Ten 1.0
  72. */
  73. function twentyten_setup() {
  74. // This theme styles the visual editor with editor-style.css to match the theme style.
  75. add_editor_style();
  76. // Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories.
  77. // add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
  78. // This theme uses post thumbnails
  79. add_theme_support( 'post-thumbnails' );
  80. // Add default posts and comments RSS feed links to head
  81. add_theme_support( 'automatic-feed-links' );
  82. // Make theme available for translation
  83. // Translations can be filed in the /languages/ directory
  84. load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' );
  85. $locale = get_locale();
  86. $locale_file = TEMPLATEPATH . "/languages/$locale.php";
  87. if ( is_readable( $locale_file ) )
  88. require_once( $locale_file );
  89. // This theme uses wp_nav_menu() in one location.
  90. register_nav_menus( array(
  91. 'primary' => __( 'Primary Navigation', 'twentyten' ),
  92. ) );
  93. // Your changeable header business starts here
  94. if ( ! defined( 'HEADER_TEXTCOLOR' ) )
  95. define( 'HEADER_TEXTCOLOR', '' );
  96. // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
  97. if ( ! defined( 'HEADER_IMAGE' ) )
  98. define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' );
  99. // The height and width of your custom header. You can hook into the theme's own filters to change these values.
  100. // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
  101. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
  102. define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );
  103. // We'll be using post thumbnails for custom header images on posts and pages.
  104. // We want them to be 940 pixels wide by 198 pixels tall.
  105. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
  106. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
  107. // Don't support text inside the header image.
  108. if ( ! defined( 'NO_HEADER_TEXT' ) )
  109. define( 'NO_HEADER_TEXT', true );
  110. // Add a way for the custom header to be styled in the admin panel that controls
  111. // custom headers. See twentyten_admin_header_style(), below.
  112. // ... and thus ends the changeable header business.
  113. // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
  114. register_default_headers( array(
  115. 'berries' => array(
  116. 'url' => '%s/images/headers/berries.jpg',
  117. 'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
  118. /* translators: header image description */
  119. 'description' => __( 'Berries', 'twentyten' )
  120. ),
  121. 'cherryblossom' => array(
  122. 'url' => '%s/images/headers/cherryblossoms.jpg',
  123. 'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
  124. /* translators: header image description */
  125. 'description' => __( 'Cherry Blossoms', 'twentyten' )
  126. ),
  127. 'concave' => array(
  128. 'url' => '%s/images/headers/concave.jpg',
  129. 'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',
  130. /* translators: header image description */
  131. 'description' => __( 'Concave', 'twentyten' )
  132. ),
  133. 'fern' => array(
  134. 'url' => '%s/images/headers/fern.jpg',
  135. 'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
  136. /* translators: header image description */
  137. 'description' => __( 'Fern', 'twentyten' )
  138. ),
  139. 'forestfloor' => array(
  140. 'url' => '%s/images/headers/forestfloor.jpg',
  141. 'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
  142. /* translators: header image description */
  143. 'description' => __( 'Forest Floor', 'twentyten' )
  144. ),
  145. 'inkwell' => array(
  146. 'url' => '%s/images/headers/inkwell.jpg',
  147. 'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
  148. /* translators: header image description */
  149. 'description' => __( 'Inkwell', 'twentyten' )
  150. ),
  151. 'path' => array(
  152. 'url' => '%s/images/headers/path.jpg',
  153. 'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',
  154. /* translators: header image description */
  155. 'description' => __( 'Path', 'twentyten' )
  156. ),
  157. 'sunset' => array(
  158. 'url' => '%s/images/headers/sunset.jpg',
  159. 'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
  160. /* translators: header image description */
  161. 'description' => __( 'Sunset', 'twentyten' )
  162. )
  163. ) );
  164. }
  165. endif;
  166. if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
  167. /**
  168. * Styles the header image displayed on the Appearance > Header admin panel.
  169. *
  170. * Referenced via add_custom_image_header() in twentyten_setup().
  171. *
  172. * @since Twenty Ten 1.0
  173. */
  174. function twentyten_admin_header_style() {
  175. ?>
  176. <style type="text/css">
  177. /* Shows the same border as on front end */
  178. #headimg {
  179. border-bottom: 1px solid #000;
  180. border-top: 4px solid #000;
  181. }
  182. /* If NO_HEADER_TEXT is false, you would style the text with these selectors:
  183. #headimg #name { }
  184. #headimg #desc { }
  185. */
  186. </style>
  187. <?php
  188. }
  189. endif;
  190. /**
  191. * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
  192. *
  193. * To override this in a child theme, remove the filter and optionally add
  194. * your own function tied to the wp_page_menu_args filter hook.
  195. *
  196. * @since Twenty Ten 1.0
  197. */
  198. function twentyten_page_menu_args( $args ) {
  199. $args['show_home'] = true;
  200. return $args;
  201. }
  202. add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
  203. /**
  204. * Sets the post excerpt length to 40 characters.
  205. *
  206. * To override this length in a child theme, remove the filter and add your own
  207. * function tied to the excerpt_length filter hook.
  208. *
  209. * @since Twenty Ten 1.0
  210. * @return int
  211. */
  212. function twentyten_excerpt_length( $length ) {
  213. return 30;
  214. }
  215. add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
  216. /**
  217. * Returns a "Continue Reading" link for excerpts
  218. *
  219. * @since Twenty Ten 1.0
  220. * @return string "Continue Reading" link
  221. */
  222. function twentyten_continue_reading_link() {
  223. return ' <a class="read-more" href="'. get_permalink() . '">' . __( 'Read More...', 'twentyten' ) . '</a>';
  224. }
  225. /**
  226. * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
  227. *
  228. * To override this in a child theme, remove the filter and add your own
  229. * function tied to the excerpt_more filter hook.
  230. *
  231. * @since Twenty Ten 1.0
  232. * @return string An ellipsis
  233. */
  234. function twentyten_auto_excerpt_more( $more ) {
  235. return ' &hellip;' . twentyten_continue_reading_link();
  236. }
  237. add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
  238. /**
  239. * Adds a pretty "Continue Reading" link to custom post excerpts.
  240. *
  241. * To override this link in a child theme, remove the filter and add your own
  242. * function tied to the get_the_excerpt filter hook.
  243. *
  244. * @since Twenty Ten 1.0
  245. * @return string Excerpt with a pretty "Continue Reading" link
  246. */
  247. function twentyten_custom_excerpt_more( $output ) {
  248. if ( has_excerpt() && ! is_attachment() ) {
  249. $output .= twentyten_continue_reading_link();
  250. }
  251. return $output;
  252. }
  253. add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
  254. /**
  255. * Remove inline styles printed when the gallery shortcode is used.
  256. *
  257. * Galleries are styled by the theme in Twenty Ten's style.css. This is just
  258. * a simple filter call that tells WordPress to not use the default styles.
  259. *
  260. * @since Twenty Ten 1.2
  261. */
  262. add_filter( 'use_default_gallery_style', '__return_false' );
  263. /**
  264. * Deprecated way to remove inline styles printed when the gallery shortcode is used.
  265. *
  266. * This function is no longer needed or used. Use the use_default_gallery_style
  267. * filter instead, as seen above.
  268. *
  269. * @since Twenty Ten 1.0
  270. * @deprecated Deprecated in Twenty Ten 1.2 for WordPress 3.1
  271. *
  272. * @return string The gallery style filter, with the styles themselves removed.
  273. */
  274. function twentyten_remove_gallery_css( $css ) {
  275. return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
  276. }
  277. // Backwards compatibility with WordPress 3.0.
  278. if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) )
  279. add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
  280. if ( ! function_exists( 'twentyten_comment' ) ) :
  281. /**
  282. * Template for comments and pingbacks.
  283. *
  284. * To override this walker in a child theme without modifying the comments template
  285. * simply create your own twentyten_comment(), and that function will be used instead.
  286. *
  287. * Used as a callback by wp_list_comments() for displaying the comments.
  288. *
  289. * @since Twenty Ten 1.0
  290. */
  291. function twentyten_comment( $comment, $args, $depth ) {
  292. $GLOBALS['comment'] = $comment;
  293. switch ( $comment->comment_type ) :
  294. case '' :
  295. ?>
  296. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  297. <div id="comment-<?php comment_ID(); ?>">
  298. <div class="comment-author vcard">
  299. <?php echo get_avatar( $comment, 40 ); ?>
  300. <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
  301. </div><!-- .comment-author .vcard -->
  302. <?php if ( $comment->comment_approved == '0' ) : ?>
  303. <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
  304. <br />
  305. <?php endif; ?>
  306. <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
  307. <?php
  308. /* translators: 1: date, 2: time */
  309. printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
  310. ?>
  311. </div><!-- .comment-meta .commentmetadata -->
  312. <div class="comment-body"><?php comment_text(); ?></div>
  313. <div class="reply">
  314. <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  315. </div><!-- .reply -->
  316. </div><!-- #comment-## -->
  317. <?php
  318. break;
  319. case 'pingback' :
  320. case 'trackback' :
  321. ?>
  322. <li class="post pingback">
  323. <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
  324. <?php
  325. break;
  326. endswitch;
  327. }
  328. endif;
  329. /**
  330. * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
  331. *
  332. * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
  333. * function tied to the init hook.
  334. *
  335. * @since Twenty Ten 1.0
  336. * @uses register_sidebar
  337. */
  338. function twentyten_widgets_init() {
  339. // Area 1, located at the top of the sidebar.
  340. register_sidebar( array(
  341. 'name' => __( 'Primary Widget Area', 'twentyten' ),
  342. 'id' => 'primary-widget-area',
  343. 'description' => __( 'The primary widget area', 'twentyten' ),
  344. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  345. 'after_widget' => '</li>',
  346. 'before_title' => '<h3 class="widget-title">',
  347. 'after_title' => '</h3>',
  348. ) );
  349. // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
  350. register_sidebar( array(
  351. 'name' => __( 'Secondary Widget Area', 'twentyten' ),
  352. 'id' => 'secondary-widget-area',
  353. 'description' => __( 'The secondary widget area', 'twentyten' ),
  354. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  355. 'after_widget' => '</li>',
  356. 'before_title' => '<h3 class="widget-title">',
  357. 'after_title' => '</h3>',
  358. ) );
  359. // Area 3, located in the footer. Empty by default.
  360. register_sidebar( array(
  361. 'name' => __( 'First Footer Widget Area', 'twentyten' ),
  362. 'id' => 'first-footer-widget-area',
  363. 'description' => __( 'The first footer widget area', 'twentyten' ),
  364. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  365. 'after_widget' => '</li>',
  366. 'before_title' => '<h3 class="widget-title">',
  367. 'after_title' => '</h3>',
  368. ) );
  369. // Area 4, located in the footer. Empty by default.
  370. register_sidebar( array(
  371. 'name' => __( 'Second Footer Widget Area', 'twentyten' ),
  372. 'id' => 'second-footer-widget-area',
  373. 'description' => __( 'The second footer widget area', 'twentyten' ),
  374. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  375. 'after_widget' => '</li>',
  376. 'before_title' => '<h3 class="widget-title">',
  377. 'after_title' => '</h3>',
  378. ) );
  379. // Area 5, located in the footer. Empty by default.
  380. register_sidebar( array(
  381. 'name' => __( 'Third Footer Widget Area', 'twentyten' ),
  382. 'id' => 'third-footer-widget-area',
  383. 'description' => __( 'The third footer widget area', 'twentyten' ),
  384. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  385. 'after_widget' => '</li>',
  386. 'before_title' => '<h3 class="widget-title">',
  387. 'after_title' => '</h3>',
  388. ) );
  389. // Area 6, located in the footer. Empty by default.
  390. register_sidebar( array(
  391. 'name' => __( 'Fourth Footer Widget Area', 'twentyten' ),
  392. 'id' => 'fourth-footer-widget-area',
  393. 'description' => __( 'The fourth footer widget area', 'twentyten' ),
  394. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  395. 'after_widget' => '</li>',
  396. 'before_title' => '<h3 class="widget-title">',
  397. 'after_title' => '</h3>',
  398. ) );
  399. }
  400. /** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
  401. add_action( 'widgets_init', 'twentyten_widgets_init' );
  402. /**
  403. * Removes the default styles that are packaged with the Recent Comments widget.
  404. *
  405. * To override this in a child theme, remove the filter and optionally add your own
  406. * function tied to the widgets_init action hook.
  407. *
  408. * This function uses a filter (show_recent_comments_widget_style) new in WordPress 3.1
  409. * to remove the default style. Using Twenty Ten 1.2 in WordPress 3.0 will show the styles,
  410. * but they won't have any effect on the widget in default Twenty Ten styling.
  411. *
  412. * @since Twenty Ten 1.0
  413. */
  414. function twentyten_remove_recent_comments_style() {
  415. add_filter( 'show_recent_comments_widget_style', '__return_false' );
  416. }
  417. add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
  418. if ( ! function_exists( 'twentyten_posted_on' ) ) :
  419. /**
  420. * Prints HTML with meta information for the current post-date/time and author.
  421. *
  422. * @since Twenty Ten 1.0
  423. */
  424. function twentyten_posted_on() {
  425. printf( __( '<span class="meta-sep">By</span> %3$s<span class="%1$s"> |</span> %2$s ', 'twentyten' ),
  426. 'meta-prep meta-prep-author',
  427. sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
  428. get_permalink(),
  429. esc_attr( get_the_time() ),
  430. get_the_date()
  431. ),
  432. sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  433. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  434. sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
  435. get_the_author()
  436. )
  437. );
  438. }
  439. endif;
  440. if ( ! function_exists( 'twentyten_posted_on_older_articles' ) ) :
  441. /**
  442. * Prints HTML with meta information for the current post-date/time and author.
  443. *
  444. * @since Twenty Ten 1.0
  445. */
  446. function twentyten_posted_on_older_articles() {
  447. printf( __( 'Posted on %2$s by %3$s', 'twentyten' ),
  448. 'meta-prep meta-prep-author',
  449. sprintf( '<span class="entry-date">%3$s</span>',
  450. get_permalink(),
  451. esc_attr( get_the_time() ),
  452. get_the_date()
  453. ),
  454. sprintf( '<span class="author vcard">%3$s</span>',
  455. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  456. sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
  457. get_the_author()
  458. )
  459. );
  460. }
  461. endif;
  462. if ( ! function_exists( 'twentyten_posted_on_debra' ) ) :
  463. /**
  464. * Prints HTML with meta information for the current post-date/time and author.
  465. *
  466. * @since Twenty Ten 1.0
  467. */
  468. function twentyten_posted_on_debra() {
  469. printf( __( '<span class="meta-sep">By </span> <a href="../articles-debra">Debra</a><span class="%1$s"> |</span> %2$s ', 'twentyten' ),
  470. 'meta-prep meta-prep-author',
  471. sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
  472. get_permalink(),
  473. esc_attr( get_the_time() ),
  474. get_the_date()
  475. ),
  476. sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  477. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  478. sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
  479. get_the_author()
  480. )
  481. );
  482. }
  483. endif;
  484. if ( ! function_exists( 'twentyten_posted_on_brigitte' ) ) :
  485. /**
  486. * Prints HTML with meta information for the current post-date/time and author.
  487. *
  488. * @since Twenty Ten 1.0
  489. */
  490. function twentyten_posted_on_brigitte() {
  491. printf( __( '<span class="meta-sep">By </span> <a href="../articles-brigitte">Brigitte</a><span class="%1$s"> |</span> %2$s ', 'twentyten' ),
  492. 'meta-prep meta-prep-author',
  493. sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
  494. get_permalink(),
  495. esc_attr( get_the_time() ),
  496. get_the_date()
  497. ),
  498. sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  499. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  500. sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
  501. get_the_author()
  502. )
  503. );
  504. }
  505. endif;
  506. if ( ! function_exists( 'twentyten_posted_in' ) ) :
  507. /**
  508. * Prints HTML with meta information for the current post (category, tags and permalink).
  509. *
  510. * @since Twenty Ten 1.0
  511. */
  512. function twentyten_posted_in() {
  513. // Retrieves tag list of current post, separated by commas.
  514. $tag_list = get_the_tag_list( '', ', ' );
  515. if ( $tag_list ) {
  516. $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
  517. } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
  518. $posted_in = __( 'This entry was posted in %1$s.', 'twentyten' );
  519. } else {
  520. $posted_in = __( '', 'twentyten' );
  521. }
  522. // Prints the string, replacing the placeholders.
  523. printf(
  524. $posted_in,
  525. get_the_category_list( ', ' ),
  526. $tag_list,
  527. get_permalink(),
  528. the_title_attribute( 'echo=0' )
  529. );
  530. }
  531. endif;
  532. // Custom Functions
  533. function remove_dashboard_widgets(){
  534. global$wp_meta_boxes;
  535. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
  536. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  537. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  538. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  539. unset($wp_meta_boxes['dashboard']['normal']['core']['yoast_db_widget']);
  540. }
  541. add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
  542. function modify_footer_admin () {
  543. echo 'Created by <a href="http://sharpmachinemedia.com">Sharp Machine Media</a>.';
  544. echo ' Powered by <a href="http://WordPress.org">WordPress</a>.';
  545. }
  546. add_filter('admin_footer_text', 'modify_footer_admin');
  547. //Custom logo should be 16 x16
  548. function custom_logo() {
  549. echo '<style type="text/css">
  550. #header-logo {
  551. background-image: url('.get_bloginfo('template_directory').'/images/admin-logo.png) !important;
  552. }
  553. #cpt_info_box {
  554. display: none !important; /* Hides Custom Post Type info box */
  555. }
  556. </style>';
  557. }
  558. add_action('admin_head', 'custom_logo');
  559. function custom_login_logo() {
  560. echo '<style type="text/css">
  561. h1 a
  562. {
  563. background-image:url('.get_bloginfo('template_directory').'/images/home-logo.png) !important;
  564. height: 161px;
  565. }
  566. </style>';
  567. }
  568. add_action('login_head', 'custom_login_logo');
  569. // Create the function to output the contents of our Dashboard Widget
  570. function help_dashboard_widget_function() {
  571. // Display whatever it is you want to show
  572. echo "
  573. <ul style=width:40%;float:left;margin-right:55px;min-width:153px;>
  574. <li style=color:#666;font-size:14px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DFDFDF;padding-bottom:5px;margin-bottom:10px;>WordPress 101 Videos:</li>
  575. <li><a href=http://wp.tutsplus.com/tutorials/wp101-video-training-part-1-the-dashboard/ target=_blank>The Dashboard</a></li>
  576. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-2-creating-a-new-post/ target=_blank>Creating A New Post</a></li>
  577. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-3-edit-existing-post/ target=_blank>Edit Existing Post</a></li>
  578. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-4-using-categories-and-tags/ target=_blank>Using Categories and Tag</a></li>
  579. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-5-creating-and-editing-pages/ target=_blank>Creating and Editing Pages</a></li>
  580. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-6-adding-images/ target=_blank>Adding Images &amp; Photos</a></li>
  581. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-7-embedding-video/ target=_blank>How to Embed Video</a></li>
  582. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-8-media-library/ target=_blank>Using the Media Library</a></li>
  583. <li><a href=http://wp.tutsplus.com/tutorials/wp-101-video-training-part-15-users/ target=_blank>Adding New Users</a></li>
  584. </ul>
  585. <ul style=width:40%;float:left;min-width:153px;>
  586. <li style=color:#666;font-size:14px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DFDFDF;padding-bottom:5px;margin-bottom:10px;>Videos Specific To Your Site:</li>
  587. <li><a href=http://www.youtube.com/watch?v=IE_10_nwe0c target=_blank>SEO Ultimate Tutorial</a></li>
  588. <li><a href=http://www.youtube.com/watch?v=URuHEXYK4do target=_blank>Overview Of New Site</a></li>
  589. <li><a href=http://www.youtube.com/watch?v=pXMYr7-Hb2s target=_blank>Managing Videos</a></li>
  590. </ul>
  591. <p style=clear:both;padding-top:5px;margin-bottom:0.5em;color:#666;font-size:14px;>Helpful Quick Links:</p>
  592. <a href=http://docs.disqus.com/kb target=_blank>Disqus Training</a> |
  593. <a href=http://google.com/analytics target=_blank>Analytics Login</a>
  594. <p>Still stuck? Give us a call at <strong>(480) 648-8229</strong> or email us at <a href=mailto:info@sharpmachinemedia.com?subject=Help!><strong>info@sharpmachinemedia.com</strong></a>.
  595. ";
  596. }
  597. // Create the function use in the action hook
  598. function help_add_dashboard_widgets() {
  599. wp_add_dashboard_widget('help_dashboard_widget', 'Need Help?', 'help_dashboard_widget_function');
  600. }
  601. // Hook into the 'wp_dashboard_setup' action to register our other functions
  602. add_action('wp_dashboard_setup', 'help_add_dashboard_widgets' );
  603. // Remove items from admin menu
  604. function remove_admin_bar_links() {
  605. global $wp_admin_bar;
  606. $wp_admin_bar->remove_menu('themes');
  607. $wp_admin_bar->remove_menu('background');
  608. $wp_admin_bar->remove_menu('header');
  609. $wp_admin_bar->remove_menu('new-theme');
  610. $wp_admin_bar->remove_menu('new-plugin');
  611. $wp_admin_bar->remove_menu('new-product_extras');
  612. $wp_admin_bar->remove_menu('new-acf');
  613. $wp_admin_bar->remove_menu('new-link');
  614. $wp_admin_bar->remove_menu('new-user');
  615. $wp_admin_bar->remove_menu('edit');
  616. }
  617. add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );
  618. // Add items to admin menu
  619. // function my_admin_bar_link() {
  620. // global $wp_admin_bar;
  621. // if ( !is_super_admin() || !is_admin_bar_showing() )
  622. // return;
  623. // $wp_admin_bar->add_menu( array(
  624. // 'id' => 'new_link',
  625. // 'parent' => 'new-content',
  626. // 'title' => __( 'Link'),
  627. // 'href' => admin_url( 'link-add.php' )
  628. // ) );
  629. // }
  630. // add_action('admin_bar_menu', 'my_admin_bar_link');
  631. function comment_reform ($arg) {
  632. $arg['title_reply'] = __('Questions &amp; Comments');
  633. return $arg;
  634. }
  635. add_filter('comment_form_defaults','comment_reform');
  636. function get_short_excerpt(){
  637. $excerpt = get_the_content();
  638. $excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
  639. $excerpt = strip_shortcodes($excerpt);
  640. $excerpt = strip_tags($excerpt);
  641. $excerpt = substr($excerpt, 0, 85);
  642. $excerpt = substr($excerpt, 0, strripos($excerpt, " "));
  643. $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
  644. $excerpt = $excerpt.'... <a class="read-more" href="'.get_permalink().'">Read More...</a>';
  645. return $excerpt;
  646. }
  647. function get_short_title(){
  648. $tit = the_title('','',FALSE);
  649. echo substr($tit, 0, 12);
  650. if (strlen($tit) > 12) echo " ...";
  651. }