';
?>
%2$s';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '
%4$s ';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
printf( __( '
%3$s ', 'spacious' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
$time_string
);
if ( has_category() ) { ?>
', '' );
if ( ( ( spacious_options( 'spacious_archive_display_type', 'blog_large' ) != 'blog_full_content' ) && ! is_single() ) || is_archive() || is_search() ) {
if ( $spacious_show_readmore ) { ?>
';
echo '';
endif;
}
endif;
/**************************************************************************************/
/**
* Making the theme Woocommrece compatible
*/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
add_filter( 'woocommerce_show_page_title', '__return_false' );
add_action( 'woocommerce_before_main_content', 'spacious_wrapper_start', 10 );
add_action( 'woocommerce_after_main_content', 'spacious_wrapper_end', 10 );
function spacious_wrapper_start() {
echo '
';
}
function spacious_wrapper_end() {
echo '
';
}
function spacious_woocommerce_support() {
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
add_action( 'after_setup_theme', 'spacious_woocommerce_support' );
if ( class_exists( 'woocommerce' ) && ! function_exists( 'spacious_is_in_woocommerce_page' ) ):
/*
* woocommerce - conditional to check if woocommerce related page showed
*/
function spacious_is_in_woocommerce_page() {
return ( is_shop() || is_product_category() || is_product_tag() || is_product() || is_cart() || is_checkout() || is_account_page() ) ? true : false;
}
endif;
// Displays the site logo
if ( ! function_exists( 'spacious_the_custom_logo' ) ) {
/**
* Displays the optional custom logo.
*/
function spacious_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
}
/**
* Transfer header designs options to header display type.
*/
function spacious_site_header_migrate() {
if ( get_option( 'spacious_site_header_migrate' ) ) {
return;
}
$spacious_header_design = spacious_options( 'spacious_header_design', 'style_one' );
// Get theme options.
$theme_options = get_option( 'spacious' );
if ( 'style_two' === $spacious_header_design ) {
// Set header display type to 4
$theme_options['spacious_header_display_type'] = 'four';
}
// Remove header designs from database.
unset( $theme_options['spacious_header_design'] );
// Finally, update spacious theme options.
update_option( 'spacious', $theme_options );
update_option( 'spacious_site_header_migrate', 1 );
}
add_action( 'after_setup_theme', 'spacious_site_header_migrate' );
/**
* Remove footer designs options
*/
function spacious_site_footer_designs_eliminate() {
if ( get_option( 'spacious_site_footer_eliminate' ) ) {
return;
}
$spacious_footer_design = spacious_options( 'spacious_footer_design', 'style_one' );
if ( $spacious_footer_design ) {
// Get theme options.
$theme_options = get_option( 'spacious' );
// Remove footer designs data from db.
unset( $theme_options['spacious_footer_design'] );
// Finally, update spacious theme options.
update_option( 'spacious', $theme_options );
// Set a flag.
update_option( 'spacious_site_footer_eliminate', 1 );
}
}
add_action( 'after_setup_theme', 'spacious_site_footer_designs_eliminate' );
if ( ! function_exists( 'spacious_pingback_header' ) ) :
/**
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
*/
function spacious_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '
', esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
endif;
add_action( 'wp_head', 'spacious_pingback_header' );
/**
* Migrate script to migrate `spacious[spacious_header_display_type]` to
* `themefolder[spacious_header_display_type]`.
*
* @since 1.5.9
*/
function spacious_header_display_type_migrate() {
$spacious_options = get_option( 'spacious' );
// Return if `spacious` options is not found.
if ( ! $spacious_options ) {
return;
}
// Return if `spacious_header_display_type_migrate` options is set.
if ( get_option( 'spacious_header_display_type_migrate' ) ) {
return;
}
/**
* Assigning the theme name.
*/
$spacious_themename = get_option( 'stylesheet' );
$spacious_themename = preg_replace( "/\W/", "_", strtolower( $spacious_themename ) );
// Store the old value.
$spacious_header_display_type = $spacious_options['spacious_header_display_type'];
// Ready to update the value for saving in `themefolder[spacious_header_display_type]` table.
$spacious_options_table = get_option( $spacious_themename );
$spacious_options_table['spacious_header_display_type'] = $spacious_header_display_type;
// Migrate the final array to $spacious_themename table.
if ( $spacious_header_display_type ) {
update_option( $spacious_themename, $spacious_options_table );
}
// Finally, set the flag to stop executing the script on each load of page.
update_option( 'spacious_header_display_type_migrate', 'yes' );
}
add_action( 'after_setup_theme', 'spacious_header_display_type_migrate' );
function spacious_header_menu_button( $items, $args ) {
$button_text = spacious_options( 'spacious_header_button_one_setting' );
$button_link = spacious_options( 'spacious_header_button_one_link' );
$button_target = spacious_options( 'spacious_header_button_one_tab' );
$button_target = $button_target ? ' target="_blank"' : '';
if ( 'primary' === $args->theme_location && $button_link ) {
$items .= '';
}
return $items;
}
add_filter( 'wp_nav_menu_items', 'spacious_header_menu_button', 10, 2 );
if ( ! function_exists( 'spacious_shift_extra_menu' ) ) :
/**
* Keep menu items on one line.
*
* @param string $items The HTML list content for the menu items.
* @param stdClass $args An object containing wp_nav_menu() arguments.
*
* @return string HTML for more button.
*/
function spacious_shift_extra_menu( $items, $args ) {
if ( 'primary' === $args->theme_location && spacious_options( 'spacious_one_line_menu_setting', 0 ) ) :
$items .= '';
endif;
return $items;
}
endif;
add_filter( 'wp_nav_menu_items', 'spacious_shift_extra_menu', 12, 2 );
/**
* Update image attributes for retina logo.
*
* @see spacious_change_logo_attr()
*/
if ( ! function_exists( 'spacious_change_logo_attr' ) ) :
function spacious_change_logo_attr( $attr, $attachment, $size ) {
$custom_logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
$custom_logo = isset( $custom_logo[0] ) ? $custom_logo[0] : '';
if ( isset( $attr['class'] ) && 'custom-logo' === $attr['class'] ) {
if ( 1 == spacious_options( 'spacious_different_retina_logo', 0 ) ) {
$retina_logo = spacious_options( 'spacious_retina_logo_upload' );
if ( $retina_logo ) {
$attr['srcset'] = $custom_logo . ' 1x, ' . $retina_logo . ' 2x';
}
}
}
return $attr;
}
endif;
add_filter( 'wp_get_attachment_image_attributes', 'spacious_change_logo_attr', 10, 3 );
/**
* Compare user's current version of plugin.
*/
if ( ! function_exists( 'spacious_plugin_version_compare' ) ) {
function spacious_plugin_version_compare( $plugin_slug, $version_to_compare ) {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$installed_plugins = get_plugins();
// Plugin not installed.
if ( ! isset( $installed_plugins[ $plugin_slug ] ) ) {
return false;
}
$tdi_user_version = $installed_plugins[ $plugin_slug ]['Version'];
return version_compare( $tdi_user_version, $version_to_compare, '<' );
}
}