Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * goldrush theme functions and definitions
- *
- */
- /**
- * Set the content width based on the theme's design and stylesheet.
- */
- if ( ! isset( $content_width ) )
- $content_width = 584;
- /**
- * Tell WordPress to run goldrush_setup() when the 'after_setup_theme' hook is run.
- */
- add_action( 'after_setup_theme', 'goldrush_setup' );
- if ( ! function_exists( 'goldrush_setup' ) ):
- /**
- * Sets up theme defaults and registers support for various WordPress features.
- *
- * Note that this function is hooked into the after_setup_theme hook, which runs
- * before the init hook. The init hook is too late for some features, such as indicating
- * support post thumbnails.
- *
- *
- * @uses load_theme_textdomain() For translation/localization support.
- * @uses add_editor_style() To style the visual editor.
- * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
- * and backgrounds, and post formats.
- * @uses register_nav_menus() To add support for navigation menus.
- * @uses register_default_headers() To register the default custom header images provided with the theme.
- * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
- *
- * @since Twenty Eleven 1.0
- */
- function goldrush_setup() {
- /*
- * Loads the Optionsframework Panel
- */
- if ( !function_exists( 'optionsframework_init' ) ) {
- define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' );
- require_once dirname( __FILE__ ) . '/inc/options-framework.php';
- }
- /* Make goldrush theme available for translation.
- * Translations can be added to the /languages/ directory.
- * If you're building a theme based on Twenty Eleven, use a find and replace
- * to change 'goldrush' to the name of your theme in all the template files.
- */
- load_theme_textdomain( 'goldrush', get_template_directory() . '/languages' );
- // This theme styles the visual editor with editor-style.css to match the theme style.
- // This function is a callback for custom in-theme TinyMCE editor stylesheets.
- //The parameter $stylesheet is the name of the stylesheet, relative to the theme root. It also accepts an array of stylesheets. It is optional and defaults to 'editor-style.css'.
- // TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor. TinyMCE has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.
- add_editor_style();
- // Load up our theme options page and related code.
- //require( get_template_directory() . '/inc/theme-options.php' );
- // Grab Twenty Eleven's Ephemera widget which
- //displays all of your blog’s Aside, Status, Quote and Link posts in the sidebar.
- //require( get_template_directory() . '/inc/widgets.php' );
- // Add default posts and comments RSS feed links to <head>.
- add_theme_support( 'automatic-feed-links' );
- // This theme uses wp_nav_menu() in one location. 'primary' is the slug name, 'Primary Menu@ is the name to be shown in the admin panel, and 'goldrush' is a namespace
- register_nav_menu( 'primary', __( 'Primary Menu', 'goldrush' ) );
- // Add support for a variety of post formats
- add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
- // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images
- add_theme_support( 'post-thumbnails' );
- }
- endif; // goldrush_setup
- /**
- *Adds filter function for custom page templates
- *e.g golrush home.php
- **/
- function goldrush_filter_wp_title( $title, $sep, $sep_location ){
- if ( is_home() ){
- //default homepage title
- $home_page_title = 'Home';
- // determine sep_location
- if( $sep_location != 'right' ) {
- $sep_location = 'left';
- // Get the Site Name
- $site_name = get_bloginfo( 'name' );
- // Prepend name
- $filtered_title = $site_name . ' ' . $sep . ' ' . $home_page_title;
- // Return the modified title
- return $filtered_title;
- }
- // if sep_location is right
- elseif( $sep_location == 'right' ) {
- // Get the Site Name
- $site_name = get_bloginfo( 'name' );
- // Append name
- $filtered_title = $home_page_title . ' ' . $sep . ' ' . $site_name;
- // Return the modified title
- return $filtered_title;
- }
- }
- elseif ( !is_home() ) {
- // determine sep_location
- if( $sep_location != 'right' ) {
- $sep_location = 'left';
- // Get the Site Name
- $site_name = get_bloginfo( 'name' );
- // Prepend name
- $filtered_title = $site_name . $sep . $title;
- // Return the modified title
- return $filtered_title;
- }
- // if sep_location is right
- elseif( $sep_location == 'right' ) {
- // Get the Site Name
- $site_name = get_bloginfo( 'name' );
- // Append name
- $filtered_title = $title . $sep . $site_name;
- // Return the modified title
- return $filtered_title;
- }
- }
- }
- // call our custom goldrush_filter_wp_title filter, with normal (10) priority, and 3 args
- add_filter( 'wp_title', 'goldrush_filter_wp_title', 10, 3 );
- //Enqueue all the scripts that depend on jquery and css
- function goldrush_js_enqueue(){
- wp_enqueue_script( 'jquery.tweet', get_template_directory_uri() . '/js/jquery.tweet.js');//Twitter Feed
- wp_enqueue_script( 'flexislider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'));//FlexSlider
- wp_enqueue_script( 'menujs', get_template_directory_uri() . '/js/menu.js', array('jquery'));//DropDownMenu
- wp_enqueue_script( 'flicker', get_template_directory_uri() . '/js/jflickrfeed.min.js', array('jquery'));//Flickr Feed
- wp_enqueue_script( 'quicksand', get_template_directory_uri() . '/js/custom.quicksand.js', array('jquery'));//PrettyPhoto
- wp_enqueue_script( 'prettyphoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'));//PrettyPhoto
- wp_enqueue_style('prettyphoto_css', get_template_directory_uri() .'/css/prettyPhoto.css');
- }
- add_action('wp_enqueue_scripts', 'goldrush_js_enqueue');
- /*Add the Hooks to place the javascript in the header*/
- function js_settings_script(){
- print ("<script>
- jQuery(document).ready(function($) {
- $('.flexslider').flexslider({
- animation: \"fade\"
- });
- $(function() {
- $('.show_menu').click(function(){
- $('.menu').fadeIn();
- $('.show_menu').fadeOut();
- $('.hide_menu').fadeIn();
- });
- $('.hide_menu').click(function(){
- $('.menu').fadeOut();
- $('.show_menu').fadeIn();
- $('.hide_menu').fadeOut();
- });
- });
- });
- jQuery(document).ready(function($) {
- $(\".tweet\").tweet({
- join_text: \"auto\",
- username: \"famousthemes\",
- count: 1,
- auto_join_text_default: \"we said,\",
- auto_join_text_ed: \"we\",
- auto_join_text_ing: \"we were\",
- auto_join_text_reply: \"we replied\",
- auto_join_text_url: \"we were checking out\",
- loading_text: \"loading tweets...\"
- });
- });
- </script>");
- }
- add_action('wp_enqueue_scripts', 'js_settings_script');
- function js_ftsettings_script(){
- print ("<script type=\"text/javascript\">
- var main_menu=new main_menu.dd(\"main_menu\");
- main_menu.init(\"main_menu\",\"menuhover\");
- </script>");
- }
- add_action('wp_footer', 'js_ftsettings_script');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement