Guest User

Untitled

a guest
Jul 22nd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Default_Theme
  5. */
  6.  
  7. // error reporting
  8. //error_reporting( E_ALL ); ini_set( 'display_errors',1 );
  9.  
  10. automatic_feed_links();
  11.  
  12. if ( function_exists( 'register_sidebar' ) ) {
  13.  
  14. register_sidebar( array (
  15. 'name' => __( 'Featured Images', 'rig' ),
  16. 'id' => 'features',
  17. 'before_widget' => "\n<div id=\"feature-\" class=\"widget %2\$s\">\n",
  18. 'after_widget' => "\n</div>\n",
  19. 'before_title' => '<span class="widgettitle">',
  20. 'after_title' =>
  21. "</span>\n"
  22. ) );
  23.  
  24. register_sidebar( array (
  25. 'name' => __( 'News & Events', 'rig' ),
  26. 'id' => 'news',
  27. 'before_widget' => "",
  28. 'after_widget' => "",
  29. 'before_title' => '<span class="widgettitle">',
  30. 'after_title' =>
  31. "</span>\n"
  32. ) );
  33.  
  34.  
  35. }
  36.  
  37. // begin features sidebar
  38.  
  39. function rig_features() {
  40.  
  41. if ( is_active_sidebar( 'features' ) ) :
  42.  
  43. // prep js only for multiple features
  44. $sidebars_widgets = wp_get_sidebars_widgets();
  45.  
  46. if ( count( (array) $sidebars_widgets['features'] ) > 1 ) :
  47.  
  48. global $_wp_sidebars_widgets;
  49.  
  50. // random order for featured images
  51. shuffle( $_wp_sidebars_widgets['features'] );
  52.  
  53. wp_enqueue_script( 'rig-features' );
  54.  
  55. endif;
  56.  
  57. // begin feature-# id(s) for slide(s) (thanks justintadlock.com)
  58.  
  59. global $rig_feature;
  60.  
  61. $rig_feature = 0;
  62.  
  63. add_filter( 'dynamic_sidebar_params', 'rig_features_counter' ) ?>
  64.  
  65. <div id="features">
  66.  
  67. <?php dynamic_sidebar( 'features' ) ?>
  68.  
  69. </div>
  70.  
  71. <?php remove_filter( 'dynamic_sidebar_params', 'rig_features_counter' );
  72.  
  73. // end features slide(s) id(s)
  74.  
  75. endif;
  76.  
  77. }
  78.  
  79. function rig_features_counter( $params ) {
  80.  
  81. global $rig_feature;
  82.  
  83. $rig_feature++;
  84.  
  85. $params[0]['before_widget'] = str_replace(
  86. 'id="feature-',
  87. 'id="feature-' . $rig_feature . '" style="display: none',
  88. $params[0]['before_widget']
  89. );
  90.  
  91. return $params;
  92.  
  93. }
  94.  
  95. // end features sidebar
  96.  
  97. // begin scripts
  98.  
  99. define( 'rig_JS', '/wp-content/themes/trimach/' );
  100.  
  101.  
  102.  
  103. wp_register_script( 'cufon-yui', rig_JS . 'cufon-yui.js', array ( 'jquery' ), '1.09', 1 );
  104.  
  105. wp_register_script( 'helvetica-font', rig_JS . 'Helvetica_LT_Std_300.font.js', array ( 'jquery', 'cufon-yui' ), '1.0', 1 );
  106. wp_enqueue_script( 'helvetica-font' );
  107.  
  108. wp_register_script( 'rig-features', rig_JS . 'featured-images.js', array ( 'jquery' ), '1.0', 1 );
  109.  
  110.  
  111. // make sure our footer script(s) print
  112. add_action( 'wp_footer', 'wp_print_scripts' );
  113.  
  114. // end scripts
  115.  
  116. include_once ( trailingslashit( STYLESHEETPATH ) . 'functions-widgets.php' );
  117.  
  118. ?>
Add Comment
Please, Sign In to add comment