'content', 'footer' => 'main', ) ); } add_action( 'after_setup_theme', 'superhero_infinite_scroll_init' ); /** * Check whether or not footer widgets are present. If they are present, then a button to * 'Load more posts' will be displayed and IS will not be triggered unless a user manually clicks on that button. * * @param bool $has_widgets * @uses Jetpack_User_Agent_Info::is_ipad, jetpack_is_mobile, is_active_sidebar * @filter infinite_scroll_has_footer_widgets * @return bool */ function superhero_has_footer_widgets( $has_widgets ) { if ( ( Jetpack_User_Agent_Info::is_ipad() || ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() ) ) && is_active_sidebar( 'sidebar-1' ) ) $has_widgets = true; return $has_widgets; } add_filter( 'infinite_scroll_has_footer_widgets', 'superhero_has_footer_widgets' ); /** * Add support for the Featured Content Plugin * * @since Superhero 1.0 */ function superhero_featured_content_init() { add_theme_support( 'featured-content', array( 'featured_content_filter' => 'superhero_get_featured_posts', 'description' => __( 'The featured content section displays on the front page above the first post in the content area.', 'superhero' ), 'max_posts' => 10, 'post_types' => array( 'post', 'page' ), ) ); } add_action( 'after_setup_theme', 'superhero_featured_content_init' ); /** * Featured Posts * * @since Superhero 1.0 */ function superhero_has_multiple_featured_posts() { $featured_posts = apply_filters( 'superhero_get_featured_posts', array() ); return ( is_array( $featured_posts ) && 1 < count( $featured_posts ) ); } function superhero_get_featured_posts() { return apply_filters( 'superhero_get_featured_posts', false ); } /** * Add support for the Site Logo * * @since Superhero 1.1.6 */ function superhero_site_logo_init() { add_image_size( 'superhero-logo', 480, 150 ); add_theme_support( 'site-logo', array( 'size' => 'superhero-logo' ) ); } add_action( 'after_setup_theme', 'superhero_site_logo_init' ); /** * Return early if Site Logo is not available. */ function superhero_the_site_logo() { if ( ! function_exists( 'jetpack_the_site_logo' ) ) { return; } else { jetpack_the_site_logo(); } } /** * Add theme support for Responsive Videos * * @since Superhero 1.1.6 */ function superhero_responsive_videos_init() { add_theme_support( 'jetpack-responsive-videos' ); } add_action( 'after_setup_theme', 'superhero_responsive_videos_init' ); /** * Declare explicit support for Portfolios * * @since Superhero 1.3 */ function superhero_portfolio_init() { add_theme_support( 'jetpack-portfolio', array( 'title' => true, 'content' => true, 'featured-image' => true, ) ); } add_action( 'after_setup_theme', 'superhero_portfolio_init' ); /** * Portfolio Title. */ function superhero_portfolio_title( $before = '', $after = '' ) { $jetpack_portfolio_title = get_option( 'jetpack_portfolio_title' ); $title = ''; if ( is_post_type_archive( 'jetpack-portfolio' ) ) { if ( isset( $jetpack_portfolio_title ) && '' != $jetpack_portfolio_title ) { $title = esc_html( $jetpack_portfolio_title ); } else { $title = post_type_archive_title( '', false ); } } elseif ( is_tax( 'jetpack-portfolio-type' ) || is_tax( 'jetpack-portfolio-tag' ) ) { $title = single_term_title( '', false ); } echo $before . $title . $after; } /** * Portfolio Content. */ function superhero_portfolio_content( $before = '', $after = '' ) { $jetpack_portfolio_content = get_option( 'jetpack_portfolio_content' ); if ( is_tax() && get_the_archive_description() ) { echo $before . get_the_archive_description() . $after; } else if ( isset( $jetpack_portfolio_content ) && '' != $jetpack_portfolio_content ) { $content = convert_chars( convert_smilies( wptexturize( wp_kses_post( $jetpack_portfolio_content ) ) ) ); echo $before . $content . $after; } } /** * Portfolio Featured Image. */ function superhero_portfolio_thumbnail( $before = '', $after = '' ) { $jetpack_portfolio_featured_image = get_option( 'jetpack_portfolio_featured_image' ); if ( isset( $jetpack_portfolio_featured_image ) && '' != $jetpack_portfolio_featured_image ) { $featured_image = wp_get_attachment_image( (int) $jetpack_portfolio_featured_image, 'feat-img' ); echo $before . $featured_image . $after; } } /** * Filter Infinite Scroll text handle. */ function superhero_portfolio_infinite_scroll_navigation( $js_settings ) { if ( is_post_type_archive( 'jetpack-portfolio' ) || is_tax( 'jetpack-portfolio-type' ) || is_tax( 'jetpack-portfolio-tag' ) ) { $js_settings[ 'text' ] = esc_js( esc_html__( 'Older projects', 'superhero' ) ); } return $js_settings; } add_filter( 'infinite_scroll_js_settings', 'superhero_portfolio_infinite_scroll_navigation' );