Plugin Directory

Changeset 1950988


Ignore:
Timestamp:
10/03/2018 05:07:54 PM (8 years ago)
Author:
dangub86
Message:

Release 1.2, see readme.txt for the changelog.

Location:
i-divi-post-settings
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • i-divi-post-settings/tags/1.2/README.txt

    r1837140 r1950988  
    55Requires at least: 4.0
    66Tested up to: 4.9
    7 Stable tag: 1.1
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3838The plugin accomplish a very simple task, giving you the possibility to set default post settings (those ones that you find in the Divi Post Settings meta box inside every post). This plugin, so, will simply let you to save time without have to set the values everytime you create a new post, page or project!
    3939
     40= Does the plugin add different settings for each post-type? =
     41Yes, it does. Once activated, the plugin adds settings for each post-type: Posts, Pages, Products (working only if WooCommerce is active) and Projects. You will find new settings in the Customizer under the Blog panel.
     42
     43= Once Customizer settings have been set up, can i change Divi Settings manually from inside the post? =
     44Yes, of course. You can always change manually the Divi Settings from inside posts/pages/products/projects; however when hit 'Add New' button the settings you chose in the Customizer will be applied as the default ones. You can also choose to remember the last settings you used in a post/page/product/project for the next ones you will create by flagging the relative checkbox in the Customizer.
     45
    4046== Screenshots ==
    4147
     
    4652
    4753== Changelog ==
     54
     55= 1.2 =
     56
     57* Added support for WooCommerce products.
     58* Updated Fullwidth mode only for default post types (Posts).
     59* Added Customizer settings for WooCoommerce products.
    4860
    4961= 1.1 =
     
    7082== Upgrade Notice ==
    7183
     84= 1.2 =
     85
     86* Added Divi Settings for WooCommerce products.
     87
    7288= 1.1 =
    7389
  • i-divi-post-settings/tags/1.2/admin/class-divi-post-settings-admin.php

    r1836529 r1950988  
    100100    'choices'    => array(
    101101              'Right' => 'Right Sidebar',
    102               'Left' => 'Left Sidebar',
     102              'Left' => 'Left Sidebar',
     103              'No' => 'No Sidebar',
    103104              'Full' => 'Fullwidth',
    104105          ),
     
    173174                         'Right' => 'Right Sidebar',
    174175                         'Left' => 'Left Sidebar',
    175                          'Full' => 'Fullwidth',
     176                         'No' => 'No Sidebar',
    176177                 ),
    177178      'priority' => 5,
     
    211212      'settings' => 'idivi_page_settings_before_scroll'
    212213     ));
     214
     215
     216// DIVI PRODUCT SETTINGS
     217$wp_customize->add_section('idivi_product_settings_section', array(
     218    'title' => __('Divi Product Settings', $this->plugin_name),
     219    'panel' => 'et_divi_blog_settings',
     220     ));
     221    $wp_customize->add_setting('idivi_product_settings_sidebar', array(
     222     'default' => 'Right',
     223     'type' => 'option',
     224     'capability' => 'edit_theme_options',
     225    ));
     226    $wp_customize->add_control('idivi_product_settings_layout', array(
     227     'label' => __('Page Layout', $this->plugin_name),
     228     'section' => 'idivi_product_settings_section',
     229     'type' => 'select',
     230     'choices'    => array(
     231                         'Right' => 'Right Sidebar',
     232                         'Left' => 'Left Sidebar',
     233                         'No' => 'No Sidebar',
     234                 ),
     235     'priority' => 5,
     236     'settings' => 'idivi_product_settings_sidebar'
     237    ));
     238    $wp_customize->add_setting('idivi_product_settings_dot', array(
     239     'default' => 'Off',
     240     'type' => 'option',
     241     'capability' => 'edit_theme_options',
     242    ));
     243    $wp_customize->add_control('idivi_product_settings_dot_nav', array(
     244     'label' => __('Dot Navigation', $this->plugin_name),
     245     'section' => 'idivi_product_settings_section',
     246     'type' => 'select',
     247     'choices'    => array(
     248                         'Off' => 'Off',
     249                         'On' => 'On',
     250                 ),
     251     'priority' => 5,
     252     'settings' => 'idivi_product_settings_dot'
     253    ));
     254    $wp_customize->add_setting('idivi_product_settings_before_scroll', array(
     255     'default' => 'Default',
     256     'type' => 'option',
     257     'capability' => 'edit_theme_options',
     258    ));
     259    $wp_customize->add_control('idivi_product_settings_hide_before_scroll', array(
     260     'label' => __('Hide Nav Before Scroll', $this->plugin_name),
     261     'section' => 'idivi_product_settings_section',
     262     'type' => 'select',
     263     'choices'    => array(
     264                         'Default' => 'Default',
     265                         'Off' => 'Off',
     266                         'On'  => 'On',
     267                 ),
     268     'priority' => 5,
     269     'settings' => 'idivi_product_settings_before_scroll'
     270    ));
    213271
    214272
     
    230288                         'Right' => 'Right Sidebar',
    231289                         'Left' => 'Left Sidebar',
    232                          'Full' => 'Fullwidth',
     290                         'No' => 'No Sidebar',
    233291                 ),
    234292      'priority' => 5,
     
    311369        'priority' => 10,
    312370        'settings' => 'idivi_page_settings_last_used'
    313      ));
     371      ));
     372     
     373      $wp_customize->add_setting('idivi_product_settings_last_used', array(
     374        'default' => false,
     375        'type' => 'option',
     376        'capability' => 'edit_theme_options',
     377     ));
     378     $wp_customize->add_control('idivi_product_settings_last_used_options', array(
     379        'label' => __('Remember Last Used Options', $this->plugin_name),
     380        'section' => 'idivi_product_settings_section',
     381        'type' => 'checkbox',
     382        'priority' => 10,
     383        'settings' => 'idivi_product_settings_last_used'
     384     ));
    314385
    315386     $wp_customize->add_setting('idivi_project_settings_last_used', array(
     
    345416
    346417    /**
    347      * Create function that retrieves last post id
     418     * Create function that retrieves last page id
    348419     * @since 1.1
    349420     */
     
    363434
    364435    /**
    365      * Create function that retrieves last post id
     436     * Create function that retrieves last project id
    366437     * @since 1.1
    367438     */
     
    380451  }
    381452
     453    /**
     454     * Create function that retrieves last product id
     455     * @since 1.1
     456     */
     457    public function get_last_product_id() {
     458        $latest_product_args = array(
     459         'numberposts' => 1,
     460         'orderby' => 'post_date',
     461             'post_type' => 'product',
     462         'order' => 'DESC'
     463        );
     464        $latest_product = wp_get_recent_posts( $latest_product_args );
     465        foreach ($latest_product as $product) {
     466         $latest_product_id = $latest_product[0]["ID"];
     467             return $latest_product_id;
     468        }
     469       }
     470
    382471
    383472}
  • i-divi-post-settings/tags/1.2/admin/css/admin.css

    r1836529 r1950988  
    33*/
    44#customize-control-idivi_post_settings_last_used_options,
    5 #customize-control-idivi_page_settings_last_used_options, #customize-control-idivi_project_settings_last_used_options  {
     5#customize-control-idivi_page_settings_last_used_options, #customize-control-idivi_project_settings_last_used_options, #customize-control-idivi_product_settings_last_used_options  {
    66margin-top: 10% !important;
    77}
  • i-divi-post-settings/tags/1.2/i_divi_post_settings.php

    r1836529 r1950988  
    55 * Description: The plugin add some fields in Divi Theme Customizer from which you can set your favorite default post, page and project settings.
    66 * Author:      Dan Mardis - Howidivit.com
    7  * Version:     1.1
     7 * Version:     1.2
    88 * Author URI:  http://www.howidivit.com
    99 */
     
    6565   $page_layout_opt = get_option( 'idivi_page_settings_sidebar' );
    6666   $project_layout_opt = get_option( 'idivi_project_settings_sidebar' );
     67   $product_layout_opt = get_option( 'idivi_product_settings_sidebar' );
    6768
    6869   $dot_nav_opt = get_option( 'idivi_post_settings_dot' );
    6970   $dot_page_nav_opt = get_option( 'idivi_page_settings_dot' );
    7071   $dot_project_nav_opt = get_option( 'idivi_project_settings_dot' );
     72   $dot_product_nav_opt = get_option( 'idivi_product_settings_dot' );
    7173
    7274   $before_scroll_opt = get_option( 'idivi_post_settings_before_scroll' );
    7375   $before_page_scroll_opt = get_option( 'idivi_page_settings_before_scroll' );
    7476   $before_project_scroll_opt = get_option( 'idivi_project_settings_before_scroll' );
     77   $before_product_scroll_opt = get_option( 'idivi_product_settings_before_scroll' );
    7578
    7679   $title_opt = get_option( 'idivi_post_settings_post_title' );
     
    8083   $last_page_used = get_option('idivi_page_settings_last_used');
    8184   $last_project_used = get_option('idivi_project_settings_last_used');
     85   $last_product_used = get_option('idivi_product_settings_last_used');
    8286
    8387   // call admin class function for getting last post id
     
    8690   $last_page_id = $last_post_used->get_last_page_id();
    8791   $last_project_id = $last_post_used->get_last_project_id();
     92   $last_product_id = $last_post_used->get_last_product_id();
    8893
    8994   // retrieve last post values
     
    102107
    103108   $last_project_nav = get_post_meta( $last_project_id, '_et_pb_project_nav', true );
     109
     110   $last_product_layout = get_post_meta( $last_product_id, '_et_pb_page_layout', true );
     111   $last_product_side_nav = get_post_meta( $last_product_id, '_et_pb_side_nav', true );
     112   $last_product_hide_nav = get_post_meta( $last_product_id, '_et_pb_post_hide_nav', true );
    104113
    105114   wp_nonce_field( basename( __FILE__ ), 'et_settings_nonce' );
     
    111120   $post_hide_nav = $post_hide_nav && 'off' === $post_hide_nav ? 'default' : $post_hide_nav;
    112121   $show_title = get_post_meta( $post_id, '_et_pb_show_title', true );
     122
     123   $is_builder_active = 'on' === get_post_meta( $post_id, '_et_pb_use_builder', true );
    113124
    114125if ( 'post' === $post->post_type ) {
     
    122133      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    123134      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     135      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    124136      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    125137      );
     
    128140      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    129141      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     142      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    130143      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    131144      );
     
    139152      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    140153      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     154      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    141155      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    142156      );
     
    145159      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    146160      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     161      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    147162      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    148163      );
    149164    }
    150    } else {
     165   } else if (
     166    ( $post_layout_opt === 'Full' && (!isset($last_used) || empty($last_used)) ) ||
     167    ( ( isset($last_used) && ($last_used == 1) ) && $last_post_layout === 'et_full_width_page')
     168    ) {
     169     if ( is_rtl() ) {
     170      $page_layouts = array(
     171       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     172       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     173       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     174       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     175       );
     176     } else {
     177      $page_layouts = array(
     178       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     179       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     180       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     181       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     182       );
     183     }
     184    } else {
    151185    if ( is_rtl() ) {
    152186     $page_layouts = array(
    153       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     187      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    154188      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    155189      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     190      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    156191      );
    157192    } else {
    158193     $page_layouts = array(
    159       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     194      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    160195      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    161196      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     197      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    162198      );
    163199    }
    164200   }
    165  } else if ( 'page' === $post->post_type ) {
     201 } else if ( 'page' === $post->post_type ) { 
    166202    if (
    167203        ( !$page_layout_opt && (!isset($last_page_used) || empty($last_page_used) ) ) ||
     
    173209       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    174210       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    175        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     211       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    176212       );
    177213     } else {
     
    179215       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    180216       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    181        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     217       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    182218       );
    183219     }
     
    190226       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    191227       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    192        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     228       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    193229       );
    194230     } else {
     
    196232       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    197233       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    198        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     234       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    199235       );
    200236     }
     
    202238     if ( is_rtl() ) {
    203239      $page_layouts = array(
    204        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     240       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    205241       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    206242       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     
    208244     } else {
    209245      $page_layouts = array(
    210        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     246       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    211247       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    212248       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     
    224260        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    225261        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    226         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     262        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    227263        );
    228264      } else {
     
    230266        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    231267        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    232         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     268        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    233269        );
    234270      }
     
    241277        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    242278        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    243         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     279        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    244280        );
    245281      } else {
     
    247283        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    248284        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    249         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     285        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    250286        );
    251287      }
     
    253289      if ( is_rtl() ) {
    254290       $page_layouts = array(
    255         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     291        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    256292        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    257293        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     
    259295      } else {
    260296       $page_layouts = array(
    261         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     297        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    262298        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    263299        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     
    265301      }
    266302     }
    267    }
     303   } else if ( 'product' === $post->post_type ) {
     304    if (
     305        ( !$product_layout_opt && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     306        ( $product_layout_opt === 'Right' && (!isset($last_product_used) || empty($last_product_used)) ) ||
     307      ( ( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_layout === 'et_right_sidebar')
     308    ) {
     309     if ( is_rtl() ) {
     310      $page_layouts = array(
     311       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     312       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     313       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     314       );
     315     } else {
     316      $page_layouts = array(
     317       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     318       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     319       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     320       );
     321     }
     322    } else if (
     323    ( $product_layout_opt === 'Left' && (!isset($last_product_used) || empty($last_product_used)) ) ||
     324    ( ( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_layout === 'et_left_sidebar')
     325    ) {
     326     if ( is_rtl() ) {
     327      $page_layouts = array(
     328       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     329       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     330       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     331       );
     332     } else {
     333      $page_layouts = array(
     334       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     335       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     336       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     337       );
     338     }
     339    } else {
     340     if ( is_rtl() ) {
     341      $page_layouts = array(
     342       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     343       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     344       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     345       );
     346     } else {
     347      $page_layouts = array(
     348       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     349       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     350       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     351       );
     352     }
     353    }
     354  }
     355
     356    // Fullwidth option available for default post types only. Not available for custom post types.
     357    if ( ! et_builder_is_post_type_custom( $post->post_type ) ) {
     358        $page_layouts['et_full_width_page'] = esc_html__( 'Fullwidth', 'Divi' );
     359    }
     360
     361    if ( 'et_full_width_page' === $page_layout && ( ! isset( $page_layouts['et_full_width_page'] ) || ! $is_builder_active ) ) {
     362        $page_layout = 'et_no_sidebar';
     363  }
     364 
    268365   $layouts = array(
    269366    'light' => esc_html__( 'Light', 'Divi' ),
     
    286383    <?php
    287384    foreach ( $page_layouts as $layout_value => $layout_name ) {
    288     printf( '<option value="%2$s"%3$s>%1$s</option>',
     385    printf( '<option value="%2$s"%3$s%4$s>%1$s</option>',
    289386    esc_html( $layout_name ),
    290387    esc_attr( $layout_value ),
    291     selected( $layout_value, $page_layout, false )
     388    selected( $layout_value, $page_layout, false ),
     389    'et_full_width_page' === $layout_value && ! $is_builder_active ? ' style="display: none;"' : ''
    292390     );
    293391    } ?>
     
    346444 </select>
    347445<?php }
    348  } ?>
     446 } else if ( 'product' === $post->post_type ) {
     447  if (
     448 ( !$dot_product_nav_opt && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     449 ( $dot_product_nav_opt === 'Off' && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     450 (( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_side_nav === 'off')
     451) { ?>
     452<select id="et_pb_side_nav" name="et_pb_side_nav">
     453<option value="off" <?php selected( 'off', $side_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     454<option value="on" <?php selected( 'on', $side_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     455</select>
     456<?php } else { ?>
     457<select id="et_pb_side_nav" name="et_pb_side_nav">
     458<option value="on" <?php selected( 'on', $side_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     459<option value="off" <?php selected( 'off', $side_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     460</select>
     461<?php }
     462} ?>
    349463
    350464    </p>
     
    434548<?php
    435549   }
    436  }
     550 } else if ( 'product' === $post->post_type ) {
     551  if (
     552     ( !$before_product_scroll_opt && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     553     ( $before_product_scroll_opt === 'Default' && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     554     (( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_hide_nav === 'default')
     555  ) { ?>
     556   <select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
     557   <option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
     558   <option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     559   <option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     560   </select>
     561   <?php } else if (
     562     ( $before_product_scroll_opt === 'Off' && (!isset($last_product_used) || empty($last_product_used)) ) ||
     563     ( ( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_hide_nav === 'no')
     564   ) { ?>
     565    <select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
     566    <option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     567    <option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
     568    <option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     569    </select>
     570   <?php } else { ?>
     571    <select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
     572    <option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     573    <option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
     574    <option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     575    </select>
     576<?php
     577}
     578}
    437579      ?>
    438580    </p>
  • i-divi-post-settings/tags/1.2/includes/class-divi-post-settings.php

    r1836529 r1950988  
    2222
    2323        $this->plugin_name = 'i-divi_post_settings';
    24         $this->version = '1.1';
     24        $this->version = '1.2';
    2525
    2626        $this->load_dependencies();
  • i-divi-post-settings/trunk/README.txt

    r1837140 r1950988  
    55Requires at least: 4.0
    66Tested up to: 4.9
    7 Stable tag: 1.1
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3838The plugin accomplish a very simple task, giving you the possibility to set default post settings (those ones that you find in the Divi Post Settings meta box inside every post). This plugin, so, will simply let you to save time without have to set the values everytime you create a new post, page or project!
    3939
     40= Does the plugin add different settings for each post-type? =
     41Yes, it does. Once activated, the plugin adds settings for each post-type: Posts, Pages, Products (working only if WooCommerce is active) and Projects. You will find new settings in the Customizer under the Blog panel.
     42
     43= Once Customizer settings have been set up, can i change Divi Settings manually from inside the post? =
     44Yes, of course. You can always change manually the Divi Settings from inside posts/pages/products/projects; however when hit 'Add New' button the settings you chose in the Customizer will be applied as the default ones. You can also choose to remember the last settings you used in a post/page/product/project for the next ones you will create by flagging the relative checkbox in the Customizer.
     45
    4046== Screenshots ==
    4147
     
    4652
    4753== Changelog ==
     54
     55= 1.2 =
     56
     57* Added support for WooCommerce products.
     58* Updated Fullwidth mode only for default post types (Posts).
     59* Added Customizer settings for WooCoommerce products.
    4860
    4961= 1.1 =
     
    7082== Upgrade Notice ==
    7183
     84= 1.2 =
     85
     86* Added Divi Settings for WooCommerce products.
     87
    7288= 1.1 =
    7389
  • i-divi-post-settings/trunk/admin/class-divi-post-settings-admin.php

    r1836529 r1950988  
    100100    'choices'    => array(
    101101              'Right' => 'Right Sidebar',
    102               'Left' => 'Left Sidebar',
     102              'Left' => 'Left Sidebar',
     103              'No' => 'No Sidebar',
    103104              'Full' => 'Fullwidth',
    104105          ),
     
    173174                         'Right' => 'Right Sidebar',
    174175                         'Left' => 'Left Sidebar',
    175                          'Full' => 'Fullwidth',
     176                         'No' => 'No Sidebar',
    176177                 ),
    177178      'priority' => 5,
     
    211212      'settings' => 'idivi_page_settings_before_scroll'
    212213     ));
     214
     215
     216// DIVI PRODUCT SETTINGS
     217$wp_customize->add_section('idivi_product_settings_section', array(
     218    'title' => __('Divi Product Settings', $this->plugin_name),
     219    'panel' => 'et_divi_blog_settings',
     220     ));
     221    $wp_customize->add_setting('idivi_product_settings_sidebar', array(
     222     'default' => 'Right',
     223     'type' => 'option',
     224     'capability' => 'edit_theme_options',
     225    ));
     226    $wp_customize->add_control('idivi_product_settings_layout', array(
     227     'label' => __('Page Layout', $this->plugin_name),
     228     'section' => 'idivi_product_settings_section',
     229     'type' => 'select',
     230     'choices'    => array(
     231                         'Right' => 'Right Sidebar',
     232                         'Left' => 'Left Sidebar',
     233                         'No' => 'No Sidebar',
     234                 ),
     235     'priority' => 5,
     236     'settings' => 'idivi_product_settings_sidebar'
     237    ));
     238    $wp_customize->add_setting('idivi_product_settings_dot', array(
     239     'default' => 'Off',
     240     'type' => 'option',
     241     'capability' => 'edit_theme_options',
     242    ));
     243    $wp_customize->add_control('idivi_product_settings_dot_nav', array(
     244     'label' => __('Dot Navigation', $this->plugin_name),
     245     'section' => 'idivi_product_settings_section',
     246     'type' => 'select',
     247     'choices'    => array(
     248                         'Off' => 'Off',
     249                         'On' => 'On',
     250                 ),
     251     'priority' => 5,
     252     'settings' => 'idivi_product_settings_dot'
     253    ));
     254    $wp_customize->add_setting('idivi_product_settings_before_scroll', array(
     255     'default' => 'Default',
     256     'type' => 'option',
     257     'capability' => 'edit_theme_options',
     258    ));
     259    $wp_customize->add_control('idivi_product_settings_hide_before_scroll', array(
     260     'label' => __('Hide Nav Before Scroll', $this->plugin_name),
     261     'section' => 'idivi_product_settings_section',
     262     'type' => 'select',
     263     'choices'    => array(
     264                         'Default' => 'Default',
     265                         'Off' => 'Off',
     266                         'On'  => 'On',
     267                 ),
     268     'priority' => 5,
     269     'settings' => 'idivi_product_settings_before_scroll'
     270    ));
    213271
    214272
     
    230288                         'Right' => 'Right Sidebar',
    231289                         'Left' => 'Left Sidebar',
    232                          'Full' => 'Fullwidth',
     290                         'No' => 'No Sidebar',
    233291                 ),
    234292      'priority' => 5,
     
    311369        'priority' => 10,
    312370        'settings' => 'idivi_page_settings_last_used'
    313      ));
     371      ));
     372     
     373      $wp_customize->add_setting('idivi_product_settings_last_used', array(
     374        'default' => false,
     375        'type' => 'option',
     376        'capability' => 'edit_theme_options',
     377     ));
     378     $wp_customize->add_control('idivi_product_settings_last_used_options', array(
     379        'label' => __('Remember Last Used Options', $this->plugin_name),
     380        'section' => 'idivi_product_settings_section',
     381        'type' => 'checkbox',
     382        'priority' => 10,
     383        'settings' => 'idivi_product_settings_last_used'
     384     ));
    314385
    315386     $wp_customize->add_setting('idivi_project_settings_last_used', array(
     
    345416
    346417    /**
    347      * Create function that retrieves last post id
     418     * Create function that retrieves last page id
    348419     * @since 1.1
    349420     */
     
    363434
    364435    /**
    365      * Create function that retrieves last post id
     436     * Create function that retrieves last project id
    366437     * @since 1.1
    367438     */
     
    380451  }
    381452
     453    /**
     454     * Create function that retrieves last product id
     455     * @since 1.1
     456     */
     457    public function get_last_product_id() {
     458        $latest_product_args = array(
     459         'numberposts' => 1,
     460         'orderby' => 'post_date',
     461             'post_type' => 'product',
     462         'order' => 'DESC'
     463        );
     464        $latest_product = wp_get_recent_posts( $latest_product_args );
     465        foreach ($latest_product as $product) {
     466         $latest_product_id = $latest_product[0]["ID"];
     467             return $latest_product_id;
     468        }
     469       }
     470
    382471
    383472}
  • i-divi-post-settings/trunk/admin/css/admin.css

    r1836529 r1950988  
    33*/
    44#customize-control-idivi_post_settings_last_used_options,
    5 #customize-control-idivi_page_settings_last_used_options, #customize-control-idivi_project_settings_last_used_options  {
     5#customize-control-idivi_page_settings_last_used_options, #customize-control-idivi_project_settings_last_used_options, #customize-control-idivi_product_settings_last_used_options  {
    66margin-top: 10% !important;
    77}
  • i-divi-post-settings/trunk/i_divi_post_settings.php

    r1836529 r1950988  
    55 * Description: The plugin add some fields in Divi Theme Customizer from which you can set your favorite default post, page and project settings.
    66 * Author:      Dan Mardis - Howidivit.com
    7  * Version:     1.1
     7 * Version:     1.2
    88 * Author URI:  http://www.howidivit.com
    99 */
     
    6565   $page_layout_opt = get_option( 'idivi_page_settings_sidebar' );
    6666   $project_layout_opt = get_option( 'idivi_project_settings_sidebar' );
     67   $product_layout_opt = get_option( 'idivi_product_settings_sidebar' );
    6768
    6869   $dot_nav_opt = get_option( 'idivi_post_settings_dot' );
    6970   $dot_page_nav_opt = get_option( 'idivi_page_settings_dot' );
    7071   $dot_project_nav_opt = get_option( 'idivi_project_settings_dot' );
     72   $dot_product_nav_opt = get_option( 'idivi_product_settings_dot' );
    7173
    7274   $before_scroll_opt = get_option( 'idivi_post_settings_before_scroll' );
    7375   $before_page_scroll_opt = get_option( 'idivi_page_settings_before_scroll' );
    7476   $before_project_scroll_opt = get_option( 'idivi_project_settings_before_scroll' );
     77   $before_product_scroll_opt = get_option( 'idivi_product_settings_before_scroll' );
    7578
    7679   $title_opt = get_option( 'idivi_post_settings_post_title' );
     
    8083   $last_page_used = get_option('idivi_page_settings_last_used');
    8184   $last_project_used = get_option('idivi_project_settings_last_used');
     85   $last_product_used = get_option('idivi_product_settings_last_used');
    8286
    8387   // call admin class function for getting last post id
     
    8690   $last_page_id = $last_post_used->get_last_page_id();
    8791   $last_project_id = $last_post_used->get_last_project_id();
     92   $last_product_id = $last_post_used->get_last_product_id();
    8893
    8994   // retrieve last post values
     
    102107
    103108   $last_project_nav = get_post_meta( $last_project_id, '_et_pb_project_nav', true );
     109
     110   $last_product_layout = get_post_meta( $last_product_id, '_et_pb_page_layout', true );
     111   $last_product_side_nav = get_post_meta( $last_product_id, '_et_pb_side_nav', true );
     112   $last_product_hide_nav = get_post_meta( $last_product_id, '_et_pb_post_hide_nav', true );
    104113
    105114   wp_nonce_field( basename( __FILE__ ), 'et_settings_nonce' );
     
    111120   $post_hide_nav = $post_hide_nav && 'off' === $post_hide_nav ? 'default' : $post_hide_nav;
    112121   $show_title = get_post_meta( $post_id, '_et_pb_show_title', true );
     122
     123   $is_builder_active = 'on' === get_post_meta( $post_id, '_et_pb_use_builder', true );
    113124
    114125if ( 'post' === $post->post_type ) {
     
    122133      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    123134      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     135      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    124136      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    125137      );
     
    128140      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    129141      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     142      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    130143      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    131144      );
     
    139152      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    140153      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     154      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    141155      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    142156      );
     
    145159      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    146160      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     161      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    147162      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    148163      );
    149164    }
    150    } else {
     165   } else if (
     166    ( $post_layout_opt === 'Full' && (!isset($last_used) || empty($last_used)) ) ||
     167    ( ( isset($last_used) && ($last_used == 1) ) && $last_post_layout === 'et_full_width_page')
     168    ) {
     169     if ( is_rtl() ) {
     170      $page_layouts = array(
     171       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     172       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     173       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     174       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     175       );
     176     } else {
     177      $page_layouts = array(
     178       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     179       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     180       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     181       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     182       );
     183     }
     184    } else {
    151185    if ( is_rtl() ) {
    152186     $page_layouts = array(
    153       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     187      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    154188      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    155189      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     190      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    156191      );
    157192    } else {
    158193     $page_layouts = array(
    159       'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     194      'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    160195      'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    161196      'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     197      'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
    162198      );
    163199    }
    164200   }
    165  } else if ( 'page' === $post->post_type ) {
     201 } else if ( 'page' === $post->post_type ) { 
    166202    if (
    167203        ( !$page_layout_opt && (!isset($last_page_used) || empty($last_page_used) ) ) ||
     
    173209       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    174210       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    175        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     211       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    176212       );
    177213     } else {
     
    179215       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    180216       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    181        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     217       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    182218       );
    183219     }
     
    190226       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    191227       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    192        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     228       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    193229       );
    194230     } else {
     
    196232       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    197233       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    198        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     234       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    199235       );
    200236     }
     
    202238     if ( is_rtl() ) {
    203239      $page_layouts = array(
    204        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     240       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    205241       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    206242       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     
    208244     } else {
    209245      $page_layouts = array(
    210        'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     246       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    211247       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    212248       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     
    224260        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    225261        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    226         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     262        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    227263        );
    228264      } else {
     
    230266        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    231267        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    232         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     268        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    233269        );
    234270      }
     
    241277        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    242278        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    243         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     279        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    244280        );
    245281      } else {
     
    247283        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    248284        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    249         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     285        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    250286        );
    251287      }
     
    253289      if ( is_rtl() ) {
    254290       $page_layouts = array(
    255         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     291        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    256292        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
    257293        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     
    259295      } else {
    260296       $page_layouts = array(
    261         'et_full_width_page' => esc_html__( 'Fullwidth', 'Divi' ),
     297        'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
    262298        'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
    263299        'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     
    265301      }
    266302     }
    267    }
     303   } else if ( 'product' === $post->post_type ) {
     304    if (
     305        ( !$product_layout_opt && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     306        ( $product_layout_opt === 'Right' && (!isset($last_product_used) || empty($last_product_used)) ) ||
     307      ( ( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_layout === 'et_right_sidebar')
     308    ) {
     309     if ( is_rtl() ) {
     310      $page_layouts = array(
     311       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     312       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     313       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     314       );
     315     } else {
     316      $page_layouts = array(
     317       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     318       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     319       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     320       );
     321     }
     322    } else if (
     323    ( $product_layout_opt === 'Left' && (!isset($last_product_used) || empty($last_product_used)) ) ||
     324    ( ( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_layout === 'et_left_sidebar')
     325    ) {
     326     if ( is_rtl() ) {
     327      $page_layouts = array(
     328       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     329       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     330       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     331       );
     332     } else {
     333      $page_layouts = array(
     334       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     335       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     336       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     337       );
     338     }
     339    } else {
     340     if ( is_rtl() ) {
     341      $page_layouts = array(
     342       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     343       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     344       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     345       );
     346     } else {
     347      $page_layouts = array(
     348       'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
     349       'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
     350       'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
     351       );
     352     }
     353    }
     354  }
     355
     356    // Fullwidth option available for default post types only. Not available for custom post types.
     357    if ( ! et_builder_is_post_type_custom( $post->post_type ) ) {
     358        $page_layouts['et_full_width_page'] = esc_html__( 'Fullwidth', 'Divi' );
     359    }
     360
     361    if ( 'et_full_width_page' === $page_layout && ( ! isset( $page_layouts['et_full_width_page'] ) || ! $is_builder_active ) ) {
     362        $page_layout = 'et_no_sidebar';
     363  }
     364 
    268365   $layouts = array(
    269366    'light' => esc_html__( 'Light', 'Divi' ),
     
    286383    <?php
    287384    foreach ( $page_layouts as $layout_value => $layout_name ) {
    288     printf( '<option value="%2$s"%3$s>%1$s</option>',
     385    printf( '<option value="%2$s"%3$s%4$s>%1$s</option>',
    289386    esc_html( $layout_name ),
    290387    esc_attr( $layout_value ),
    291     selected( $layout_value, $page_layout, false )
     388    selected( $layout_value, $page_layout, false ),
     389    'et_full_width_page' === $layout_value && ! $is_builder_active ? ' style="display: none;"' : ''
    292390     );
    293391    } ?>
     
    346444 </select>
    347445<?php }
    348  } ?>
     446 } else if ( 'product' === $post->post_type ) {
     447  if (
     448 ( !$dot_product_nav_opt && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     449 ( $dot_product_nav_opt === 'Off' && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     450 (( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_side_nav === 'off')
     451) { ?>
     452<select id="et_pb_side_nav" name="et_pb_side_nav">
     453<option value="off" <?php selected( 'off', $side_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     454<option value="on" <?php selected( 'on', $side_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     455</select>
     456<?php } else { ?>
     457<select id="et_pb_side_nav" name="et_pb_side_nav">
     458<option value="on" <?php selected( 'on', $side_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     459<option value="off" <?php selected( 'off', $side_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     460</select>
     461<?php }
     462} ?>
    349463
    350464    </p>
     
    434548<?php
    435549   }
    436  }
     550 } else if ( 'product' === $post->post_type ) {
     551  if (
     552     ( !$before_product_scroll_opt && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     553     ( $before_product_scroll_opt === 'Default' && (!isset($last_product_used) || empty($last_product_used) ) ) ||
     554     (( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_hide_nav === 'default')
     555  ) { ?>
     556   <select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
     557   <option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
     558   <option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     559   <option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     560   </select>
     561   <?php } else if (
     562     ( $before_product_scroll_opt === 'Off' && (!isset($last_product_used) || empty($last_product_used)) ) ||
     563     ( ( isset($last_product_used) && ($last_product_used == 1) ) && $last_product_hide_nav === 'no')
     564   ) { ?>
     565    <select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
     566    <option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     567    <option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
     568    <option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     569    </select>
     570   <?php } else { ?>
     571    <select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
     572    <option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
     573    <option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
     574    <option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
     575    </select>
     576<?php
     577}
     578}
    437579      ?>
    438580    </p>
  • i-divi-post-settings/trunk/includes/class-divi-post-settings.php

    r1836529 r1950988  
    2222
    2323        $this->plugin_name = 'i-divi_post_settings';
    24         $this->version = '1.1';
     24        $this->version = '1.2';
    2525
    2626        $this->load_dependencies();
Note: See TracChangeset for help on using the changeset viewer.