false, 'options' => array( 'prev_text' => esc_html__( 'Prev', 'raindrops' ), 'next_text' => esc_html__( 'Next', 'raindrops' ) ) ) ); } else { return $link; } } return; } } if ( !function_exists( 'raindrops_pagenav_filter' ) ) { /** * * @param type $nav_html * @return type * @since 1.248 */ function raindrops_pagenav_filter( $nav_html ) { if ( 'yes' == get_theme_mod( 'raindrops_wp_pagenavi_status' ) && 'yes' == raindrops_warehouse_clone( 'raindrops_plugin_presentation_wp_pagenav' ) ) { $before = array( 'previouspostslink"', 'nextpostslink"' ); $after = array( 'previouspostslink', 'previouspostslink' ); return str_replace( $before, $after, $nav_html ); } } } if ( !function_exists( 'raindrops_pagenav_css' ) ) { /** * * @since 1.248 */ function raindrops_pagenav_css() { if ( 'yes' == get_theme_mod( 'raindrops_wp_pagenavi_status' ) && 'yes' == raindrops_warehouse_clone( 'raindrops_plugin_presentation_wp_pagenav' ) ) { $color_type = raindrops_warehouse( 'raindrops_style_type' ); switch ( $color_type ) { case 'dark': $color_type_value = -3; $border_rgba = '191, 156, 118, 0.8'; break; case 'light': $color_type_value = 4; $border_rgba = '118, 156, 191, 1'; break; default: $color_type_value = false; $border_rgba = '118, 156, 191, 1'; break; } if ( $color_type_value !== false ) { $raindrops_gradient = raindrops_gradient_single_clone( $color_type_value ); } else { $raindrops_gradient = ''; } $raindrops_pagenav_css = ' .wp-pagenavi a:hover, .wp-pagenavi span.current{ border:2px solid rgba('. $border_rgba. '); margin:1px; } .wp-pagenavi{line-height:2.4;} .wp-pagenavi a, .wp-pagenavi span{ padding:0 5px;} .wp-pagenavi .first, .wp-pagenavi .page, .wp-pagenavi .pages, .wp-pagenavi .current, .wp-pagenavi .extend, .wp-pagenavi .previouspostslink, .wp-pagenavi .last{ display:inline-block; padding:0.23769em 0.76923em; border:1px solid rgba(222,222,222,.5); ' . $raindrops_gradient . ' } @media screen and (max-width : 640px){ .wp-pagenavi{margin:auto;max-width:98%;box-sizing:border-box;text-align:center;font-size:123.2%} .wp-pagenavi span{display:inline-block;line-height:2}.wp-pagenavi .extend{border:none;} .wp-pagenavi .previouspostslink,.wp-pagenavi .first,.wp-pagenavi .last,.wp-pagenavi .pages{display:block;text-align:center;} }'; $raindrops_pagenav_css = raindrops_remove_spaces_from_css( $raindrops_pagenav_css ); wp_add_inline_style( 'wp-pagenavi', $raindrops_pagenav_css ); } } } add_action( 'after_setup_theme', 'raindrops_bcn_setup' ); if ( !function_exists( 'raindrops_bcn_setup' ) ) { /** * * */ function raindrops_bcn_setup() { if ( 'yes' == get_theme_mod( 'raindrops_breadcrumb_navxt_status' ) && 'yes' == raindrops_warehouse_clone( 'raindrops_plugin_presentation_bcn_nav_menu' ) ) { add_action('raindrops_before_article', 'raindrops_bcn_nav_menu' ); add_action( 'raindrops_prepend_loop', 'raindrops_bcn_nav_menu' ); add_action( 'wp_enqueue_scripts', 'raindrops_bcn_css' ); if ( get_locale() == 'ja' ) { /** * Commentout Raindrops1.297 * Modify @1.403 filter active */ add_filter( 'bcn_template_tags', 'raindrops_template_tags_change_date', 10, 3 ); } } } } if ( !function_exists( 'raindrops_bcn_nav_menu' ) ) { /** * * @global type $post */ function raindrops_bcn_nav_menu() { global $post, $template; $template_name = basename( $template,'.php'); if ( 'yes' == get_theme_mod( 'raindrops_breadcrumb_navxt_status' ) && 'yes' == raindrops_warehouse_clone( 'raindrops_plugin_presentation_bcn_nav_menu' ) ) { $html = '
'; if ( 'bbpress' !== $template_name && !is_home() && !is_front_page() && ( isset( $post ) && 0 !== $post->ID ) ) { // $post->ID for check the events calendar $breadcrumb = bcn_display_list( true ); printf( $html, $breadcrumb ); } } } } if ( !function_exists( 'raindrops_bcn_css' ) ) { /** * * */ function raindrops_bcn_css() { if ( 'yes' == get_theme_mod( 'raindrops_breadcrumb_navxt_status' ) && 'yes' == raindrops_warehouse_clone( 'raindrops_plugin_presentation_bcn_nav_menu' ) ) { $raindrops_bcn_css = 'ol.breadcrumbs{ margin:1em 0; } .breadcrumbs li{ list-style:none; display:inline-block; margin:0; padding:0; } .breadcrumbs li:after{ content: "\bb"; display:inline-block; width:2em; text-align:center; } .breadcrumbs li:last-child:after{ content: ""; } .breadcrumbs .current{ font-weight:bold; } .entry-content li ul{ margin-top:1em; } .breadcrumbs a:hover{ opacity:0.75; } .entry-content ul .raindrops-toggle{ list-style:none; } .raindrops-toggle + .raindrops-toggle{ margin-top:1em; } @media screen and (max-width : 640px){ ol.breadcrumbs{ display:block; width:90%; margin:0 5%; box-sizing:border-box; } .yui-main .breadcrumbs li{ margin-left:1.5em; } .yui-main .breadcrumbs li{ display:block; } .yui-main .breadcrumbs li:after{ display:none; } .breadcrumbs{ margin:0 0 0 1em; padding:0; list-style:none; position:relative; } .yui-main .breadcrumbs:before { content:""; display:block; width:0; position:absolute; top:0; bottom:0; left:0; border-left:1px solid; font-weight:bold; } .breadcrumbs li { margin:0; padding:0 1.5em; line-height:2em; font-weight:bold; position:relative; text-align:left; } .breadcrumbs li:before { content:""; display:block; width:10px; height:0; border-top:1px solid; margin-top:-1px; position:absolute; top:1em; left:-1.5em; } .breadcrumbs li:last-child:before { height:auto; top:1em; bottom:0; } }'; $raindrops_bcn_css = raindrops_remove_spaces_from_css( $raindrops_bcn_css ); wp_add_inline_style( 'style', $raindrops_bcn_css ); } } } if ( !function_exists( 'raindrops_template_tags_change_date' ) ) { /** * * @param type $replacements * @param type $type * @param type $id * @return string */ function raindrops_template_tags_change_date( $replacements, $type, $id ) { if ( 'yes' == get_theme_mod( 'raindrops_breadcrumb_navxt_status' ) && 'yes' == raindrops_warehouse_clone( 'raindrops_plugin_presentation_bcn_nav_menu' ) ) { $this_type = implode( ',', $type ); if ( preg_match( '!date-year!', $this_type ) ) { $replacements[ "%htitle%" ] = str_replace('年','', $replacements[ "%htitle%" ] ); } if ( preg_match( '!date-day!', $this_type ) ) { $replacements[ "%htitle%" ] = str_replace('日','', $replacements[ "%htitle%" ] ); } return $replacements; } } } $raindrops_slider_action = raindrops_warehouse_clone( "raindrops_plugin_presentation_meta_slider" ); if ( !function_exists( 'raindrops_metaslider_basic_settings' ) ) { /** * * @global type $raindrops_slider_action * @param type $aFields * @return type */ function raindrops_metaslider_basic_settings( $aFields ) { global $raindrops_slider_action; if ( is_int( $raindrops_slider_action ) && shortcode_exists( 'metaslider' ) ) { $raindrops_page_width = raindrops_warehouse_clone( 'raindrops_page_width' ); switch ( $raindrops_page_width ) { case( 'doc' ): $aFields[ 'width' ][ 'value' ] = 750; break; case( 'doc2' ): $aFields[ 'width' ][ 'value' ] = 950; break; case( 'doc4' ): $aFields[ 'width' ][ 'value' ] = 974; break; default: $aFields[ 'width' ][ 'value' ] = raindrops_warehouse_clone( 'raindrops_fluid_max_width' ); break; } return $aFields; } } } if ( !function_exists( 'raindrops_insert_metaslider' ) ) { /** * * @global type $raindrops_slider_action * @param type $return_value * @return type */ function raindrops_insert_metaslider( $return_value ) { global $raindrops_slider_action; if ( is_int( $raindrops_slider_action ) && !empty( $raindrops_slider_action ) ) { $html = 'create funny space */ display:inline; } .alignleft{ clear:left; } .alignright{ clear:right; } .amp-wp-article-content:after{ content:''; display:table; clear:both; } ID ), 'single-post-thumbnail' ); $post_image_url = esc_url( $post_image_url[ 0 ] ); $post_image_width = $post_image_url[ 1 ]; $post_image_height = $post_image_url[ 2 ]; } else { $raindrops_header_image = get_custom_header(); $raindrops_header_image_uri = $raindrops_header_image->url; if ( empty( $raindrops_header_image_uri ) ) { $raindrops_header_image_uri = get_header_image(); } $raindrops_field_exists_check = get_post_custom_values( '_raindrops_this_header_image' ); if ( $raindrops_field_exists_check !== null ) { $display_header_image_file = get_post_meta( $post->ID, '_raindrops_this_header_image', true ); if ( !empty( $display_header_image_file ) && $display_header_image_file !== 'default' && is_singular() ) { $display_header_image_attr = wp_get_attachment_image_src( $display_header_image_file, 'full' ); if ( ! empty( $display_header_image_attr ) ) { $raindrops_header_image_uri = esc_url( $display_header_image_attr[ 0 ] ); $raindrops_header_image_width = absint( $display_header_image_attr[ 1 ] ); $raindrops_header_image_height = absint( $display_header_image_attr[ 2 ] ); } } } $post_image_url = $raindrops_header_image_uri; $post_image_width = $raindrops_header_image_width; $post_image_height = $raindrops_header_image_height; } if ( 'post' === $post->post_type ) { $metadata['@type'] = 'Article'; if( ! isset( $metadata['publisher']['logo'] ) ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( ! empty( $custom_logo_id ) ) { $logo_image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $logo_uri = apply_filters( 'raindrops_amp_logo_uri', esc_url( $logo_image[0] ), absint( $post->ID ) ); $logo_width = apply_filters( 'raindrops_amp_logo_width', absint( $logo_image[1] ), absint( $post->ID ) ); $logo_height = apply_filters( 'raindrops_amp_logo_height', absint( $logo_image[2] ), absint( $post->ID ) ); } else { $logo_uri = apply_filters( 'raindrops_amp_logo_uri', '', absint( $post->ID ) ); $logo_width = apply_filters( 'raindrops_amp_logo_width', '', absint( $post->ID ) ); $logo_height = apply_filters( 'raindrops_amp_logo_height', '', absint( $post->ID ) ); } $metadata['publisher']['logo'] = array( '@type' => 'ImageObject', 'url' => $logo_uri, 'width' => $logo_width, 'height' => $logo_height, ); } if( ! empty( $post_image_url ) ) { $image_uri = apply_filters( 'raindrops_amp_image_uri', esc_url( $post_image_url ), absint( $post->ID ) ); $image_width = apply_filters( 'raindrops_amp_image_width', absint( $post_image_width ), absint( $post->ID ) ); $image_height = apply_filters( 'raindrops_amp_image_width', absint( $post_image_height ), absint( $post->ID ) ); } else { $image_uri = apply_filters( 'raindrops_amp_image_uri', '', absint( $post->ID ) ); $image_width = apply_filters( 'raindrops_amp_image_width', '', absint( $post->ID ) ); $image_height = apply_filters( 'raindrops_amp_image_width', '', absint( $post->ID ) ); } if( ! isset( $metadata['image'] ) ) { $metadata['image'] = array( '@type' => 'ImageObject', 'url' => $image_uri, 'width' => $image_width, 'height' => $image_height, ); } return $metadata; } } } add_filter( 'amp_skip_post', 'raindrops_skip_amp', 10, 3 ); if( ! function_exists('raindrops_skip_amp') ) { /** * Skip AMP * add in entry content. * * @param type $bool * @param type $post_id * @param type $post * @return boolean * @since 1.421 */ function raindrops_skip_amp( $bool, $post_id, $post ) { if ( is_amp_endpoint() && preg_match( '##', $post->post_content ) ) { return true; } return $bool; } } add_filter( 'amp_frontend_show_canonical', 'raindrops_remove_amphtml__link_element' ); if( ! function_exists('raindrops_remove_amphtml__link_element') ) { /** * when exists in entry content ,remove * @1.438 */ function raindrops_remove_amphtml__link_element($val) { global $post; if( preg_match('##',$post->post_content) ) { return false; } return $val; } } add_action( 'amp_post_template_css', 'raindrops_load_amp_css', 11 ); if ( !function_exists( 'raindrops_load_amp_css' ) ) { /** * When theme has amp.css then load style amp page header * @since 1.421 */ function raindrops_load_amp_css() { $css = ''; $file_path = trailingslashit( get_stylesheet_directory() ) . 'amp.css'; if ( file_exists( $file_path ) ) { $style_rules = file( $file_path ); if ( !empty( $style_rules ) ) { foreach ( $style_rules as $rule ) { $css .= $rule; } $css = str_replace( array( "\n", "\r", "\t", '"', '\"' ), array( "", "", "", '"', '"' ), $css ); echo wp_strip_all_tags( $css ); } } } } } ?>