Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,32 @@ function flash_block_editor_styles() {
* @global int $content_width
**/
function flash_content_width() {
$content_width = 780;
$GLOBALS['content_width'] = apply_filters( 'flash_content_width', 780 );
}

$classes = flash_get_layout();
if ( $classes == 'full-width' ) {
$content_width = 1200;
}
// Sets the theme's own default early, so wp-admin (image size caps, the block
// editor) and REST API requests -- which never reach template_redirect -- still
// get a value.
add_action( 'after_setup_theme', 'flash_content_width', 0 );
endif;

$GLOBALS['content_width'] = apply_filters( 'flash_content_width', $content_width );
if ( ! function_exists( 'flash_content_width_for_layout' ) ) :
/**
* Widen content_width for a full-width page's actual frontend render.
*
* Run on template_redirect, not after_setup_theme: flash_get_layout() relies
* on is_page()/is_single()/$post, which aren't reliable until the main query
* has been parsed.
*
* @global int $content_width
**/
function flash_content_width_for_layout() {
if ( 'full-width' == flash_get_layout() ) {
$GLOBALS['content_width'] = apply_filters( 'flash_content_width', 1200 );
}
}

add_action( 'after_setup_theme', 'flash_content_width', 0 );
add_action( 'template_redirect', 'flash_content_width_for_layout' );
endif;

/**
Expand Down
22 changes: 0 additions & 22 deletions inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,25 +646,3 @@ function flash_change_logo_attr( $attr, $attachment, $size ) {
endif;

add_filter( 'wp_get_attachment_image_attributes', 'flash_change_logo_attr', 10, 3 );

/**
* Compare user's current version of plugin.
*/
if ( ! function_exists( 'flash_plugin_version_compare' ) ) {
function flash_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, '<' );
}
}
6 changes: 4 additions & 2 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function flash_categorized_blog() {
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );

set_transient( 'flash_categories', $all_the_cool_cats );
set_transient( 'flash_categories', $all_the_cool_cats, DAY_IN_SECONDS );
}

if ( $all_the_cool_cats > 1 ) {
Expand All @@ -124,4 +124,6 @@ function flash_category_transient_flusher() {
delete_transient( 'flash_categories' );
}
add_action( 'edit_category', 'flash_category_transient_flusher' );
add_action( 'save_post', 'flash_category_transient_flusher' );
add_action( 'save_post', 'flash_category_transient_flusher' );
add_action( 'create_category', 'flash_category_transient_flusher' );
add_action( 'delete_category', 'flash_category_transient_flusher' );
13 changes: 0 additions & 13 deletions inc/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,3 @@ function flash_woocommerce_header_add_to_cart_fragment( $fragments ) {
$fragments['div.flash-cart-views'] = ob_get_clean();
return $fragments;
}

/**
* Check if the current viewed page is of WooCommerce
*
* @return void
*/
function flash_is_woocommerce_pages() {
if ( is_shop() || is_product() || is_product_category() || is_product_tag() ) {
return true;
}

return false;
}
Loading