Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- // Load the extra layout and styles from their own file
- require_once(STYLESHEETPATH . '/includes/theme-options.php');
- // Redirect to Theme FAQ on Activation - I know this is annoying, but I want people to read it.
- if ( is_admin() && isset($_GET['activated'] ) && $pagenow =="themes.php" )
- wp_redirect( 'themes.php?page=nomnom-theme-options' );
- // Include the custom widgets
- include('includes/helper.php');
- include('includes/widget-func.php');
- include('includes/twitter.php');
- include('includes/blog-author.php');
- include('includes/flickr.php');
- include('includes/nomnom-slider/slider.php');
- // Call the various .js files and shortcode css
- function add_nomnom_scripts(){
- wp_register_script('jquery', 'http://code.jquery.com/jquery-1.5.2.min.js');
- wp_register_script('superfish', get_stylesheet_directory_uri() .'/includes/js/superfish.js');
- wp_register_style('color_options.css', get_stylesheet_directory_uri().'/includes/color_options_css.php');
- wp_enqueue_script('jquery');
- wp_enqueue_script('superfish');
- }
- function color_options_script ()
- {
- wp_register_style('nomnom.css', get_stylesheet_directory_uri().'/includes/css/nomnom.css');
- wp_register_style('colorpicker.css', get_stylesheet_directory_uri().'/colorpicker/css/colorpicker.css');
- wp_register_style('layout.css', get_stylesheet_directory_uri().'/colorpicker/css/layout.css');
- wp_register_script('noconflict.js', get_stylesheet_directory_uri().'/includes/js/noconflict.js', array('jquery'));
- wp_register_script('colorpicker.js', get_stylesheet_directory_uri().'/colorpicker/js/colorpicker.js', array('jquery'));
- wp_register_script('eye.js', get_stylesheet_directory_uri().'/colorpicker/js/eye.js', array('jquery'));
- wp_register_script('utils.js', get_stylesheet_directory_uri().'/colorpicker/js/utils.js', array('jquery'));
- wp_register_script('color_options.js', get_stylesheet_directory_uri().'/includes/js/color_options.js', array('jquery'));
- wp_enqueue_style('nomnom.css');
- wp_enqueue_style('colorpicker.css');
- wp_enqueue_style('layout.css');
- wp_enqueue_script('noconflict.js');
- wp_enqueue_script('colorpicker.js');
- wp_enqueue_script('eye.js');
- wp_enqueue_script('utils.js');
- wp_enqueue_script('color_options.js');
- }
- if (is_admin())
- add_action('init','color_options_script');
- add_action('init','add_nomnom_scripts');
- // Add a second menu
- register_nav_menus( array(
- 'secondary' => __( 'Top Menu (Above the Header)', 'NomNom'),
- 'primary' => __( 'Primary Menu', 'NomNom' ),
- ) );
- // Add a sidebar to single posts view - http://transformationpowertools.com
- add_filter('body_class', 'blacklist_body_class', 20, 2);
- function blacklist_body_class($wp_classes, $extra_classes) {
- if( is_single() ) :
- // List of the classes to remove from the WP generated classes
- $blacklist = array('singular');
- // Filter the body classes
- foreach( $blacklist as $val ) {
- if (!in_array($val, $wp_classes)) : continue;
- else:
- foreach($wp_classes as $key => $value) {
- if ($value == $val) unset($wp_classes[$key]);
- }
- endif;
- }
- endif; // Add the extra classes back untouched
- return array_merge($wp_classes, (array) $extra_classes);
- }
- // Excerpt Length - Adding this because of the different layouts, change 40 to what you like
- function change_excerpt_length()
- {
- function new_excerpt_length($length){return 40;}
- add_filter('excerpt_length', 'new_excerpt_length');
- }
- add_action('after_setup_theme', 'change_excerpt_length');
- // Set the dimensions for the thumbnails displayed on the homepage
- add_theme_support( 'post-thumbnails' );
- add_image_size('excerpt-thumbnail', 120, 120, true);
- // Show Wp-PageNavi when it's active - changed twentyeleven_content_nav in index.php to twentyeleven_child_content_nav
- function twentyeleven_child_content_nav( $nav_id ) {
- global $wp_query;
- if ( $wp_query->max_num_pages > 1 ) : ?>
- <?php /* add wp-pagenavi support for posts */ ?>
- <?php if(function_exists('wp_pagenavi') ) : ?>
- <?php wp_pagenavi(); ?>
- <br />
- <?php else: ?>
- <nav id="<?php echo $nav_id; ?>">
- <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
- <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyeleven' ) ); ?></div>
- <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></div>
- </nav><!-- #nav-above -->
- <?php endif; ?>
- <?php endif;
- }
- // Make plain text links clickable - uncomment to use, conflicts with some plugins
- /*
- add_filter('the_content', 'make_clickable');
- add_filter('the_excerpt', 'make_clickable');
- */
- // Add a Theme Options link to Admin Bar
- function theme_options_link()
- {
- global $wp_admin_bar, $wpdb;
- if (!is_super_admin() || !is_admin_bar_showing())
- return;
- $wp_admin_bar->add_menu(array('parent' => 'appearance', 'title' => __('Theme Options', 'Theme Options'), 'href' => home_url() . '/wp-admin/themes.php?page=theme_options'));
- $wp_admin_bar->add_menu(array('parent' => 'appearance', 'title' => __('NomNom Options', 'NomNom Options'), 'href' => home_url() . '/wp-admin/themes.php?page=nomnom-theme-options'));
- }
- add_action('admin_bar_menu', 'theme_options_link', 1000);
- // Register our extra sidebar for the three column layouts
- register_sidebar( array(
- 'name' => __( 'Extra Sidebar', 'twentyeleven' ),
- 'id' => 'extra-sidebar',
- 'description' => __( 'The sidebar for three column layouts only', 'twentyeleven' ),
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => "</aside>",
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- register_sidebar( array(
- 'name' => __( 'Multile Forums Display', 'twentyeleven' ),
- 'id' => 'extra-sidebar1',
- 'description' => __( 'The sidebar for three column layouts only', 'twentyeleven' ),
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => "</aside>",
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- //------
- function test_modify_user_table( $column ) {
- $column['url'] = 'User Id';
- return $column;
- }
- add_filter( 'manage_users_columns', 'test_modify_user_table' );
- function test_modify_user_table_row( $val, $column_name, $user_id ) {
- $user = get_userdata( $user_id );
- return $user_id;
- }
- add_filter( 'manage_users_custom_column', 'test_modify_user_table_row', 10, 3 );
- if ( current_user_can('subscriber') && !current_user_can('upload_files') )
- add_action('admin_init', 'allow_contributor_uploads');
- function allow_contributor_uploads() {
- $subscriber = get_role('subscriber');
- $subscriber->add_cap('upload_files');
- }
- add_theme_support( 'bbPress' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement