Advertisement
Guest User

Untitled

a guest
Jun 18th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 26.47 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Periodic Theme Functions
  5.  *
  6.  * This file will contain all of the parent theme's custom functions. The majority of these
  7.  * functions are fired inside of the wap8_periodic_theme_setup function.
  8.  *
  9.  * If you are developing a child theme, know that your child theme's function.php file will
  10.  * execute before the parent's. We recommend creating your own child theme setup function
  11.  * and giving it a lower priority so that it executes after the parent.
  12.  *
  13.  * Example:
  14.  *
  15.  * add_action( 'after_setup_theme', 'my_periodic_theme_setup', 11 );
  16.  * function my_periodic_theme_setup() {
  17.  *      write all of your actions and filters inside the brackets
  18.  * }
  19.  *
  20.  * We set a priority of 11 so that it executes after the parent theme's function.php file.
  21.  *
  22.  * @package WordPress
  23.  * @subpackage Periodic
  24.  * @since Periodic 2.4.6
  25.  * @author We Are Pixel8 http://www.wearepixel8.com
  26.  *
  27.  */
  28.  
  29.  
  30. /*-----------------------------------------------------------------------------------*/
  31. /* Load Theme Options Page
  32. /*-----------------------------------------------------------------------------------*/
  33.  
  34. $functions_path = TEMPLATEPATH . '/functions/';
  35. require_once ( $functions_path . 'theme-options.php' );
  36.  
  37.  
  38. /*-----------------------------------------------------------------------------------*/
  39. /* Version cache for custom stylesheets and custom javascript files
  40. /*-----------------------------------------------------------------------------------*/
  41.  
  42. function wap8_version_cache() {
  43.     return '2.4.10';
  44. }
  45.  
  46. /*-----------------------------------------------------------------------------------*/
  47. /* Periodic Theme Setup
  48. /*-----------------------------------------------------------------------------------*/
  49.  
  50. add_action( 'after_setup_theme', 'wap8_periodic_theme_setup' );
  51.  
  52. function wap8_periodic_theme_setup() {
  53.  
  54.     // Set the $content_width
  55.     global $content_width;
  56.     if ( !isset( $content_width ) ) $content_width = 620;
  57.  
  58.     // Add custom editor styles
  59.     add_editor_style( 'periodic-editor-style.css' );
  60.    
  61.     // Add theme support for automatic-feed-links
  62.     add_theme_support( 'automatic-feed-links' );
  63.    
  64.     // Add theme support for post-thumbnails
  65.     add_theme_support( 'post-thumbnails' );
  66.    
  67.     // Add action for custom menus
  68.     add_action( 'init', 'periodic_register_menus' );
  69.    
  70.     // Add action for registering sidebars
  71.     add_action( 'widgets_init', 'periodic_register_sidebars' );
  72.    
  73.     // Add action for registering, deregistering and enqueueing global javascripts
  74.     add_action( 'init', 'wap8_register_js' );
  75.    
  76.     // Add action for registering, deregistering and enqueueing global stylesheets
  77.     add_action( 'init', 'wap8_register_css' );
  78.    
  79.     // Load custom theme widgets
  80.     require_once( TEMPLATEPATH . '/widgets/widget-twitter.php' ); // Twitter Feed
  81.     require_once( TEMPLATEPATH . '/widgets/widget-flickr.php' ); // Flickr Feed
  82.     require_once( TEMPLATEPATH . '/widgets/widget-customcategories.php' ); // Custom Categories
  83.     require_once( TEMPLATEPATH . '/widgets/widget-recentvideo.php' ); // Recent Video
  84.     require_once( TEMPLATEPATH . '/widgets/widget-tabs.php' ); // Tabs
  85.     require_once( TEMPLATEPATH . '/widgets/widget-rpcurrentcat.php' ); // Recent Posts from Current Categories
  86.     require_once( TEMPLATEPATH . '/widgets/widget-125banner.php' ); // 125x125 Ad
  87.     require_once( TEMPLATEPATH . '/widgets/widget-120banner.php' ); // 120x240 Ad
  88.     require_once( TEMPLATEPATH . '/widgets/widget-120skyscraper.php' ); // 120x600 Ad
  89.     require_once( TEMPLATEPATH . '/widgets/widget-300banner.php' ); // 300x250 Ad
  90.     require_once( TEMPLATEPATH . '/widgets/widget-300half.php' ); // 300x600 Ad
  91.        
  92.     // Allow shortcodes in text widgets
  93.     add_filter( 'widget_text', 'do_shortcode' );
  94.    
  95.     // Add action for theme options link in admin nav bar
  96.     add_action( 'wp_before_admin_bar_render', 'periodic_options_link' );
  97.    
  98.     // Load custom theme plugins
  99.     require_once( TEMPLATEPATH . '/plugins/wap8-browser-bodyclass.php' ); // Add browser client to body class
  100.     require_once( TEMPLATEPATH . '/plugins/wap8-excerpt.php' ); // customize the post excerpt output
  101.     require_once( TEMPLATEPATH . '/plugins/wap8-html-declaration.php' ); // add valid markup to the <html> tag
  102.     require_once( TEMPLATEPATH . '/plugins/wap8-shortcodes.php' ); // shortcodes
  103.     require_once( TEMPLATEPATH . '/plugins/wap8-commentcount.php' ); // the count for user generated comments
  104.     require_once( TEMPLATEPATH . '/plugins/wap8-breadcrumbs.php' ); // breadcrumbs
  105.     require_once( TEMPLATEPATH . '/plugins/wap8-contributors.php' ); // list contributors
  106.     require_once( TEMPLATEPATH . '/plugins/wap8-imagerel.php' ); // add a rel tag to linked images in a post
  107.     require_once( TEMPLATEPATH . '/plugins/wap8-postpassword.php' ); // modify the post password form
  108.    
  109.     // Load textdomain for localization
  110.     load_theme_textdomain( 'periodic', TEMPLATEPATH . '/languages' );
  111.     $locale = get_locale();
  112.     $locale_file = TEMPLATEPATH . '/lang/$locale.php';
  113.     if ( is_readable( $locale_file ) )
  114.     require_once( $locale_file );
  115.  
  116. }
  117.  
  118. /*-----------------------------------------------------------------------------------*/
  119. /* Set post thumbnail image sizes
  120. /*-----------------------------------------------------------------------------------*/
  121.  
  122. set_post_thumbnail_size(150, 150, true); // Standard Thumbnail Size
  123. add_image_size('thumbnail-archive', 270, 120, true); // Archives Thumbnail Size
  124. add_image_size('thumbnail-feature', 390, 280, true); // Features Thumbnail Size
  125. add_image_size('thumbnail-featurenav', 130, 60, true); // Feature Slider Nav Thumbnail Size
  126. add_image_size('thumbnail-leadimg', 610, 225, true); // Lead Image Thumbnail Size
  127. add_image_size('thumbnail-search', 130, 130, true); // Search Results Thumbnail Size
  128. add_image_size('thumbnail-sidebar', 60, 60, true); // Sidebar Thumbnail Size
  129. add_image_size('thumbnail-sidebarvid', 290, 215, true); // Sidebar Video Thumbnail Size
  130. add_image_size('thumbnail-sticky', 210, 100, true); // Sticky Post Thumbnail Size
  131. add_image_size('thumbnail-home', 290, 125, true); // Home lead Category Block Thumbnail Size
  132.  
  133. /*-----------------------------------------------------------------------------------*/
  134. /* Register WP 3+ custom menus
  135. /*-----------------------------------------------------------------------------------*/
  136.  
  137. function periodic_register_menus() {
  138.     if ( function_exists( 'register_nav_menus' ) ) {
  139.         register_nav_menus(
  140.             array(
  141.                 'utility-menu' => __( 'Utility Menu','periodic' ),
  142.                 'main-menu' => __( 'Main Menu','periodic' ),
  143.             )      
  144.         );
  145.     }
  146. }
  147.  
  148. /*-----------------------------------------------------------------------------------*/
  149. /* Fallback Page Menu
  150. /*-----------------------------------------------------------------------------------*/
  151. function periodic_page_menu() {
  152.     echo '<ul class="header-menu">';
  153.     wp_list_pages('title_li=');
  154.     echo '</ul>';
  155. }
  156.  
  157. /*-----------------------------------------------------------------------------------*/
  158. /* Fallback Category Menu
  159. /*-----------------------------------------------------------------------------------*/
  160. function periodic_category_menu() {
  161.     echo '<ul>';
  162.     wp_list_categories('title_li=');
  163.     echo '</ul>';
  164. }
  165.  
  166. /*-----------------------------------------------------------------------------------*/
  167. /* Register sidebars
  168. /*-----------------------------------------------------------------------------------*/
  169.  
  170. function periodic_register_sidebars() {
  171.  
  172.     // Register sidebar for Home Page
  173.     register_sidebar(
  174.         array(
  175.             'id' => 'home',
  176.             'name' => __( 'Sidebar for Home Page', 'periodic' ),
  177.             'description' => __( 'Drag, organize and save widgets for the sidebar that will appear on your Home page.', 'periodic' ),
  178.             'before_widget' => '<div id="%1$s" class="sidebar-widget %2$s">',
  179.             'after_widget' => '</div>',
  180.             'before_title' => '<h3 class="widget-head">',
  181.             'after_title' => '</h3>'
  182.         )
  183.     );
  184.  
  185.     // Register Right Sidebar
  186.     register_sidebar(
  187.         array(
  188.             'id' => 'right',
  189.             'name' => __( 'Right Sidebar', 'periodic' ),
  190.             'description' => __( 'Drag, organize and save widgets for the Right Sidebar.', 'periodic' ),
  191.             'before_widget' => '<div id="%1$s" class="sidebar-widget %2$s">',
  192.             'after_widget' => '</div>',
  193.             'before_title' => '<h3 class="widget-head">',
  194.             'after_title' => '</h3>'
  195.         )
  196.     );
  197.    
  198.     // Register Left Sidebar
  199.     register_sidebar(
  200.         array(
  201.             'id' => 'left',
  202.             'name' => __( 'Left Sidebar', 'periodic' ),
  203.             'description' => __( 'Drag, organize and save widgets for the Left Sidebar.', 'periodic' ),
  204.             'before_widget' => '<div id="%1$s" class="sidebar-widget %2$s">',
  205.             'after_widget' => '</div>',
  206.             'before_title' => '<h3 class="widget-head">',
  207.             'after_title' => '</h3>'
  208.         )
  209.     );
  210.    
  211.     // Register Footer Column 1
  212.     register_sidebar(
  213.         array(
  214.             'id' => 'footer-column-one',
  215.             'name' => __( 'Footer Column One', 'periodic' ),
  216.             'description' => __( 'Drag, organize and save widgets for the first Footer Column.', 'periodic' ),
  217.             'before_widget' => '<div id="%1$s" class="footer-widget %2$s">',
  218.             'after_widget' => '</div>',
  219.             'before_title' => '<h3>',
  220.             'after_title' => '</h3>'
  221.         )
  222.     );
  223.    
  224.     // Register Footer Column 2
  225.     register_sidebar(
  226.         array(
  227.             'id' => 'footer-column-two',
  228.             'name' => __( 'Footer Column Two', 'periodic' ),
  229.             'description' => __( 'Drag, organize and save widgets for the second Footer Column.', 'periodic' ),
  230.             'before_widget' => '<div id="%1$s" class="footer-widget %2$s">',
  231.             'after_widget' => '</div>',
  232.             'before_title' => '<h3>',
  233.             'after_title' => '</h3>'
  234.         )
  235.     );
  236.    
  237.     // Register Footer Column 3
  238.     register_sidebar(
  239.         array(
  240.             'id' => 'footer-column-three',
  241.             'name' => __( 'Footer Column Three', 'periodic' ),
  242.             'description' => __( 'Drag, organize and save widgets for the third Footer Column.', 'periodic' ),
  243.             'before_widget' => '<div id="%1$s" class="footer-widget %2$s">',
  244.             'after_widget' => '</div>',
  245.             'before_title' => '<h3>',
  246.             'after_title' => '</h3>'
  247.         )
  248.     );
  249.    
  250. }
  251.  
  252. /*-----------------------------------------------------------------------------------*/
  253. /* Register, deregister and enqueue global javascripts
  254. /*-----------------------------------------------------------------------------------*/
  255.  
  256. function wap8_register_js() {
  257.     if ( !is_admin() ) {
  258.         // Register javascripts
  259.         wp_register_script( 'jquery-easing', get_template_directory_uri() . '/js/jquery.easing.1.3.min.js', 'jquery', '1.3', true );
  260.         wp_register_script( 'jquery-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.min.js', array( 'jquery', 'jquery-easing' ), '2.99', true );
  261.         wp_register_script( 'jquery-fancybox', get_template_directory_uri() . '/js/jquery.fancybox-1.3.4.min.js', array( 'jquery', 'jquery-easing' ), '1.3.4', true );
  262.         wp_register_script( 'jquery-superfish', get_template_directory_uri() . '/js/jquery.superfish-1.4.8.min.js', 'jquery', '1.4.8', true );
  263.         wp_register_script( 'jquery-supersubs', get_template_directory_uri() . '/js/jquery.supersubs-0.2b.min.js', array( 'jquery', 'jquery-superfish' ), '0.2b', true );
  264.         wp_register_script( 'periodic-jquery', get_template_directory_uri() . '/js/periodic.js', array( 'jquery', 'jquery-easing', 'jquery-cycle', 'jquery-fancybox', 'jquery-superfish', 'jquery-supersubs', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-tabs' ), wap8_version_cache(), true );
  265.         wp_register_script( 'digg-share', get_template_directory_uri() . '/js/digg.js', array( 'jquery' ) , wap8_version_cache(), true );
  266.         wp_register_script( 'twitter-platform-script', 'http://platform.twitter.com/widgets.js', array( 'jquery' ), wap8_version_cache(), true );
  267.         wp_register_script( 'google-plus-script', get_template_directory_uri() . '/js/google-plusone.js', array( 'jquery' ), wap8_version_cache(), true );
  268.        
  269.         // Enqueue javascripts
  270.         wp_enqueue_script( 'jquery' );
  271.         wp_enqueue_script( 'periodic-jquery' );
  272.         wp_enqueue_script( 'jquery-easing' );
  273.         wp_enqueue_script( 'jquery-cycle' );
  274.         wp_enqueue_script( 'jquery-fancybox' );
  275.         wp_enqueue_script( 'jquery-superfish' );
  276.         wp_enqueue_script( 'jquery-supersubs' );
  277.         wp_enqueue_script( 'jquery-ui-core' );
  278.         wp_enqueue_script( 'jquery-ui-widget' );
  279.         wp_enqueue_script( 'jquery-ui-tabs' );
  280.        
  281.     }
  282. }
  283.  
  284. /*-----------------------------------------------------------------------------------*/
  285. /* Register, deregister and enqueue global stylesheets
  286. /*-----------------------------------------------------------------------------------*/
  287.  
  288. function wap8_register_css() {
  289.     if ( !is_admin() ) {
  290.         // Register core stylesheet
  291.         wp_register_style( 'periodic-core', get_template_directory_uri() . '/style.css', '', wap8_version_cache(), 'screen' );
  292.         wp_register_style( 'periodic-print', get_template_directory_uri() . '/css/print.css', 'periodic-core', wap8_version_cache(), 'print' );
  293.         wp_register_style( 'black-blue', get_template_directory_uri() . '/css/black-blue.css', 'periodic-core', wap8_version_cache(), 'screen' );
  294.         wp_register_style( 'black-green', get_template_directory_uri() . '/css/black-green.css', 'periodic-core', wap8_version_cache(), 'screen' );
  295.         wp_register_style( 'black-orange', get_template_directory_uri() . '/css/black-orange.css', 'periodic-core', wap8_version_cache(), 'screen' );
  296.         wp_register_style( 'black-pink', get_template_directory_uri() . '/css/black-pink.css', 'periodic-core', wap8_version_cache(), 'screen' );
  297.         wp_register_style( 'black-purple', get_template_directory_uri() . '/css/black-purple.css', 'periodic-core', wap8_version_cache(), 'screen' );
  298.         wp_register_style( 'black-red', get_template_directory_uri() . '/css/black-red.css', 'periodic-core', wap8_version_cache(), 'screen' );
  299.         wp_register_style( 'legacy-blue', get_template_directory_uri() . '/css/blue.css', 'periodic-core', wap8_version_cache(), 'screen' );
  300.         wp_register_style( 'legacy-green', get_template_directory_uri() . '/css/green.css', 'periodic-core', wap8_version_cache(), 'screen' );
  301.         wp_register_style( 'legacy-orange', get_template_directory_uri() . '/css/orange.css', 'periodic-core', wap8_version_cache(), 'screen' );
  302.         wp_register_style( 'legacy-pink', get_template_directory_uri() . '/css/pink.css', 'periodic-core', wap8_version_cache(), 'screen' );
  303.         wp_register_style( 'legacy-purple', get_template_directory_uri() . '/css/purple.css', 'periodic-core', wap8_version_cache(), 'screen' );
  304.         wp_register_style( 'legacy-red', get_template_directory_uri() . '/css/red.css', 'periodic-core', wap8_version_cache(), 'screen' );
  305.         wp_register_style( 'spectrum-blue', get_template_directory_uri() . '/css/spectrum-blue.css', 'periodic-core', wap8_version_cache(), 'screen' );
  306.         wp_register_style( 'spectrum-green', get_template_directory_uri() . '/css/spectrum-green.css', 'periodic-core', wap8_version_cache(), 'screen' );
  307.         wp_register_style( 'spectrum-orange', get_template_directory_uri() . '/css/spectrum-orange.css', 'periodic-core', wap8_version_cache(), 'screen' );
  308.         wp_register_style( 'spectrum-pink', get_template_directory_uri() . '/css/spectrum-pink.css', 'periodic-core', wap8_version_cache(), 'screen' );
  309.         wp_register_style( 'spectrum-purple', get_template_directory_uri() . '/css/spectrum-purple.css', 'periodic-core', wap8_version_cache(), 'screen' );
  310.         wp_register_style( 'spectrum-red', get_template_directory_uri() . '/css/spectrum-red.css', 'periodic-core', wap8_version_cache(), 'screen' );
  311.         wp_register_style( 'fancybox-styles', get_template_directory_uri() . '/fancybox/jquery.fancybox-1.3.4.css', '', '1.3.4', 'screen' );
  312.         wp_register_style( 'wap8_google-fonts', 'http://fonts.googleapis.com/css?family=Vollkorn:400italic,400', '', wap8_version_cache(), 'screen' );
  313.        
  314.        
  315.         // Enqueue stylesheets
  316.         wp_enqueue_style( 'fancybox-styles' );
  317.         wp_enqueue_style( 'wap8_google-fonts' );
  318.        
  319.         wp_enqueue_style( 'periodic-print' );
  320.        
  321.         if ( get_option( 'wap8_css' ) == 'Black and Blue' ) {
  322.             wp_enqueue_style( 'black-blue' );
  323.         }
  324.        
  325.         elseif ( get_option( 'wap8_css' ) == 'Black and Green' ) {
  326.             wp_enqueue_style( 'black-green' );
  327.         }
  328.        
  329.         elseif ( get_option( 'wap8_css' ) == 'Black and Orange' ) {
  330.             wp_enqueue_style( 'black-orange' );
  331.         }
  332.        
  333.         elseif ( get_option( 'wap8_css' ) == 'Black and Pink' ) {
  334.             wp_enqueue_style( 'black-pink' );
  335.         }
  336.        
  337.         elseif ( get_option( 'wap8_css' ) == 'Black and Purple' ) {
  338.             wp_enqueue_style( 'black-purple' );
  339.         }
  340.        
  341.         elseif ( get_option( 'wap8_css' ) == 'Black and Red' ) {
  342.             wp_enqueue_style( 'black-red' );
  343.         }
  344.        
  345.         elseif ( get_option( 'wap8_css' ) == 'Legacy Blue' ) {
  346.             wp_enqueue_style( 'legacy-blue' );
  347.         }
  348.        
  349.         elseif ( get_option( 'wap8_css' ) == 'Legacy Green' ) {
  350.             wp_enqueue_style( 'legacy-green' );
  351.         }
  352.        
  353.         elseif ( get_option( 'wap8_css' ) == 'Legacy Orange' ) {
  354.             wp_enqueue_style( 'legacy-orange' );
  355.         }
  356.        
  357.         elseif ( get_option( 'wap8_css' ) == 'Legacy Pink' ) {
  358.             wp_enqueue_style( 'legacy-pink' );
  359.         }
  360.        
  361.         elseif ( get_option( 'wap8_css' ) == 'Legacy Purple' ) {
  362.             wp_enqueue_style( 'legacy-purple' );
  363.         }
  364.        
  365.         elseif ( get_option( 'wap8_css' ) == 'Legacy Red' ) {
  366.             wp_enqueue_style( 'legacy-red' );
  367.         }
  368.        
  369.         elseif ( get_option( 'wap8_css' ) == 'Dark Spectrum Blue' ) {
  370.             wp_enqueue_style( 'spectrum-blue' );
  371.         }
  372.        
  373.         elseif ( get_option( 'wap8_css' ) == 'Dark Spectrum Green' ) {
  374.             wp_enqueue_style( 'spectrum-green' );
  375.         }
  376.        
  377.         elseif ( get_option( 'wap8_css' ) == 'Dark Spectrum Orange' ) {
  378.             wp_enqueue_style( 'spectrum-orange' );
  379.         }
  380.        
  381.         elseif ( get_option( 'wap8_css' ) == 'Dark Spectrum Pink' ) {
  382.             wp_enqueue_style( 'spectrum-pink' );
  383.         }
  384.        
  385.         elseif ( get_option( 'wap8_css' ) == 'Dark Spectrum Purple' ) {
  386.             wp_enqueue_style( 'spectrum-purple' );
  387.         }
  388.        
  389.         elseif ( get_option( 'wap8_css' ) == 'Dark Spectrum Red' ) {
  390.             wp_enqueue_style( 'spectrum-red' );
  391.         }
  392.        
  393.     }
  394. }
  395.  
  396. /*-----------------------------------------------------------------------------------*/
  397. /* Add Theme Options link to WordPress Admin Nav Bar
  398. /*-----------------------------------------------------------------------------------*/
  399.  
  400. function periodic_options_link() {
  401.     global $wp_admin_bar;
  402.    
  403.     $wp_admin_bar -> add_menu( array(
  404.         'parent' => 'appearance',
  405.         'id' => 'periodic_options_link',
  406.         'title' => __( 'Periodic Settings', 'periodic' ),
  407.         'href' => admin_url( 'themes.php?page=theme-options.php' )
  408.     ));
  409. }
  410.  
  411. /*-----------------------------------------------------------------------------------*/
  412. /* Custom comments callback
  413. /*-----------------------------------------------------------------------------------*/
  414.  
  415. function periodic_comments($comment, $args, $depth) {
  416. $GLOBALS['comment'] = $comment; ?>
  417. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  418.     <div id="comment-<?php comment_ID(); ?>">
  419.         <div class="comment-author vcard">
  420.             <p><?php echo get_avatar($comment,$size='50',$default=get_option('wap8_comment_avatar') ); ?></p>
  421.         </div>
  422.  
  423.         <div class="comment-body clear">
  424.             <div class="comment-meta commentmetadata">
  425.             <?php printf(__('<cite class="comment-cite">%s</cite>'), get_comment_author_link()) ?>
  426.                 <p><?php printf(__('%1$s at %2$s','periodic'), get_comment_date(),get_comment_time()) ?></p>
  427.                 <p><?php edit_comment_link(__('(Edit)','periodic'),'  ','') ?></p>
  428.             </div>
  429.        
  430.             <div class="comment-text">
  431.             <?php if ($comment->comment_approved == '0') : ?>
  432.                 <p><em><?php _e('Your comment is awaiting moderation.','periodic') ?></em></p>
  433.             <?php endif; ?>
  434.        
  435.             <?php comment_text() ?>
  436.             </div>
  437.        
  438.             <?php if($args['max_depth']!=$depth) { ?>
  439.             <div class="reply">
  440.                 <p><?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?></p>
  441.             </div>
  442.         </div>
  443. <?php } ?>
  444.     </div>
  445. <?php
  446. }
  447.  
  448. /*-----------------------------------------------------------------------------------*/
  449. /* Custom trackbacks callback
  450. /*-----------------------------------------------------------------------------------*/
  451.  
  452. function periodic_trackbacks($comment) {
  453. $GLOBALS['comment'] = $comment; ?>
  454. <li><?php printf(__('<cite class="trackback-cite">%s</cite>'), get_comment_author_link()) ?> <?php edit_comment_link(__('(Edit)','periodic'),'  ','') ?></li>
  455. <?php
  456. }
  457.  
  458. /*-----------------------------------------------------------------------------------*/
  459. /* TGM Plugin Activation
  460. /*-----------------------------------------------------------------------------------*/
  461.  
  462. require_once dirname( __FILE__ ) . '/lib/class-tgm-plugin-activation.php';
  463.  
  464. add_action( 'tgmpa_register', 'wap8_theme_register_required_plugins' );
  465.  
  466. function wap8_theme_register_required_plugins() {
  467.  
  468.     $plugins = array(
  469.  
  470.         // WP-PageNavi
  471.         array(
  472.             'name'      => 'WP-PageNavi',
  473.             'slug'      => 'wp-pagenavi',
  474.             'required'  => false,
  475.             'version'   => '2.82'
  476.         ),
  477.        
  478.         // Contact Form 7
  479.         array(
  480.             'name'      => 'Contact Form 7',
  481.             'slug'      => 'contact-form-7',
  482.             'required'  => false,
  483.             'version'   => '3.1'
  484.         ),
  485.        
  486.         // Simple Video Embedder
  487.         array(
  488.             'name'      => 'Simple Video Embedder',
  489.             'slug'      => 'simple-video-embedder',
  490.             'required'  => false,
  491.             'version'   => '2.2'
  492.         ),
  493.        
  494.         // Google Analytics for WordPress
  495.         array(
  496.             'name'      => 'Google Analytics for WordPress',
  497.             'slug'      => 'google-analytics-for-wordpress',
  498.             'required'  => false,
  499.             'version'   => '4.2.4'
  500.         ),
  501.        
  502.         // Regenerate Thumbnails
  503.         array(
  504.             'name'      => 'Regenerate Thubmnails',
  505.             'slug'      => 'regenerate-thumbnails',
  506.             'required'  => false,
  507.             'version'   => '2.2.3'
  508.         ),
  509.        
  510.         // Codestyling Localization
  511.         array(
  512.             'name'      => 'Codestyling Localization',
  513.             'slug'      => 'codestyling-localization',
  514.             'required'  => false,
  515.             'version'   => '1.99.16'
  516.         )
  517.  
  518.     );
  519.  
  520.     $theme_text_domain = 'periodic';
  521.  
  522.     /**
  523.      * Array of configuration settings. Amend each line as needed.
  524.      * If you want the default strings to be available under your own theme domain,
  525.      * leave the strings uncommented.
  526.      * Some of the strings are added into a sprintf, so see the comments at the
  527.      * end of each line for what each argument will be.
  528.      */
  529.     $config = array(
  530.         'domain'            => $theme_text_domain,          // Text domain - likely want to be the same as your theme.
  531.         'default_path'      => '',                          // Default absolute path to pre-packaged plugins
  532.         'parent_menu_slug'  => 'themes.php',                // Default parent menu slug
  533.         'parent_url_slug'   => 'themes.php',                // Default parent URL slug
  534.         'menu'              => 'install-required-plugins',  // Menu slug
  535.         'has_notices'       => true,                        // Show admin notices or not
  536.         'is_automatic'      => false,                       // Automatically activate plugins after installation or not
  537.         'message'           => '',                          // Message to output right before the plugins table
  538.         'strings'           => array(
  539.             'page_title'                                => __( 'Install Required Periodic Plugins', $theme_text_domain ),
  540.             'menu_title'                                => __( 'Install Periodic Plugins', $theme_text_domain ),
  541.             'installing'                                => __( 'Installing Periodic Plugin: %s', $theme_text_domain ), // %1$s = plugin name
  542.             'oops'                                      => __( 'Something went wrong with the plugin API.', $theme_text_domain ),
  543.             'notice_can_install_required'               => _n_noop( 'Periodic requires the following plugin: %1$s.', 'Periodic requires the following plugins: %1$s.' ), // %1$s = plugin name(s)
  544.             'notice_can_install_recommended'            => _n_noop( 'Periodic recommends the following plugin: %1$s.', 'Periodic recommends the following plugins: %1$s.' ), // %1$s = plugin name(s)
  545.             'notice_cannot_install'                     => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s)
  546.             'notice_can_activate_required'              => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
  547.             'notice_can_activate_recommended'           => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
  548.             'notice_cannot_activate'                    => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s)
  549.             'notice_ask_to_update'                      => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with Periodic: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with Periodic: %1$s.' ), // %1$s = plugin name(s)
  550.             'notice_cannot_update'                      => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s)
  551.             'install_link'                              => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ),
  552.             'activate_link'                             => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ),
  553.             'return'                                    => __( 'Return to Required Plugins Installer', $theme_text_domain ),
  554.             'plugin_activated'                          => __( 'Plugin activated successfully.', $theme_text_domain ),
  555.             'complete'                                  => __( 'All plugins installed and activated successfully. %s', $theme_text_domain ) // %1$s = dashboard link
  556.         )
  557.     );
  558.  
  559.     tgmpa( $plugins, $config );
  560.  
  561. }
  562.  
  563. /*-----------------------------------------------------------------------------------*/
  564. /* Misc. URL's used throughtout the theme
  565. /*-----------------------------------------------------------------------------------*/
  566.  
  567. // Twitter Share URL
  568. function wap8_twitter_share_url() {
  569.     return '"http://twitter.com/share"';
  570. }
  571.  
  572.  
  573. function my_em_posttype_fix(){
  574.     register_taxonomy_for_object_type('category',EM_POST_TYPE_EVENT);
  575.     register_taxonomy_for_object_type('category',EM_POST_TYPE_LOCATION);
  576. }
  577. add_action('init','my_em_posttype_fix',100);
  578. function my_em_posttype_cat_default($EM_Object){
  579.     global $post;
  580.     if( $post->post_type == EM_POST_TYPE_EVENT || $post->post_type == EM_POST_TYPE_LOCATION ){
  581.         $categories = get_the_category();
  582.         if( count($categories) == 0 ){
  583.             //assign a category to this
  584.             wp_set_object_terms($post->ID, 'uncategorized','category');
  585.         }
  586.     }
  587. }
  588. add_action('template_redirect','my_em_posttype_cat_default', 1,1);
  589.  
  590. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement