Skip to content

Conversation

@kaeizen
Copy link
Contributor

@kaeizen kaeizen commented Dec 17, 2024

No description provided.

@kaeizen kaeizen self-assigned this Dec 17, 2024
@github-actions
Copy link

github-actions bot commented Dec 17, 2024

🤖 Pull request artifacts

file commit
pr3381-stackable-3381-merge.zip e34f829

github-actions bot added a commit that referenced this pull request Dec 17, 2024
github-actions bot added a commit that referenced this pull request Dec 17, 2024
Copy link
Contributor

@bfintal bfintal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we create a new file specifically for WC compatibility.

src/kses.php Outdated
return $content;
}

add_filter('pre_kses', 'stackable_pre_kses_woocomerce_shop', 10, 3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See whether you can check for the existence of the is_shop function prior to doing the add_filter

if ( is_singular() && ! is_preview() && ! is_attachment() ) {
$post_id = get_the_ID();
// DEV NOTE #2: Check for WooCommerce Shop Page as well
if ( ( is_singular() && ! is_preview() && ! is_attachment() ) || ( function_exists('is_shop' ) && is_shop() ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is becoming long and hard to read, can we split this to make it more readable? I feel uneasy that we're mingling WooCommerce code inside our normal behavior, let's add a filter so that we can split woocommerce compatibility into it's own file - we can add a src/compatibility/woocommerce.php and place the necessary compatibility code there.

$optimize_css = is_singular() && ! is_preview() && ! is_attachment();
$optimize_css = apply_filters( 'stackable/load_cached_css_for_post', $optimize_css );
if ( $optimize_css ) {
    // ...

src/kses.php Outdated
* In WooCommerce Shop page, <style> tags are stripped out and the CSS styles are displayed in the frontend.
* This function removes the <style> tags and CSS styles before they are stripped out.
*/
if ( ! function_exists( 'stackable_pre_kses_woocomerce_shop' ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this code from here to the new src/compatibility/woocommerce.php file suggested above?

github-actions bot added a commit that referenced this pull request Dec 18, 2024
github-actions bot added a commit that referenced this pull request Dec 18, 2024
github-actions bot added a commit that referenced this pull request Dec 18, 2024
@bfintal bfintal merged commit 7a6d8a2 into develop Jan 15, 2025
1 of 6 checks passed
@bfintal bfintal deleted the fix/woocommerce-shop-page-css-styles branch January 15, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants