/**
* Set portfolio width and assign a class to the content div
*/
public function set_portfolio_single_width($classes)
{
if (is_singular('avada_portfolio')) {
if (fusion_get_option('portfolio_featured_image_width', 'width', Avada::c_pageID()) == 'half') {
$portfolio_width = 'half';
} else {
$portfolio_width = 'full';
}
if (!Avada()->settings->get('portfolio_featured_images') && $portfolio_width == 'half') {
$portfolio_width = 'full';
}
$classes[] = 'portfolio-' . $portfolio_width;
}
return $classes;
}
/**
* Return the post content, either excerpted or in full length
* @param string $page_id The id of the current page or post
* @param string $excerpt Can be either 'blog' (for main blog page), 'portfolio' (for portfolio page template) or 'yes' (for shortcodes)
* @param integer $excerpt_length Length of the excerpts
* @param boolean $strip_html Can be used by shortcodes for a custom strip html setting
*
* @return string Post content
**/
function fusion_get_post_content($page_id = '', $excerpt = 'blog', $excerpt_length = 55, $strip_html = FALSE)
{
$content_excerpted = FALSE;
// Main blog page
if ($excerpt == 'blog') {
// Check if the content should be excerpted
if (strtolower(fusion_get_theme_option('content_length')) == 'excerpt') {
$content_excerpted = TRUE;
// Get the excerpt length
$excerpt_length = fusion_get_theme_option('excerpt_length_blog');
}
// Check if HTML should be stripped from contant
if (fusion_get_theme_option('strip_html_excerpt')) {
$strip_html = TRUE;
}
// Portfolio page templates
} elseif ($excerpt == 'portfolio') {
// Check if the content should be excerpted
if (fusion_get_option('portfolio_content_length', 'portfolio_content_length', $page_id) == 'excerpt') {
$content_excerpted = TRUE;
// Determine the correct excerpt length
if (fusion_get_page_option('portfolio_excerpt', $page_id)) {
$excerpt_length = fusion_get_page_option('portfolio_excerpt', $page_id);
} else {
$excerpt_length = fusion_get_theme_option('excerpt_length_portfolio');
}
} else {
if (!$page_id && fusion_get_theme_option('portfolio_content_length') == 'Excerpt') {
$content_excerpted = TRUE;
$excerpt_length = fusion_get_theme_option('excerpt_length_portfolio');
}
}
// Check if HTML should be stripped from contant
if (fusion_get_theme_option('portfolio_strip_html_excerpt')) {
$strip_html = TRUE;
}
// Shortcodes
} elseif ($excerpt == 'yes') {
$content_excerpted = TRUE;
}
// Sermon specific additional content
if ('wpfc_sermon' == get_post_type(get_the_ID())) {
$sermon_content = '';
$sermon_content .= avada_get_sermon_content(true);
return $sermon_content;
}
// Return excerpted content
if ($content_excerpted) {
$stripped_content = fusion_get_post_content_excerpt($excerpt_length, $strip_html);
return $stripped_content;
// Return full content
} else {
ob_start();
the_content();
return ob_get_clean();
}
}
/**
* Format of the $css array:
* $css['media-query']['element']['property'] = value
*
* If no media query is required then set it to 'global'
*
* If we want to add multiple values for the same property then we have to make it an array like this:
* $css[media-query][element]['property'][] = value1
* $css[media-query][element]['property'][] = value2
*
* Multiple values defined as an array above will be parsed separately.
*/
function avada_dynamic_css_array()
{
global $wp_version;
$c_pageID = Avada::c_pageID();
$isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'], 'iPad');
$css = array();
/**
* An array of all the elements that will be targeted from the body typography settings
*/
$body_typography_elements = apply_filters('avada_body_typography_elements', avada_get_body_typography_elements());
/**
* An array of all the elements that will be targeted from the nav typography settings
*/
$nav_typography_elements = array('.side-nav li a', '.fusion-main-menu > ul > li > a');
$nav_typography_elements = avada_implode($nav_typography_elements);
/**
* An array of all the elements that will be targeter from the h1_typography settings
*/
$h1_typography_elements = apply_filters('avada_h1_typography_elements', avada_get_h1_typography_elements());
/**
* An array of all the elements that will be targeter from the h2_typography settings
*/
$h2_typography_elements = apply_filters('avada_h2_typography_elements', avada_get_h2_typography_elements());
/**
* An array of all the elements that will be targeter from the h3_typography settings
*/
$h3_typography_elements = apply_filters('avada_h3_typography_elements', avada_get_h3_typography_elements());
/**
* An array of all the elements that will be targeter from the h4_typography settings
*/
$h4_typography_elements = apply_filters('avada_h4_typography_elements', avada_get_h4_typography_elements());
/**
* An array of all the elements that will be targeter from the h5_typography settings
*/
$h5_typography_elements = apply_filters('avada_h5_typography_elements', avada_get_h5_typography_elements());
/**
* An array of all the elements that will be targeter from the h6_typography settings
*/
$h6_typography_elements = apply_filters('avada_h6_typography_elements', avada_get_h6_typography_elements());
/**
* An array of all the elements that will be targeter from the button_typography settings
*/
$button_typography_elements = apply_filters('avada_button_typography_elements', avada_get_button_typography_elements());
$footer_headings_typography_elements = array('.fusion-footer-widget-area h3', '.fusion-footer-widget-area .widget-title', '#slidingbar-area h3', '#slidingbar-area .widget-title');
$footer_headings_typography_elements = avada_implode($footer_headings_typography_elements);
// Set the correct paddings and negative margins for the "100% Width Left/Right Padding" option
$hundredplr_padding = Avada_Sanitize::size(fusion_get_option('hundredp_padding', 'hundredp_padding', $c_pageID));
$hundredplr_padding_value = Avada_Sanitize::number($hundredplr_padding);
$hundredplr_padding_unit = Avada_Sanitize::get_unit($hundredplr_padding);
$hundredplr_padding_negative_margin = '-' . $hundredplr_padding_value . $hundredplr_padding_unit;
if ($hundredplr_padding_unit == '%') {
$fullwidth_max_width = 100 - 2 * $hundredplr_padding_value;
$hundredplr_padding_negative_margin = '-' . $hundredplr_padding_value / $fullwidth_max_width * 100 . $hundredplr_padding_unit;
}
$link_color_elements = array('body a', 'body a:before', 'body a:after', '.single-navigation a[rel="prev"]:before', '.single-navigation a[rel="next"]:after', '.project-content .project-info .project-info-box a', '.fusion-content-widget-area .widget li a', '.fusion-content-widget-area .widget .recentcomments', '.fusion-content-widget-area .widget_categories li', '#main .post h2 a', '.about-author .title a', '.shop_attributes tr th', '.fusion-rollover a', '.fusion-load-more-button');
if (class_exists('bbPress')) {
$link_color_elements[] = '.bbp-forum-header a.bbp-forum-permalink';
$link_color_elements[] = '.bbp-topic-header a.bbp-topic-permalink';
$link_color_elements[] = '.bbp-reply-header a.bbp-reply-permalink';
}
if (class_exists('WooCommerce')) {
$link_color_elements[] = '.fusion-woo-featured-products-slider .price .amount';
//$link_color_elements[] = '.my_account_orders thead tr th';
//$link_color_elements[] = '.shop_table thead tr th';
//$link_color_elements[] = '.cart_totals table th';
//$link_color_elements[] = '.checkout .shop_table tfoot th';
//$link_color_elements[] = '.checkout .payment_methods label';
//$link_color_elements[] = '#final-order-details .mini-order-details th';
$link_color_elements[] = '#main .product .product_title';
$link_color_elements[] = '.shop_table.order_details tr th';
$link_color_elements[] = '.widget_layered_nav li.chosen a';
$link_color_elements[] = '.widget_layered_nav li.chosen a:before';
$link_color_elements[] = '.widget_layered_nav_filters li.chosen a';
$link_color_elements[] = '.widget_layered_nav_filters li.chosen a:before';
}
if (class_exists('Tribe__Events__Main')) {
$link_color_elements[] = '#tribe-events-content .tribe-events-sub-nav li a';
$link_color_elements[] = '.event-is-recurring';
}
$link_color_elements = avada_implode($link_color_elements);
// Is the site width a percent value?
$site_width_percent = false !== strpos(Avada()->settings->get('site_width'), '%') ? true : false;
$theme_info = wp_get_theme();
if ($theme_info->parent_theme) {
$template_dir = basename(get_template_directory());
$theme_info = wp_get_theme($template_dir);
}
$css['global']['.' . $theme_info->get('Name') . "_" . str_replace('.', '', $theme_info->get('Version'))]['color'] = 'green';
//.........这里部分代码省略.........
/**
* Returns the excerpt length for portfolio posts.
*
* @since 4.0.0
*
* @param string $page_id The id of the current page or post
*
* @return string/boolean The excerpt length for the post; false if full content should be shown
**/
function avada_get_portfolio_excerpt_length($page_id = '')
{
$excerpt_length = false;
if (fusion_get_option('portfolio_content_length', 'portfolio_content_length', $page_id) == 'excerpt') {
// Determine the correct excerpt length
if (fusion_get_page_option('portfolio_excerpt', $page_id)) {
$excerpt_length = fusion_get_page_option('portfolio_excerpt', $page_id);
} else {
$excerpt_length = Avada()->settings->get('excerpt_length_portfolio');
}
} else {
if (!$page_id && Avada()->settings->get('portfolio_content_length') == 'Excerpt') {
$excerpt_length = Avada()->settings->get('excerpt_length_portfolio');
}
}
return $excerpt_length;
}
/**
* Return the post content, either excerpted or in full length
* @param string $page_id The id of the current page or post
* @param string $excerpt Can be either 'blog' (for main blog page), 'portfolio' (for portfolio page template) or 'yes' (for shortcodes)
* @param integer $excerpt_length Length of the excerpts
* @param boolean $strip_html Can be used by shortcodes for a custom strip html setting
*
* @return string Post content
**/
function fusion_get_post_content($page_id = '', $excerpt = 'blog', $excerpt_length = 55, $strip_html = FALSE)
{
global $smof_data;
$content_excerpted = FALSE;
// Main blog page
if ($excerpt == 'blog') {
// Check if the content should be excerpted
if (strtolower(fusion_get_theme_option('content_length')) == 'excerpt') {
$content_excerpted = TRUE;
// Get the excerpt length
$excerpt_length = fusion_get_theme_option('excerpt_length_blog');
}
// Check if HTML should be stripped from contant
if (fusion_get_theme_option('strip_html_excerpt')) {
$strip_html = TRUE;
}
// Portfolio page templates
} elseif ($excerpt == 'portfolio') {
// Check if the content should be excerpted
if (fusion_get_option('portfolio_content_length', 'portfolio_content_length', $page_id) == 'excerpt') {
$content_excerpted = TRUE;
// Determine the correct excerpt length
if (fusion_get_page_option('portfolio_excerpt', $page_id)) {
$excerpt_length = fusion_get_page_option('portfolio_excerpt', $page_id);
} else {
$excerpt_length = fusion_get_theme_option('excerpt_length_portfolio');
}
}
// Check if HTML should be stripped from contant
if (fusion_get_theme_option('portfolio_strip_html_excerpt')) {
$strip_html = TRUE;
}
// Shortcodes
} elseif ($excerpt == 'yes') {
$content_excerpted = TRUE;
}
// Return excerpted content
if ($content_excerpted) {
$stripped_content = fusion_get_post_content_excerpt($excerpt_length, $strip_html);
return $stripped_content;
// Return full content
} else {
ob_start();
the_content();
return ob_get_clean();
}
}
请发表评论