= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'bodyhealth' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'bodyhealth_wp_title', 10, 2 ); function bodyhealth_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'bodyhealth' ), 'id' => 'sidebar-1', 'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'First Front Page Widget Area', 'bodyhealth' ), 'id' => 'sidebar-2', 'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } function bodyhealth_theme_name_script() { wp_enqueue_style( 'bodyhealth-bootstrap-style', get_template_directory_uri().'/css/bootstrap.css' ); wp_enqueue_style( 'bodyhealth-sheet-style', get_template_directory_uri().'/css/style.css' ); wp_enqueue_style( 'bodyhealth-red-style', get_template_directory_uri().'/css/red.css' ); wp_enqueue_style( 'bodyhealth-switch', get_template_directory_uri().'/styleswitcher/style-switcher.css' ); wp_enqueue_style( 'bodyhealth-style', get_template_directory_uri().'/style.css' ); wp_register_script( 'script-boot', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '1.0', true ); wp_enqueue_script('script-boot'); wp_register_script( 'script-validate', get_template_directory_uri() . '/js/jquery.validate.min.js', array('jquery'), '1.1', true ); wp_enqueue_script('script-validate'); wp_register_script( 'script-app', get_template_directory_uri() . '/js/app.js', array('jquery'), '1.3', true ); wp_enqueue_script('script-app'); wp_register_script( 'script-swicth', get_template_directory_uri() . '/styleswitcher/style-switcher.js', array('jquery'), '1.4', true ); wp_enqueue_script('script-swicth'); } add_action( 'init', 'bodyhealth_theme_name_script' ); add_action( 'widgets_init', 'bodyhealth_widgets_init' ); function register_menu() { register_nav_menus( array( 'main_menu' => 'main navigation', ) ); } if ( ! isset( $content_width ) ) $content_width = 980; add_action( 'init', 'register_menu' ); add_theme_support('post-thumbnails'); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'custom-header'); add_theme_support( 'custom-background'); function custom_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); if ( is_singular() ) wp_enqueue_script( "comment-reply" ); function mf_previous_image_link( $text ) { $i = mf_adjacent_image_link( true ); if ( $i ) print $text . $i; } function mf_next_image_link( $text ) { $i = mf_adjacent_image_link( false ); if ( $i ) print $text . $i; } function mf_adjacent_image_link($prev = true) { global $post; $post = get_post($post); $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\"")); foreach ( $attachments as $k => $attachment ) if ( $attachment->ID == $post->ID ) break; $k = $prev ? $k - 1 : $k + 1; if ( isset($attachments[$k]) ) return wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true); else return false; }