isDark() ) { $dark = true; // If it's a vertical gradient. } elseif ( 'to bottom' === pen_option_get( 'color_header_background_angle' ) ) { $color = new \Pen_Theme\Color( pen_option_get( 'color_header_background_secondary' ) ); if ( $color->isDark() ) { $dark = true; } } if ( $dark ) { /** * Although we can analyze images to determine whether they * are dark or light but it is very resource intensive, * so we just ignore the light-colored logo when there is * a background image. * In later versions we may let the user choose this, especially * if we decide to add it to the plugin. */ $header_image = get_header_image(); if ( $header_image ) { $dark = false; } else { $background_dynamic = get_post_meta( $content_id, 'pen_content_background_image_header_dynamic_override', true ); if ( ! $background_dynamic || 'default' === $background_dynamic ) { $background_dynamic = pen_option_get( 'background_image_header_dynamic' ); } if ( 'featured_image' === $background_dynamic && $content_id ) { $image_dynamic = get_the_post_thumbnail_url(); if ( $image_dynamic ) { $dark = false; } } } } if ( $dark ) { $logo_url = $logo_url_light; } } if ( ! $logo_url ) { if ( function_exists( 'get_custom_logo' ) ) { $logo = trim( get_custom_logo() ); } else { return; } } else { $id = attachment_url_to_postid( $logo_url ); $attributes = array( 'class' => 'custom-logo', 'itemprop' => 'logo', ); $alt = get_post_meta( $id, '_wp_attachment_image_alt', true ); if ( ! $alt ) { $attributes['alt'] = get_bloginfo( 'name', 'display' ); } $logo = sprintf( '', esc_url( home_url( '/' ) ), wp_get_attachment_image( $id, 'full', false, $attributes ) ); } if ( $logo ) { $classes = array( 'pen_logo', pen_class_animation( $location . '_logo', false, $content_id ), ); $classes = implode( ' ', array_filter( $classes ) ); ob_start(); ?>
  • 'primary', 'menu_id' => 'primary-menu', 'menu_class' => 'menu', 'echo' => false, 'fallback_cb' => 'pen_html_navigation_fallback', ); $menu_html = trim( wp_nav_menu( $variables ) ); } elseif ( 'secondary' === $menu_id ) { // Does not have a content-level visibility option. if ( pen_option_get( 'footer_menu_display' ) ) { $variables = array( 'theme_location' => 'secondary', 'menu_id' => 'secondary-menu', 'menu_class' => 'menu', 'echo' => false, 'fallback_cb' => 'pen_html_footer_menu_fallback', ); $menu_html = trim( wp_nav_menu( $variables ) ); } } return $menu_html; } } if ( ! function_exists( 'pen_html_navigation_main' ) ) { /** * Generates HTML for the main navigation menus. * * @param string $menu_id Menu ID. * @param int $content_id Content ID. * * @since Pen 1.3.0 * @return string */ function pen_html_navigation_main( $menu_id, $content_id ) { $navigation_display = get_post_meta( $content_id, 'pen_navigation_display_override', true ); if ( ! $navigation_display || 'default' === $navigation_display ) { $navigation_display = pen_option_get( 'navigation_display' ); } if ( ! $navigation_display || 'no' === $navigation_display ) { $navigation_display = false; } else { $navigation_display = true; } if ( $navigation_display || 'never' !== pen_option_get( 'navigation_mobile_display' ) ) { $menu_html = pen_html_menu( $menu_id ); if ( $menu_html ) { $is_customize_preview = is_customize_preview(); ob_start(); if ( PEN_THEME_SMALLSCREEN || $is_customize_preview ) { pen_sidebar_get( 'sidebar-mobile-menu-top', $content_id ); } $hover = pen_option_get( 'navigation_hover' ); $arrows = pen_option_get( 'navigation_arrows' ); $separator = pen_option_get( 'navigation_separator' ); $separator_submenu = pen_option_get( 'navigation_separator_submenu' ); $classes_navigation = array( 'main-navigation', ( ! $navigation_display ) ? 'pen_element_hidden' : '', 'pen_hover_' . ( $hover ? $hover : 'none' ), 'pen_arrows_' . ( $arrows ? $arrows : 'none' ), 'pen_separator_' . ( $separator ? $separator : 'none' ), 'pen_separator_submenu_' . ( $separator_submenu ? $separator_submenu : 'none' ), pen_class_animation( 'navigation_bar', false, $content_id ), ); $classes_navigation = implode( ' ', array_filter( $classes_navigation ) ); ?>
  • %3$s', esc_attr( $url ), $attributes, /* phpcs:ignore */ esc_html__( 'Create a menu?', 'pen' ) ); ?>
  • %s', implode( ' ', array_filter( array( 'posted-on', 'pen_content_date', 'pen_content_date_published', pen_class_lists( 'date_display_override', $content_id ), ) ) ), sprintf( /* Translators: Publish date. */ esc_html_x( 'Posted on %s', 'Date', 'pen' ), sprintf( '%2$s', esc_url( $permalink ), sprintf( '', esc_attr( get_the_date( DATE_W3C ) ), esc_html( get_the_date() ) ) ) ) ); if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $date_updated = sprintf( '%s', implode( ' ', array_filter( array( 'pen_content_date', 'pen_content_date_updated', pen_class_lists( 'date_updated_display_override', $content_id ), ) ) ), sprintf( /* Translators: Update date. */ esc_html_x( 'Updated on %s', 'Date', 'pen' ), sprintf( '%2$s', esc_url( $permalink ), sprintf( '', esc_attr( get_the_modified_date( DATE_W3C ) ), esc_html( get_the_modified_date() ) ) ) ) ); } } $byline = ''; $author_location = get_post_meta( $content_id, 'pen_' . $view . '_author_location_override', true ); if ( ! $author_location || 'default' === $author_location ) { $author_location = pen_option_get( $view . '_author_location' ); } if ( $location === $author_location || ( ! $author_location && 'header' === $location ) ) { $byline = sprintf( '%s', implode( ' ', array_filter( array( 'byline', 'pen_content_author', pen_class_lists( 'author_display_override', $content_id ), ) ) ), sprintf( /* Translators: Author's name. */ esc_html_x( 'by %s', 'Author', 'pen' ), sprintf( '%2$s', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ) ) ); } $categories_list = ''; $category_location = get_post_meta( $content_id, 'pen_' . $view . '_category_location_override', true ); if ( ! $category_location || 'default' === $category_location ) { $category_location = pen_option_get( $view . '_category_location' ); } if ( $location === $category_location || ( ! $category_location && 'header' === $location ) ) { /* Translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( '||' ); if ( pen_option_get( 'pen_' . $view . '_category_only_first' ) && false !== strpos( $categories_list, '||' ) ) { $categories_list = explode( '||', $categories_list ); $categories_list = $categories_list[0]; } $categories_list = str_replace( '||', _x( ', ', 'Separates category links.', 'pen' ), $categories_list ); if ( $categories_list ) { $categories_list = sprintf( '%s%s', implode( ' ', array_filter( array( 'cat-links', 'pen_content_categories', pen_class_lists( 'category_display_override', $content_id ), ) ) ), sprintf( /* Translators: Just some words. */ __( '%s:', 'pen' ), __( 'Categories', 'pen' ) ), $categories_list ); /* phpcs:ignore */ } } $output = trim( $date_published . $date_updated . $byline . $categories_list ); if ( $output ) { $classes = array( 'entry-meta', 'pen_separator_' . pen_option_get( 'content_details_separator' ), ); $classes = implode( ' ', $classes ); ob_start(); ?>
    array( 'datetime' => true, ) ), wp_kses_allowed_html( 'post' ) ) ); } } } if ( ! function_exists( 'pen_html_content_next_previous' ) ) { /** * Next/Previous Content. * * @param int $content_id The content ID. * * @since Pen 1.3.9 * @return void */ function pen_html_content_next_previous( $content_id ) { $display_previous = get_post_meta( $content_id, 'pen_content_previous_display_override', true ); if ( ! $display_previous || 'default' === $display_previous ) { $display_previous = pen_option_get( 'content_previous_display' ); } if ( ! $display_previous || 'no' === $display_previous ) { $display_previous = false; } else { $display_previous = true; } $display_next = get_post_meta( $content_id, 'pen_content_next_display_override', true ); if ( ! $display_next || 'default' === $display_next ) { $display_next = pen_option_get( 'content_next_display' ); } if ( ! $display_next || 'no' === $display_next ) { $display_next = false; } else { $display_next = true; } if ( $display_previous || $display_next ) { $output = ''; $in_same_term = pen_option_get( 'content_next_previous_only_similar' ); $excluded_terms = ''; $previous = true; $taxonomy = 'category'; $classes = array( ( 'button' === pen_option_get( 'content_next_previous_type' ) ) ? 'pen_button' : '', 'pen_icon_' . sanitize_html_class( pen_option_get( 'content_next_previous_icon' ) ), ); if ( $display_previous ) { if ( is_attachment() ) { $content_previous = get_post( get_post( $content_id )->post_parent ); } else { $content_previous = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy ); } if ( ! empty( $content_previous ) ) { $text_previous = pen_option_get( 'content_previous_text' ); $classes_previous = $classes; $classes_previous[] = 'pen_text_' . sanitize_html_class( $text_previous ); $classes_previous[] = pen_class_animation( 'content_previous', false, $content_id ); $classes_previous = implode( ' ', array_filter( $classes_previous ) ); if ( false !== strpos( $text_previous, 'date' ) ) { $text = gmdate( 'M j, Y', strtotime( $content_previous->post_date ) ); } else { $text = __( 'Previous', 'pen' ); } $title = ''; if ( false !== strpos( $text_previous, '_title' ) ) { $title = sprintf( '%s', esc_html( $content_previous->post_title ) ); } $output .= sprintf( '%4$s%5$s', esc_url( get_permalink( $content_previous->ID ) ), esc_attr( $content_previous->post_title ), esc_attr( $classes_previous ), esc_html( $text ), $title ); } } if ( $display_next ) { $previous = false; $content_next = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy ); if ( ! empty( $content_next ) ) { $text_next = pen_option_get( 'content_next_text' ); $classes_next = $classes; $classes_next[] = 'pen_text_' . sanitize_html_class( $text_next ); $classes_next[] = pen_class_animation( 'content_next', false, $content_id ); $classes_next = implode( ' ', array_filter( $classes_next ) ); if ( false !== strpos( $text_next, 'date' ) ) { $text = gmdate( 'M j, Y', strtotime( $content_next->post_date ) ); } else { $text = __( 'Next', 'pen' ); } $title = ''; if ( false !== strpos( $text_next, '_title' ) ) { $title = sprintf( '%s', esc_html( $content_next->post_title ) ); } $output .= sprintf( '%4$s%5$s', esc_url( get_permalink( $content_next->ID ) ), esc_attr( $content_next->post_title ), esc_attr( $classes_next ), esc_html( $text ), $title ); } } if ( $output ) { ?>

    'multipart', ) ); } else { wp_link_pages( array( 'before' => sprintf( '', 'next_or_number' => 'next', ) ); } $pagination = trim( ob_get_clean() ); if ( $pagination ) { ?>

    %2$s', esc_url( $archive_url ), esc_html( get_the_author() ) ); } if ( 'list' === $view ) { ?>

    post_title ); $url_facebook = sprintf( 'https://www.facebook.com/sharer/sharer.php?u=%1$s', $url ); $url_twitter = sprintf( 'https://twitter.com/intent/tweet?text=%2$s&url=%1$s', $url, $title ); $url_linkedin = sprintf( 'https://www.linkedin.com/cws/share?url=%1$s&original_referer=%2$s', $url, home_url( '/' ) ); ?>

    $label ) { $value = get_post_meta( $content_id, $option, true ); if ( $value && 'default' !== $value ) { $edit_post_display = true; $overview_list[ $option ] = array( 'status' => ( 'no' === $value ) ? 'disabled' : 'enabled', 'label' => $label, 'value' => $value, 'help' => '', ); } } $options_content = pen_post_meta_options( 'content' ); foreach ( $options_content as $option => $label ) { $value = get_post_meta( $content_id, $option, true ); if ( $value && 'default' !== $value ) { $edit_post_display = true; $overview_content[ $option ] = array( 'status' => ( 'no' === $value ) ? 'disabled' : 'enabled', 'label' => $label, 'value' => $value, 'help' => '', ); } } $options_sidebars = pen_post_meta_options( 'sidebar' ); $is_homepage = ( is_front_page() && pen_is_singular() ) ? true : false; foreach ( $options_sidebars as $sidebar => $name ) { if ( $is_homepage ) { if ( pen_option_get( str_replace( 'pen_', 'pen_front_', $sidebar ) ) ) { $customize_display = true; $overview_sidebars[ $sidebar ] = array( 'status' => 'disabled', 'label' => sprintf( /* Translators: Sidebar name. */ esc_html__( '(If on homepage) "%s"', 'pen' ), $name ), 'value' => __( 'Hide', 'pen' ), 'help' => sprintf( /* Translators: Path to the settings page. */ __( 'You can change this through %s', 'pen' ), sprintf( '%1$s → %2$s → %3$s → %4$s.', __( 'Appearance', 'pen' ), __( 'Customize', 'pen' ), __( 'Front Page', 'pen' ), __( 'Sidebars', 'pen' ) ) ), ); } } if ( get_post_meta( $content_id, $sidebar, true ) ) { $edit_post_display = true; $sidebar_id = str_replace( array( 'pen_sidebar_', '_display', '_' ), array( '', '', '-' ), $sidebar ); $sidebars = pen_sidebars(); if ( in_array( $sidebar_id, array( 'left', 'right' ), true ) ) { $label = $sidebars[ $sidebar_id ]['name']; } else { $label = sprintf( /* Translators: Sidebar name. */ __( '"%s" Widget Area', 'pen' ), $sidebars[ $sidebar_id ]['name'] ); } $overview_sidebars[ $sidebar ] = array( 'status' => 'disabled', 'label' => $label, 'value' => __( 'Hide', 'pen' ), 'help' => '', ); } } if ( empty( $overview_list ) && empty( $overview_content ) && empty( $overview_sidebars ) ) { ob_end_clean(); return; } ?>

    $item ) { $is_visibility = ( strpos( $option_id, 'display' ) !== false ) ? true : false; ?> $item ) { $is_visibility = ( strpos( $option_id, 'display' ) !== false ) ? true : false; ?>

    %s', esc_html( $menu['name'] ) ) ) ); $heading_title = htmlspecialchars( wp_strip_all_tags( str_replace( '"', '', htmlspecialchars_decode( $heading_text ) ) ), ENT_NOQUOTES, 'UTF-8' ); // This menu has to be hidden when JavaScript is disabled (too many links) unless it's a screen-reader. ?>
    __( 'Free Registration', 'pen' ), 'login_register' => sprintf( /* Translators: Just some words. */ __( '%1$s / %2$s', 'pen' ), __( 'Login', 'pen' ), __( 'Register', 'pen' ) ), 'register' => __( 'Register', 'pen' ), 'register_today' => __( 'Register Today', 'pen' ), 'shop_now' => __( 'Shop Now', 'pen' ), 'sign_in' => __( 'Sign in', 'pen' ), 'sign_up' => __( 'Sign up', 'pen' ), 'subscribe' => __( 'Subscribe', 'pen' ), 'subscribe_today' => __( 'Subscribe Today', 'pen' ), ); if ( ! empty( $choices[ $text ] ) ) { $text = $choices[ $text ]; } else { $text = sprintf( /* Translators: Just some words. */ __( '%1$s / %2$s', 'pen' ), __( 'Login', 'pen' ), __( 'Register', 'pen' ) ); } $url_register = wp_kses_post( pen_option_get( 'button_users_' . $location . '_url' ) ); if ( ! $url_register ) { if ( PEN_THEME_HAS_WOOCOMMERCE ) { $url_register = get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ); } else { $url_register = wp_registration_url(); } } ?> containing posts. * * @param int $content_id Content ID. * * @since Pen 1.3.0 * @return string */ function pen_html_id_layout( $content_id ) { $content_list_type = pen_list_type( $content_id ); switch ( $content_list_type ) { case 'masonry': $html_id = 'pen_masonry'; break; case 'tiles': $html_id = 'pen_tiles'; break; default: $html_id = 'pen_plain'; } return $html_id; } } if ( ! function_exists( 'pen_html_phone' ) ) { /** * Generates HTML markup for the phone number. * * @param string $location Location. * @param int $content_id Content ID. * * @since Pen 1.3.0 * @return string */ function pen_html_phone( $location, $content_id ) { if ( ! in_array( $location, array( 'header', 'footer' ), true ) ) { $location = 'header'; } $phone = pen_option_get( 'phone' ); if ( ! pen_option_get( 'phone_' . $location . '_display' ) ) { return; } $classes_phone = array( 'pen_phone', pen_class_animation( 'phone_' . $location, false, $content_id ), ); $classes_phone = implode( ' ', array_filter( $classes_phone ) ); ob_start(); ?>
    __( 'Call me:', 'pen' ), 'call_now' => __( 'Call Now:', 'pen' ), 'call_us' => __( 'Call us:', 'pen' ), 'direct_line' => __( 'Direct Line:', 'pen' ), 'for_more_information' => __( 'For more information:', 'pen' ), 'give_me_a_call' => __( 'Give me a call:', 'pen' ), 'give_us_a_call' => __( 'Give us a call:', 'pen' ), 'lets_talk' => __( "Let's talk!", 'pen' ), 'phone' => sprintf( /* Translators: Just some words. */ __( '%s:', 'pen' ), __( 'Phone', 'pen' ) ), 'phone_number' => __( 'Phone Number:', 'pen' ), 'talk_to_an_expert' => __( 'Talk to an expert:', 'pen' ), 'talk_to_an_operator' => __( 'Talk to an operator:', 'pen' ), 'tel' => __( 'Tel:', 'pen' ), 'toll_free' => __( 'Toll Free:', 'pen' ), ); if ( ! empty( $choices[ $text ] ) ) { $text = $choices[ $text ]; } else { $text = __( 'Phone Number:', 'pen' ); } echo esc_html( $text ); ?>
    >
    $url_preview, 'text' => __( 'Color Schemes', 'pen' ), ); $preset_color_current = (int) str_replace( 'preset_', '', pen_preset_get( 'color' ) ); for ( $i = 1; $i <= 15; $i++ ) { $links['color_schemes']['children'][ 'style_' . $i ] = array( 'url' => add_query_arg( array( 'pen_preview_color' => (int) $i, ), $url_preview ), 'text' => sprintf( /* Translators: Just a number. */ __( 'Style %d', 'pen' ), $i ), ); if ( $i === $preset_color_current ) { $links['color_schemes']['children'][ 'style_' . $i ]['text'] .= sprintf( ' %s', sprintf( /* Translators: Just some word. */ __( '(%s)', 'pen' ), __( 'Current', 'pen' ) ) ); } } $links['font_groups'] = array( 'url' => $url_preview, 'text' => __( 'Font Groups', 'pen' ), ); $preset_font_current = (int) str_replace( 'preset_', '', pen_preset_get( 'font' ) ); for ( $i = 1; $i <= 10; $i++ ) { $links['font_groups']['children'][ 'group_' . $i ] = array( 'url' => add_query_arg( array( 'pen_preview_font' => (int) $i, ), $url_preview ), 'text' => sprintf( '%s %d', __( 'Font Group', 'pen' ), $i ), ); if ( $i === $preset_font_current ) { $links['font_groups']['children'][ 'group_' . $i ]['text'] .= sprintf( ' %s', sprintf( /* Translators: Just some word. */ __( '(%s)', 'pen' ), __( 'Current', 'pen' ) ) ); } } if ( ! pen_is_singular() ) { $links['layout'] = array( 'url' => $url_preview, 'text' => __( 'Layout', 'pen' ), ); if ( 'plain' === pen_filter_input( 'GET', 'pen_preview_layout' ) ) { $links['layout']['children'][] = array( 'url' => home_url( '/' ), 'text' => 'jQuery Masonry', ); } else { $links['layout']['children'][] = array( 'url' => add_query_arg( array( 'pen_preview_layout' => 'plain' ), $url_preview ), 'text' => __( 'Plain List', 'pen' ), ); } } $preview_layout = pen_filter_input( 'GET', 'pen_preview_layout' ); if ( $preview_layout && in_array( $preview_layout, array( 'jquery_masonry', 'plain' ), true ) ) { $url_preview = add_query_arg( array( 'pen_preview_layout' => $preview_layout ), $url_preview ); } $links['about'] = array( 'url' => add_query_arg( array( 'page_id' => 2 ), $url_preview ), 'text' => __( 'About', 'pen' ), ); ob_start(); foreach ( $links as $id => $link ) { $has_children = ( ! empty( $link['children'] ) && is_array( $link['children'] ) ) ? true : false; $classes = array( 'menu-item', 'pen_' . sanitize_html_class( $id ), $has_children ? 'menu-item-has-children' : '', ); $classes = implode( ' ', array_filter( $classes ) ); ?>
  • %2$s', esc_attr( $link['url'] ), esc_html( $link['text'] ) ); if ( $has_children ) { ?>
  • ', // Wish we had other options. esc_url( 'https://wp-themes.com/wp-content/themes/twentyseventeen/assets/images/' . $preview_image ) ) ); } } } if ( ! function_exists( 'pen_html_preview_enhance_sidebar' ) ) { /** * Enhances wp-themes.com preview by populating the widget areas. * * @global WP_Widget_Factory $wp_widget_factory * * @param string $sidebar The sidebar ID. * * @since Pen 1.3.9 * @return string */ function pen_html_preview_enhance_sidebar( $sidebar ) { $widgets = array( 'sidebar-left' => array( 'WP_Widget_Calendar', 'WP_Widget_Recent_Posts', 'WP_Nav_Menu_Widget', 'WP_Widget_Categories', 'WP_Widget_Links', 'WP_Widget_Recent_Comments', 'WP_Widget_Tag_Cloud', 'WP_Widget_Pages', ), 'sidebar-bottom' => array( 'WP_Widget_Pages', 'WP_Widget_Recent_Posts', 'WP_Widget_Recent_Comments', 'WP_Widget_Categories', 'WP_Widget_Calendar', 'WP_Widget_Tag_Cloud', 'WP_Nav_Menu_Widget', ), ); if ( 'plain' === pen_filter_input( 'GET', 'pen_preview_layout' ) ) { $widgets['sidebar-left'] = array( 'WP_Widget_Recent_Posts', 'WP_Nav_Menu_Widget', 'WP_Widget_Categories', ); $widgets['sidebar-right'] = array( 'WP_Widget_Calendar', 'WP_Widget_Links', 'WP_Widget_Recent_Comments', 'WP_Widget_Tag_Cloud', 'WP_Widget_Pages', ); } if ( empty( $widgets[ $sidebar ] ) ) { return; } global $wp_widget_factory; ob_start(); $count = 0; $limit = 10; if ( 'sidebar-bottom' === $sidebar ) { $limit = 4; } foreach ( $widgets[ $sidebar ] as $widget_id ) { if ( $limit < $count ) { break; } if ( isset( $wp_widget_factory->widgets[ $widget_id ] ) ) { $widget_object = $wp_widget_factory->widgets[ $widget_id ]; if ( $widget_object instanceof WP_Widget ) { $instance = array(); if ( 'WP_Nav_Menu_Widget' === $widget_id ) { $instance = array( 'title' => __( 'Menu', 'pen' ), 'nav_menu' => 'primary', ); } $variables = array( 'option' => 'color_scheme', 'sidebar_id' => $sidebar, ); $color = pen_widget_determine_default( $variables ); if ( empty( $color ) ) { $color = 'transparent'; } $classes = array( 'widget', 'clearfix', ); $classes[] = 'pen_widget_' . $color; if ( false !== strpos( $color, '_flat' ) ) { $classes[] = 'pen_widget_' . str_replace( '_flat', '', $color ); } if ( 'transparent' !== $color ) { $classes[] = 'pen_widget_not_transparent '; } $classes = implode( ' ', array_filter( $classes ) ); $arguments = array( 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', ); the_widget( $widget_id, $instance, $arguments ); $count++; } } } return ob_get_clean(); } }