-
-
Save tenman/1d3c74d59e1c3b1855fd to your computer and use it in GitHub Desktop.
template include date.php to index.php relate change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( !function_exists( "raindrops_embed_meta" ) ) { | |
function raindrops_embed_meta( $content ) { | |
global $post, $wp_customize, $content_width, $raindrops_use_transient, $raindrops_stylesheet_type; | |
if ( ! isset( $raindrops_stylesheet_type ) ) { | |
$raindrops_stylesheet_type = raindrops_warehouse_clone( 'raindrops_stylesheet_in_html' ); | |
} | |
if ( true == $raindrops_use_transient && !is_user_logged_in() && false !== ( $raindrops_embed_meta_transien = get_transient( 'raindrops_embed_meta_transient' ) ) ) { | |
echo $raindrops_embed_meta_transien; | |
return $content; | |
} | |
$raindrops_use_featured_image_emphasis = raindrops_warehouse_clone( 'raindrops_use_featured_image_emphasis' ); | |
if ( $raindrops_use_featured_image_emphasis == 'yes' ) { | |
$raindrops_post_image_position = raindrops_warehouse_clone( 'raindrops_featured_image_position' ); | |
add_filter( 'raindrops_post_thumbnail_size_main_query', 'raindrops_post_thumbnail_size_in_the_loop', 10, 3 ); | |
switch ( $raindrops_post_image_position ) { | |
case( 'front' ): | |
add_filter( 'raindrops_embed_meta_css', 'raindrops_post_thumbnail_size_block_style' ); | |
break; | |
case( 'left' ): | |
add_filter( 'raindrops_embed_meta_css', 'raindrops_post_thumbnail_size_lefty_style' ); | |
break; | |
default: | |
remove_filter( 'raindrops_embed_meta_css', 'raindrops_post_thumbnail_size_block_style' ); | |
remove_filter( 'raindrops_embed_meta_css', 'raindrops_post_thumbnail_size_lefty_style' ); | |
} | |
} | |
$result = ""; | |
$css = apply_filters( 'raindrops_embed_meta_pre',''); | |
$css .='#doc5 .raindrops-keep-content-width{width:'. $content_width. 'px;max-width:100%;margin:auto;float:none;}'. "\n"; | |
$css .='#doc5 .raindrops-keep-content-width .raindrops-expand-width{margin:0;}'. "\n"; | |
$css .='#doc3 .raindrops-keep-content-width{width:'. $content_width. 'px;max-width:100%;margin:auto;float:none;}'. "\n"; | |
$css .='#doc3 .raindrops-keep-content-width .raindrops-expand-width{margin:0;}'. "\n"; | |
if ( isset( $wp_customize ) || $raindrops_stylesheet_type !== 'external' ) { | |
$css .= raindrops_embed_css(); | |
} | |
$result_indv = ''; | |
$pinup_style = ''; | |
if ( RAINDROPS_USE_AUTO_COLOR !== true ) { | |
// $css = ''; | |
} | |
if ( is_single() || is_page() ) { | |
$pinup_widget_ids = raindrops_get_pinup_widget_ids(); | |
$pinup_widget_post_ids = raindrops_pinup_widget_ids_to_post_ids( $pinup_widget_ids ); | |
foreach( $pinup_widget_post_ids as $pinup_id ){ | |
$web_fonts = get_post_meta( $pinup_id, '_web_fonts_link_element', true ); | |
if ( isset( $web_fonts ) && !empty( $web_fonts ) ) { | |
$web_fonts_each_array = explode("\n", $web_fonts); | |
foreach( $web_fonts_each_array as $web_fonts_each ) { | |
$result = str_replace( array( $web_fonts_each,"\n\n"), array('',"\n"), $result ); | |
$result .= $web_fonts_each ."\n"; | |
} | |
} | |
$web_fonts_style = get_post_meta( $pinup_id, '_web_fonts_styles', true ); | |
if ( isset( $web_fonts_style ) && !empty( $web_fonts_style ) ) { | |
$web_fonts_style_each_array = explode("\n", $web_fonts_style ); | |
foreach( $web_fonts_style_each_array as $web_fonts_style_each ) { | |
$pinup_style = str_replace( array( $web_fonts_style_each,"\n\n"), array('',"\n"), $pinup_style ); | |
$pinup_style .= $web_fonts_style_each ."\n"; | |
} | |
} | |
} | |
$web_fonts = get_post_meta( get_the_ID(), '_web_fonts_link_element', true ); | |
if ( isset( $web_fonts ) && !empty( $web_fonts ) ) { | |
$result .= $web_fonts ; | |
} | |
$web_fonts_styles = get_post_meta( $post->ID, '_web_fonts_styles', true ); | |
if ( ( isset( $web_fonts_styles ) && !empty( $web_fonts_styles ) ) || !empty( $pinup_style )) { | |
$web_fonts_styles_wrapper = "<style type=\"text/css\" media=\"screen\">\n". '%1$s</style>'. "\n"; | |
$result .= sprintf( $web_fonts_styles_wrapper, $web_fonts_styles. $pinup_style ); | |
} | |
$css_single = get_post_meta( $post->ID, 'css', true ); | |
/* 1.234 metabox support */ | |
$css_single .= get_post_meta( $post->ID, '_css', true ); | |
if ( true == RAINDROPS_OVERRIDE_POST_STYLE_ALL_CONTENTS ) { | |
$css .= preg_replace_callback( '![^}]+{[^}]+}!siu', 'raindrops_css_add_id', $css_single ); | |
} else { | |
$css_single = $css_single; | |
} | |
if ( !empty( $css ) && RAINDROPS_CUSTOM_FIELD_CSS == true ) { | |
$result .= '<style type="text/css" id="raindrops-embed-css">'; | |
$result .= "\n<!--/*<! [CDATA[*/\n"; | |
$result .= strip_tags( $css ); | |
$result .= "\n/*]]>*/-->\n"; | |
$result .= "</style>"; | |
} | |
$meta = get_post_meta( $post->ID, 'meta', true ); | |
if ( !empty( $meta ) && RAINDROPS_CUSTOM_FIELD_META == true ) { | |
$result .= raindrops_esc_custom_field_meta( $meta ); | |
} | |
$javascript = get_post_meta( $post->ID, 'javascript', true ); | |
if ( !empty( $javascript ) && RAINDROPS_CUSTOM_FIELD_SCRIPT == true ) { | |
$result .= '<script type="text/javascript">'; | |
$result .= "\n<!--/*<! [CDATA[*/\n"; | |
$result .= raindrops_esc_custom_field_javascript( $javascript ); | |
$result .= "\n/*]]>*/-->\n"; | |
$result .= "</script>"; | |
} | |
} else { | |
$pinup_widget_ids = raindrops_get_pinup_widget_ids(); | |
$pinup_widget_post_ids = raindrops_pinup_widget_ids_to_post_ids( $pinup_widget_ids ); | |
if( isset($pinup_widget_post_ids) && is_array( $pinup_widget_post_ids ) ) { | |
foreach( $pinup_widget_post_ids as $pinup_id ){ | |
$web_fonts = get_post_meta( $pinup_id, '_web_fonts_link_element', true ); | |
if ( isset( $web_fonts ) && !empty( $web_fonts ) ) { | |
$web_fonts_each_array = explode("\n", $web_fonts); | |
foreach( $web_fonts_each_array as $web_fonts_each ) { | |
$result = str_replace( array( $web_fonts_each,"\n\n"), array('',"\n"), $result ); | |
$result .= $web_fonts_each ."\n"; | |
} | |
} | |
$web_fonts_style = get_post_meta( $pinup_id, '_web_fonts_styles', true ); | |
if ( isset( $web_fonts_style ) && !empty( $web_fonts_style ) ) { | |
$web_fonts_style_each_array = explode("\n", $web_fonts_style ); | |
foreach( $web_fonts_style_each_array as $web_fonts_style_each ) { | |
$result_indv = str_replace( array( $web_fonts_style_each,"\n\n"), array('',"\n"), $result_indv ); | |
$result_indv .= $web_fonts_style_each ."\n"; | |
} | |
} | |
} | |
} | |
if ( true == RAINDROPS_OVERRIDE_POST_STYLE_ALL_CONTENTS ) { | |
if ( have_posts() ) { | |
if ( false == RAINDROPS_USE_AUTO_COLOR ) { | |
} | |
while ( have_posts() ) { | |
the_post(); | |
$web_fonts = get_post_meta( $post->ID, '_web_fonts_link_element', true ); | |
if ( isset( $web_fonts ) && !empty( $web_fonts ) ) { | |
$web_fonts_each_array = explode("\n", $web_fonts); | |
foreach( $web_fonts_each_array as $web_fonts_each ) { | |
$result = str_replace( array( $web_fonts_each,"\n\n"), array('',"\n"), $result ); | |
$result .= $web_fonts_each ."\n"; | |
} | |
} | |
$web_fonts_style = get_post_meta( $post->ID, '_web_fonts_styles', true ); | |
if ( isset( $web_fonts_style ) && !empty( $web_fonts_style ) ) { | |
$web_fonts_style_each_array = explode("\n", $web_fonts_style ); | |
foreach( $web_fonts_style_each_array as $web_fonts_style_each ) { | |
$result_indv = str_replace( array( $web_fonts_style_each,"\n\n"), array('',"\n"), $result_indv ); | |
$result_indv .= $web_fonts_style_each ."\n"; | |
} | |
} | |
$collections = get_post_meta( $post->ID, 'css', true ); | |
$collections .= get_post_meta( $post->ID, '_css', true ); | |
if ( !empty( $collections ) ) { | |
$result_indv .= preg_replace_callback( '![^}]+{[^}]+}!siu', 'raindrops_css_add_id', $collections ); | |
} | |
} | |
rewind_posts(); | |
} | |
} | |
$result .= '<style type="text/css">'; | |
$result .= "\n<!--/*<! [CDATA[*/\n"; | |
$result .= $css; | |
$result .= "/*start custom fields style for loop pages*/\n"; | |
if ( WP_DEBUG !== true ) { | |
$result_indv = str_replace( array( "\n", "\r", "\t", '"', '--', '\"' ), array( "", "", "", '"', '', '"' ), $result_indv ); | |
} | |
$result .= $result_indv; | |
$result .= "\n/*end custom fields style for loop pages*/"; | |
$result .= "\n/*]]>*/-->\n"; | |
$result .= "</style>\n"; | |
} | |
if ( true == $raindrops_use_transient ) { | |
set_transient( 'raindrops_embed_css_transient', $css ); | |
} | |
if ( false == $raindrops_use_transient || is_user_logged_in() ) { | |
set_transient( 'raindrops_embed_meta_transient', $result ) ; | |
} | |
echo apply_filters( 'raindrops_embed_meta_echo', $result ); | |
return $content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment