Initial commit: Atomaste website
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Register customizer panels & sections for Easy Digital Downloads.
|
||||
*
|
||||
* @package Astra
|
||||
* @link https://wpastra.com/
|
||||
* @since Astra 1.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Astra_Customizer_Register_Edd_Section' ) ) {
|
||||
|
||||
/**
|
||||
* Customizer Sanitizes Initial setup
|
||||
*/
|
||||
class Astra_Customizer_Register_Edd_Section extends Astra_Customizer_Config_Base {
|
||||
|
||||
/**
|
||||
* Register Panels and Sections for Customizer.
|
||||
*
|
||||
* @param Array $configurations Astra Customizer Configurations.
|
||||
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
|
||||
* @since 1.5.5
|
||||
* @return Array Astra Customizer Configurations with updated configurations.
|
||||
*/
|
||||
public function register_configuration( $configurations, $wp_customize ) {
|
||||
|
||||
$configs = array(
|
||||
/**
|
||||
* WooCommerce
|
||||
*/
|
||||
array(
|
||||
'name' => 'section-edd-group',
|
||||
'type' => 'section',
|
||||
'title' => __( 'Easy Digital Downloads', 'astra' ),
|
||||
'priority' => 60,
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'section-edd-general',
|
||||
'title' => __( 'General', 'astra' ),
|
||||
'type' => 'section',
|
||||
'section' => 'section-edd-group',
|
||||
'priority' => 10,
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'section-edd-archive',
|
||||
'title' => __( 'Product Archive', 'astra' ),
|
||||
'type' => 'section',
|
||||
'section' => 'section-edd-group',
|
||||
'priority' => 10,
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'section-edd-single',
|
||||
'type' => 'section',
|
||||
'title' => __( 'Single Product', 'astra' ),
|
||||
'section' => 'section-edd-group',
|
||||
'priority' => 15,
|
||||
),
|
||||
);
|
||||
|
||||
return array_merge( $configurations, $configs );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
new Astra_Customizer_Register_Edd_Section();
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Easy Digital Downloads Container Options for Astra theme.
|
||||
*
|
||||
* @package Astra
|
||||
* @link https://www.brainstormforce.com
|
||||
* @since Astra 1.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Astra_Edd_Container_Configs' ) ) {
|
||||
|
||||
/**
|
||||
* Customizer Sanitizes Initial setup
|
||||
*/
|
||||
class Astra_Edd_Container_Configs extends Astra_Customizer_Config_Base {
|
||||
|
||||
/**
|
||||
* Register Astra-Easy Digital Downloads Shop Container Settings.
|
||||
*
|
||||
* @param Array $configurations Astra Customizer Configurations.
|
||||
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
|
||||
* @since 1.5.5
|
||||
* @return Array Astra Customizer Configurations with updated configurations.
|
||||
*/
|
||||
public function register_configuration( $configurations, $wp_customize ) {
|
||||
|
||||
$_configs = array(
|
||||
|
||||
/**
|
||||
* Option: Revamped Container Layout.
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-ast-content-layout]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-radio-image',
|
||||
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ),
|
||||
'section' => 'section-edd-general',
|
||||
'default' => astra_get_option( 'edd-ast-content-layout' ),
|
||||
'priority' => 5,
|
||||
'title' => __( 'Container Layout', 'astra' ),
|
||||
'choices' => array(
|
||||
'default' => array(
|
||||
'label' => __( 'Default', 'astra' ),
|
||||
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '',
|
||||
),
|
||||
'normal-width-container' => array(
|
||||
'label' => __( 'Normal', 'astra' ),
|
||||
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'normal-width-container', false ) : '',
|
||||
),
|
||||
'full-width-container' => array(
|
||||
'label' => __( 'Full Width', 'astra' ),
|
||||
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'full-width-container', false ) : '',
|
||||
),
|
||||
),
|
||||
'divider' => array( 'ast_class' => 'ast-bottom-spacing ast-bottom-divider' ),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Content Style Option.
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-content-style]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-selector',
|
||||
'section' => 'section-edd-general',
|
||||
'default' => astra_get_option( 'edd-content-style', 'default' ),
|
||||
'description' => __( 'Container style will apply only when layout is set to either normal or narrow.', 'astra' ),
|
||||
'priority' => 5,
|
||||
'title' => __( 'Container Style', 'astra' ),
|
||||
'choices' => array(
|
||||
'default' => __( 'Default', 'astra' ),
|
||||
'unboxed' => __( 'Unboxed', 'astra' ),
|
||||
'boxed' => __( 'Boxed', 'astra' ),
|
||||
),
|
||||
'renderAs' => 'text',
|
||||
'responsive' => false,
|
||||
),
|
||||
);
|
||||
|
||||
return array_merge( $configurations, $_configs );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Astra_Edd_Container_Configs();
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Easy Digital Downloads Sidebar Options for our theme.
|
||||
*
|
||||
* @package Astra
|
||||
* @link https://www.brainstormforce.com
|
||||
* @since Astra 1.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Astra_Edd_Sidebar_Configs' ) ) {
|
||||
|
||||
/**
|
||||
* Customizer Sanitizes Initial setup
|
||||
*/
|
||||
class Astra_Edd_Sidebar_Configs extends Astra_Customizer_Config_Base {
|
||||
|
||||
/**
|
||||
* Register Astra Easy Digital Downloads Sidebar Configurations.
|
||||
*
|
||||
* @param Array $configurations Astra Customizer Configurations.
|
||||
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
|
||||
* @since 1.5.5
|
||||
* @return Array Astra Customizer Configurations with updated configurations.
|
||||
*/
|
||||
public function register_configuration( $configurations, $wp_customize ) {
|
||||
|
||||
$_configs = array(
|
||||
|
||||
/**
|
||||
* Option: General Sidebar Layout.
|
||||
*/
|
||||
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-general-sidebar-layout]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-radio-image',
|
||||
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ),
|
||||
'section' => 'section-edd-general',
|
||||
'default' => astra_get_option( 'edd-general-sidebar-layout' ),
|
||||
'priority' => 6,
|
||||
'title' => __( 'Sidebar Layout', 'astra' ),
|
||||
'choices' => array(
|
||||
'default' => array(
|
||||
'label' => __( 'Default', 'astra' ),
|
||||
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '',
|
||||
),
|
||||
'no-sidebar' => array(
|
||||
'label' => __( 'No Sidebar', 'astra' ),
|
||||
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'no-sidebar', false ) : '',
|
||||
),
|
||||
'left-sidebar' => array(
|
||||
'label' => __( 'Left Sidebar', 'astra' ),
|
||||
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'left-sidebar', false ) : '',
|
||||
),
|
||||
'right-sidebar' => array(
|
||||
'label' => __( 'Right Sidebar', 'astra' ),
|
||||
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'right-sidebar', false ) : '',
|
||||
),
|
||||
),
|
||||
'description' => __( 'Sidebar will only apply when container layout is set to normal.', 'astra' ),
|
||||
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: EDD Sidebar Style.
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-sidebar-style]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-selector',
|
||||
'section' => 'section-edd-general',
|
||||
'default' => astra_get_option( 'edd-sidebar-style', 'default' ),
|
||||
'priority' => 6,
|
||||
'title' => __( 'Sidebar Style', 'astra' ),
|
||||
'choices' => array(
|
||||
'default' => __( 'Default', 'astra' ),
|
||||
'unboxed' => __( 'Unboxed', 'astra' ),
|
||||
'boxed' => __( 'Boxed', 'astra' ),
|
||||
),
|
||||
'responsive' => false,
|
||||
'renderAs' => 'text',
|
||||
'divider' => array( 'ast_class' => 'ast-top-divider ast-top-spacing' ),
|
||||
),
|
||||
);
|
||||
|
||||
return array_merge( $configurations, $_configs );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Astra_Edd_Sidebar_Configs();
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
/**
|
||||
* Easy Digital Downloads Options for Astra Theme.
|
||||
*
|
||||
* @package Astra
|
||||
* @link https://wpastra.com/
|
||||
* @since Astra 1.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Astra_Edd_Archive_Layout_Configs' ) ) {
|
||||
|
||||
/**
|
||||
* Customizer Sanitizes Initial setup
|
||||
*/
|
||||
class Astra_Edd_Archive_Layout_Configs extends Astra_Customizer_Config_Base {
|
||||
|
||||
/**
|
||||
* Register Astra-Easy Digital Downloads Shop Layout Customizer Configurations.
|
||||
*
|
||||
* @param Array $configurations Astra Customizer Configurations.
|
||||
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
|
||||
* @since 1.5.5
|
||||
* @return Array Astra Customizer Configurations with updated configurations.
|
||||
*/
|
||||
public function register_configuration( $configurations, $wp_customize ) {
|
||||
|
||||
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||
$grid_ast_divider = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'edd' ) ) ? array() : array( 'ast_class' => 'ast-top-section-divider' );
|
||||
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||
|
||||
$_configs = array(
|
||||
|
||||
/**
|
||||
* Option: Shop Columns
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-grids]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-responsive-slider',
|
||||
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ),
|
||||
'section' => 'section-edd-archive',
|
||||
'default' => astra_get_option(
|
||||
'edd-archive-grids',
|
||||
array(
|
||||
'desktop' => 4,
|
||||
'tablet' => 3,
|
||||
'mobile' => 2,
|
||||
)
|
||||
),
|
||||
'priority' => 10,
|
||||
'title' => __( 'Archive Columns', 'astra' ),
|
||||
'input_attrs' => array(
|
||||
'step' => 1,
|
||||
'min' => 1,
|
||||
'max' => 6,
|
||||
),
|
||||
'divider' => $grid_ast_divider,
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Divider
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-product-structure-divider]',
|
||||
'section' => 'section-edd-archive',
|
||||
'title' => __( 'Product Structure', 'astra' ),
|
||||
'type' => 'control',
|
||||
'control' => 'ast-heading',
|
||||
'priority' => 30,
|
||||
'settings' => array(),
|
||||
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: EDD Archive Post Meta
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-product-structure]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-sortable',
|
||||
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ),
|
||||
'section' => 'section-edd-archive',
|
||||
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
|
||||
'default' => astra_get_option( 'edd-archive-product-structure' ),
|
||||
'priority' => 30,
|
||||
'title' => __( 'Product Structure', 'astra' ),
|
||||
'description' => __( 'The Image option cannot be sortable if the Product Style is selected to the List Style ', 'astra' ),
|
||||
'choices' => array(
|
||||
'image' => __( 'Image', 'astra' ),
|
||||
'category' => __( 'Category', 'astra' ),
|
||||
'title' => __( 'Title', 'astra' ),
|
||||
'price' => __( 'Price', 'astra' ),
|
||||
'short_desc' => __( 'Short Description', 'astra' ),
|
||||
'add_cart' => __( 'Add To Cart', 'astra' ),
|
||||
),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Divider
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-button-divider]',
|
||||
'section' => 'section-edd-archive',
|
||||
'title' => __( 'Buttons', 'astra' ),
|
||||
'type' => 'control',
|
||||
'control' => 'ast-heading',
|
||||
'priority' => 31,
|
||||
'settings' => array(),
|
||||
'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-spacing' ),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Add to Cart button text
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-add-to-cart-button-text]',
|
||||
'type' => 'control',
|
||||
'control' => 'text',
|
||||
'section' => 'section-edd-archive',
|
||||
'default' => astra_get_option( 'edd-archive-add-to-cart-button-text' ),
|
||||
'priority' => 31,
|
||||
'title' => __( 'Cart Button Text', 'astra' ),
|
||||
'context' => array(
|
||||
Astra_Builder_Helper::$general_tab_config,
|
||||
array(
|
||||
'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-product-structure]',
|
||||
'operator' => 'contains',
|
||||
'value' => 'add_cart',
|
||||
),
|
||||
),
|
||||
'divider' => array( 'ast_class' => 'ast-top-spacing ast-bottom-section-divider' ),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Variable product button
|
||||
*/
|
||||
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-variable-button]',
|
||||
'default' => astra_get_option( 'edd-archive-variable-button' ),
|
||||
'section' => 'section-edd-archive',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-selector',
|
||||
'title' => __( 'Variable Product Button', 'astra' ),
|
||||
'priority' => 31,
|
||||
'choices' => array(
|
||||
'button' => __( 'Button', 'astra' ),
|
||||
'options' => __( 'Options', 'astra' ),
|
||||
),
|
||||
'transport' => 'refresh',
|
||||
'renderAs' => 'text',
|
||||
'responsive' => false,
|
||||
'context' => array(
|
||||
Astra_Builder_Helper::$general_tab_config,
|
||||
array(
|
||||
'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-product-structure]',
|
||||
'operator' => 'contains',
|
||||
'value' => 'add_cart',
|
||||
),
|
||||
),
|
||||
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Variable product button text
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-variable-button-text]',
|
||||
'type' => 'control',
|
||||
'control' => 'text',
|
||||
'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
|
||||
'section' => 'section-edd-archive',
|
||||
'default' => astra_get_option( 'edd-archive-variable-button-text' ),
|
||||
'context' => array(
|
||||
Astra_Builder_Helper::$general_tab_config,
|
||||
array(
|
||||
'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-variable-button]',
|
||||
'operator' => '==',
|
||||
'value' => 'button',
|
||||
),
|
||||
),
|
||||
'priority' => 31,
|
||||
'title' => __( 'Variable Product Button Text', 'astra' ),
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Archive Content Width
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-width]',
|
||||
'default' => astra_get_option( 'edd-archive-width' ),
|
||||
'section' => 'section-edd-archive',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-selector',
|
||||
'title' => __( 'Archive Content Width', 'astra' ),
|
||||
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
|
||||
'priority' => 220,
|
||||
'choices' => array(
|
||||
'default' => __( 'Default', 'astra' ),
|
||||
'custom' => __( 'Custom', 'astra' ),
|
||||
),
|
||||
'transport' => 'postMessage',
|
||||
'renderAs' => 'text',
|
||||
'responsive' => false,
|
||||
),
|
||||
|
||||
/**
|
||||
* Option: Enter Width
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-archive-max-width]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-slider',
|
||||
'section' => 'section-edd-archive',
|
||||
'default' => astra_get_option( 'edd-archive-max-width' ),
|
||||
'priority' => 225,
|
||||
'context' => array(
|
||||
Astra_Builder_Helper::$general_tab_config,
|
||||
array(
|
||||
'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-width]',
|
||||
'operator' => '===',
|
||||
'value' => 'custom',
|
||||
),
|
||||
),
|
||||
|
||||
'title' => __( 'Custom Width', 'astra' ),
|
||||
'transport' => 'postMessage',
|
||||
'suffix' => 'px',
|
||||
'input_attrs' => array(
|
||||
'min' => 768,
|
||||
'step' => 1,
|
||||
'max' => 1920,
|
||||
),
|
||||
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
|
||||
),
|
||||
);
|
||||
|
||||
// Learn More link if Astra Pro is not activated.
|
||||
if ( astra_showcase_upgrade_notices() ) {
|
||||
|
||||
$_configs[] =
|
||||
|
||||
/**
|
||||
* Option: Learn More about Contant Typography
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[edd-product-archive-button-link]',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-button-link',
|
||||
'section' => 'section-edd-archive',
|
||||
'priority' => 999,
|
||||
'title' => __( 'View Astra Pro Features', 'astra' ),
|
||||
'url' => astra_get_pro_url( 'https://wpastra.com/pricing/', 'customizer', 'free-theme', 'edd' ),
|
||||
'settings' => array(),
|
||||
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$configurations = array_merge( $configurations, $_configs );
|
||||
|
||||
return $configurations;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Astra_Edd_Archive_Layout_Configs();
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Easy Digital Downloads Options for Astra Theme.
|
||||
*
|
||||
* @package Astra
|
||||
* @link https://wpastra.com/
|
||||
* @since Astra 1.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Astra_Edd_Single_Product_Layout_Configs' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Customizer Sanitizes Initial setup
|
||||
*/
|
||||
class Astra_Edd_Single_Product_Layout_Configs extends Astra_Customizer_Config_Base {
|
||||
|
||||
/**
|
||||
* Register Astra-Easy Digital Downloads Shop Cart Layout Customizer Configurations.
|
||||
*
|
||||
* @param Array $configurations Astra Customizer Configurations.
|
||||
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
|
||||
* @since 1.5.5
|
||||
* @return Array Astra Customizer Configurations with updated configurations.
|
||||
*/
|
||||
public function register_configuration( $configurations, $wp_customize ) {
|
||||
|
||||
$_configs = array(
|
||||
|
||||
/**
|
||||
* Option: Cart upsells
|
||||
*/
|
||||
array(
|
||||
'name' => ASTRA_THEME_SETTINGS . '[disable-edd-single-product-nav]',
|
||||
'section' => 'section-edd-single',
|
||||
'type' => 'control',
|
||||
'control' => 'ast-toggle-control',
|
||||
'default' => astra_get_option( 'disable-edd-single-product-nav' ),
|
||||
'title' => __( 'Disable Product Navigation', 'astra' ),
|
||||
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
|
||||
'priority' => 10,
|
||||
),
|
||||
);
|
||||
|
||||
return array_merge( $configurations, $_configs );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Astra_Edd_Single_Product_Layout_Configs();
|
||||
@@ -0,0 +1,350 @@
|
||||
<?php
|
||||
/**
|
||||
* Custom functions that used for Easy Digital Downloads compatibility.
|
||||
*
|
||||
* @package Astra
|
||||
* @link https://wpastra.com/
|
||||
* @since Astra 1.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Current Page is EDD page
|
||||
*/
|
||||
if ( ! function_exists( 'astra_is_edd_page' ) ) :
|
||||
|
||||
/**
|
||||
* Check current page is an EDD page
|
||||
*
|
||||
* @since 1.5.5
|
||||
* @return bool true | false
|
||||
*/
|
||||
function astra_is_edd_page() {
|
||||
if (
|
||||
is_singular( 'download' ) ||
|
||||
is_post_type_archive( 'download' ) ||
|
||||
is_tax( 'download_category' ) ||
|
||||
is_tax( 'download_tag' ) ||
|
||||
edd_is_checkout() ||
|
||||
edd_is_success_page() ||
|
||||
edd_is_failed_transaction_page() ||
|
||||
edd_is_purchase_history_page()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Current Page is EDD single page
|
||||
*/
|
||||
if ( ! function_exists( 'astra_is_edd_single_page' ) ) :
|
||||
|
||||
/**
|
||||
* Check current page is an EDD single page
|
||||
*
|
||||
* @since 1.5.5
|
||||
* @return bool true | false
|
||||
*/
|
||||
function astra_is_edd_single_page() {
|
||||
if (
|
||||
is_singular( 'download' ) ||
|
||||
edd_is_checkout() ||
|
||||
edd_is_success_page() ||
|
||||
edd_is_failed_transaction_page() ||
|
||||
edd_is_purchase_history_page()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Current Page is EDD archive page
|
||||
*/
|
||||
if ( ! function_exists( 'astra_is_edd_archive_page' ) ) :
|
||||
|
||||
/**
|
||||
* Check current page is an EDD archive page
|
||||
*
|
||||
* @since 1.5.5
|
||||
* @return bool true | false
|
||||
*/
|
||||
function astra_is_edd_archive_page() {
|
||||
if (
|
||||
is_post_type_archive( 'download' ) ||
|
||||
is_tax( 'download_category' ) ||
|
||||
is_tax( 'download_tag' )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
/**
|
||||
* Current Page is EDD single Product page
|
||||
*/
|
||||
if ( ! function_exists( 'astra_is_edd_single_product_page' ) ) :
|
||||
|
||||
/**
|
||||
* Check current page is an EDD single product page
|
||||
*
|
||||
* @since 1.5.5
|
||||
* @return bool true | false
|
||||
*/
|
||||
function astra_is_edd_single_product_page() {
|
||||
if ( is_singular( 'download' ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'astra_edd_archive_product_structure' ) ) {
|
||||
|
||||
/**
|
||||
* Show the product title in the product loop. By default this is an H2.
|
||||
*/
|
||||
function astra_edd_archive_product_structure() {
|
||||
$edd_structure = apply_filters( 'astra_edd_archive_product_structure', astra_get_option( 'edd-archive-product-structure' ) );
|
||||
|
||||
if ( is_array( $edd_structure ) && ! empty( $edd_structure ) ) {
|
||||
|
||||
do_action( 'astra_edd_archive_before_block_wrap' );
|
||||
echo '<div class="ast-edd-archive-block-wrap">';
|
||||
do_action( 'astra_edd_archive_block_wrap_top' );
|
||||
|
||||
foreach ( $edd_structure as $value ) {
|
||||
|
||||
switch ( $value ) {
|
||||
case 'title':
|
||||
/**
|
||||
* Add Product Title on edd page for all products.
|
||||
*/
|
||||
do_action( 'astra_edd_archive_title_before' );
|
||||
do_action( 'astra_edd_archive_title' );
|
||||
do_action( 'astra_edd_archive_title_after' );
|
||||
break;
|
||||
case 'image':
|
||||
/**
|
||||
* Add Product Title on edd page for all products.
|
||||
*/
|
||||
do_action( 'astra_edd_archive_image_before' );
|
||||
do_action( 'astra_edd_archive_image' );
|
||||
do_action( 'astra_edd_archive_image_after' );
|
||||
break;
|
||||
case 'price':
|
||||
/**
|
||||
* Add Product Price on edd page for all products.
|
||||
*/
|
||||
do_action( 'astra_edd_archive_price_before' );
|
||||
do_action( 'astra_edd_archive_price' );
|
||||
do_action( 'astra_edd_archive_price_after' );
|
||||
break;
|
||||
case 'short_desc':
|
||||
/**
|
||||
* Add Product short description on edd page for all products.
|
||||
*/
|
||||
do_action( 'astra_edd_archive_short_description_before' );
|
||||
do_action( 'astra_edd_archive_short_description' );
|
||||
do_action( 'astra_edd_archive_short_description_after' );
|
||||
break;
|
||||
case 'add_cart':
|
||||
/**
|
||||
* Add to cart on edd page for all products.
|
||||
*/
|
||||
do_action( 'astra_edd_archive_add_to_cart_before' );
|
||||
do_action( 'astra_edd_archive_add_to_cart' );
|
||||
do_action( 'astra_edd_archive_add_to_cart_after' );
|
||||
|
||||
break;
|
||||
case 'category':
|
||||
/**
|
||||
* Add and/or Remove Categories from edd archive page.
|
||||
*/
|
||||
do_action( 'astra_edd_archive_category_before' );
|
||||
do_action( 'astra_edd_archive_category' );
|
||||
do_action( 'astra_edd_archive_category_after' );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'astra_edd_archive_block_wrap_bottom' );
|
||||
echo '</div>';
|
||||
do_action( 'astra_edd_archive_after_block_wrap' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'astra_edd_archive_product_content', 'astra_edd_archive_product_structure' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of Easy Digital Downloads Terms
|
||||
*/
|
||||
if ( ! function_exists( 'astra_edd_terms_list' ) ) {
|
||||
/**
|
||||
* Show EDD product terms
|
||||
*
|
||||
* @param string $taxonomy_name Taxonomy name.
|
||||
* @return void
|
||||
*/
|
||||
function astra_edd_terms_list( $taxonomy_name ) {
|
||||
|
||||
$product_id = get_the_ID();
|
||||
|
||||
if ( ! $product_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Getting the terms related to the current products.
|
||||
$terms = get_the_terms( $product_id, $taxonomy_name );
|
||||
|
||||
if ( ! $terms || is_wp_error( $terms ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="ast-edd-download-categories">
|
||||
<?php foreach ( $terms as $term ) : ?>
|
||||
<?php
|
||||
$term_link = get_term_link( $term, $taxonomy_name );
|
||||
|
||||
// If there was an error, continue to the next term.
|
||||
if ( is_wp_error( $term_link ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<a href="
|
||||
<?php
|
||||
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||
echo esc_url( $term_link );
|
||||
?>
|
||||
" title="<?php echo esc_attr( $term->name ); ?>"> <?php echo esc_html( $term->name ); ?> </a>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'astra_edd_archive_product_title' ) ) {
|
||||
/**
|
||||
* Show EDD archive product title
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function astra_edd_archive_product_title() {
|
||||
edd_get_template_part( 'shortcode', 'content-title' );
|
||||
}
|
||||
|
||||
add_action( 'astra_edd_archive_title', 'astra_edd_archive_product_title' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'astra_edd_archive_product_image' ) ) {
|
||||
/**
|
||||
* Show EDD archive product image
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function astra_edd_archive_product_image() {
|
||||
edd_get_template_part( 'shortcode', 'content-image' );
|
||||
}
|
||||
|
||||
add_action( 'astra_edd_archive_image', 'astra_edd_archive_product_image' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'astra_edd_archive_product_price' ) ) {
|
||||
/**
|
||||
* Show EDD archive product price
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function astra_edd_archive_product_price() {
|
||||
edd_get_template_part( 'shortcode', 'content-price' );
|
||||
}
|
||||
|
||||
add_action( 'astra_edd_archive_price', 'astra_edd_archive_product_price' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'astra_edd_archive_product_short_description' ) ) {
|
||||
/**
|
||||
* Show EDD archive product description
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function astra_edd_archive_product_short_description() {
|
||||
edd_get_template_part( 'shortcode', 'content-excerpt' );
|
||||
}
|
||||
|
||||
add_action( 'astra_edd_archive_short_description', 'astra_edd_archive_product_short_description' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'astra_edd_archive_product_add_to_cart' ) ) {
|
||||
/**
|
||||
* Show EDD archive product add to cart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function astra_edd_archive_product_add_to_cart() {
|
||||
echo astra_edd_cart_button_markup(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
add_action( 'astra_edd_archive_add_to_cart', 'astra_edd_archive_product_add_to_cart' );
|
||||
}
|
||||
|
||||
|
||||
if ( ! function_exists( 'astra_edd_archive_product_category' ) ) {
|
||||
/**
|
||||
* Show EDD archive product category
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function astra_edd_archive_product_category() {
|
||||
echo astra_edd_terms_list( 'download_category' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
add_action( 'astra_edd_archive_category', 'astra_edd_archive_product_category' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* EDD archive page Cart button markup
|
||||
*
|
||||
* @return array $output Add to cart button markup
|
||||
*/
|
||||
function astra_edd_cart_button_markup() {
|
||||
$variable_button = astra_get_option( 'edd-archive-variable-button' );
|
||||
$add_to_cart_text = astra_get_i18n_option( 'edd-archive-add-to-cart-button-text', _x( '%astra%', 'EDD Product Archive: Cart Button Text', 'astra' ) );
|
||||
$variable_button_text = astra_get_i18n_option( 'edd-archive-variable-button-text', _x( '%astra%', 'EDD Product Archive: Variable Product Button Text', 'astra' ) );
|
||||
$output = edd_get_purchase_link();
|
||||
if ( edd_has_variable_prices( get_the_ID() ) && 'button' == $variable_button ) {
|
||||
$output = '<div class="ast-edd-variable-details-button-wrap">';
|
||||
$output .= '<a class="button ast-edd-variable-btn" href="' . esc_url( get_permalink() ) . '">' . esc_html( $variable_button_text ) . '</a>';
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
if ( ! empty( $add_to_cart_text ) ) {
|
||||
$output = edd_get_purchase_link(
|
||||
array(
|
||||
'price' => false,
|
||||
'text' => esc_html( $add_to_cart_text ),
|
||||
'checkout' => esc_html( $add_to_cart_text ), // To display astra customizer add to cart text.
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
Reference in New Issue
Block a user