Skip to content

Commit

Permalink
feat(theme-support): Added twenty twenty theme support for store page
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq1988 committed Nov 25, 2020
1 parent b4e92d3 commit c51c7e9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
13 changes: 7 additions & 6 deletions includes/ThemeSupport/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ public function __construct() {
private function include_support() {
$supported_themes = apply_filters(
'dokan_load_theme_support_files', [
'storefront' => Storefront::class,
'flatsome' => Flatsome::class,
'divi' => Divi::class,
'rehub' => Rehub::class,
'electro' => Electro::class,
'enfold' => Enfold::class,
'storefront' => Storefront::class,
'flatsome' => Flatsome::class,
'divi' => Divi::class,
'rehub' => Rehub::class,
'electro' => Electro::class,
'enfold' => Enfold::class,
'twentytwenty' => TwentyTwenty::class,
]
);

Expand Down
35 changes: 35 additions & 0 deletions includes/ThemeSupport/TwentyTwenty.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace WeDevs\Dokan\ThemeSupport;

/**
* Twenty Twenty Theme Support
*
* @since 3.1
*/
class TwentyTwenty {

/**
* The constructor
*/
function __construct() {
add_filter( 'body_class', [ $this, 'add_wc_class' ] );
}

/**
* Makes the store page full width
*
* @param array $classes
*
* @return array
*/
public function add_wc_class( $classes ) {
if ( dokan_is_store_page() ) {
if ( ! in_array( 'woocommerce', $classes ) ) {
$classes[] = 'woocommerce';
}
}

return $classes;
}
}

0 comments on commit c51c7e9

Please sign in to comment.