Make WordPress Themes

Changeset 237182


Ignore:
Timestamp:
08/01/2024 01:20:22 PM (2 years ago)
Author:
themedropbox
Message:

New version of Dental Blocks - 2.0

Location:
dental-blocks/2.0
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • dental-blocks/2.0/functions.php

    r231454 r237182  
    6161
    6262// Get start function
     63
     64function dental_blocks_enqueue_admin_script($hook) {
     65    // Admin JS
     66    wp_enqueue_script('dental-blocks-admin-js', get_theme_file_uri('/inc/dashboard/admin.js'), array('jquery'), true);
     67    wp_localize_script(
     68        'dental-blocks-admin-js',
     69        'dental_blocks',
     70        array(
     71            'admin_ajax'    =>  admin_url('admin-ajax.php'),
     72            'wpnonce'           =>  wp_create_nonce('dental_blocks_dismissed_notice_nonce')
     73        )
     74    );
     75    wp_enqueue_script('dental-blocks-admin-js');
     76
     77    wp_localize_script( 'dental-blocks-admin-js', 'dental_blocks_scripts_localize',
     78        array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
     79    );
     80}
     81add_action('admin_enqueue_scripts', 'dental_blocks_enqueue_admin_script');
     82
     83//dismiss function
     84add_action( 'wp_ajax_dental_blocks_dismissed_notice_handler', 'dental_blocks_ajax_notice_dismiss_fuction' );
     85
     86function dental_blocks_ajax_notice_dismiss_fuction() {
     87    if (!wp_verify_nonce($_POST['wpnonce'], 'dental_blocks_dismissed_notice_nonce')) {
     88        exit;
     89    }
     90    if ( isset( $_POST['type'] ) ) {
     91        $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
     92        update_option( 'dismissed-' . $type, TRUE );
     93    }
     94}
    6395function dental_blocks_custom_admin_notice() {
    6496    // Check if the notice is dismissed
    65     if (!get_user_meta(get_current_user_id(), 'dismissed_admin_notice', true)) {
     97    if ( ! get_option('dismissed-get_started_notice', FALSE ) ) {
    6698        // Check if not on the theme documentation page
    6799        $dental_blocks_current_screen = get_current_screen();
    … …  
    69101            $dental_blocks_theme = wp_get_theme();
    70102            ?>
    71             <div class="notice notice-info is-dismissible">
     103            <div class="notice notice-info is-dismissible" data-notice="get_started_notice">
    72104                <div class="notice-div">
    73105                    <div>
    … …  
    83115}
    84116add_action('admin_notices', 'dental_blocks_custom_admin_notice');
    85 // Dismiss notice function
    86 function dental_blocks_dismiss_admin_notice() {
    87     update_user_meta(get_current_user_id(), 'dismissed_admin_notice', true);
     117
     118//after switch theme
     119add_action('after_switch_theme', 'dental_blocks_after_switch_theme');
     120function dental_blocks_after_switch_theme () {
     121    update_option('dismissed-get_started_notice', FALSE );
    88122}
    89 add_action('wp_ajax_dental_blocks_dismiss_admin_notice', 'dental_blocks_dismiss_admin_notice');
    90 // Enqueue scripts and styles
    91 function dental_blocks_enqueue_admin_script($hook) {
    92     // Admin JS
    93     wp_enqueue_script('dental-blocks-admin.js', get_theme_file_uri('/inc/dashboard/admin.js'), array('jquery'), true);
    94        
    95         wp_localize_script('dental-blocks-admin.js', 'dental_blocks_scripts_localize', array(
    96         'ajax_url' => esc_url(admin_url('admin-ajax.php'))
    97     ));
    98 }
    99 add_action('admin_enqueue_scripts', 'dental_blocks_enqueue_admin_script');
    100 // Reset the dismissed notice status when the theme is switched
    101 function dental_blocks_after_switch_theme() {
    102     delete_user_meta(get_current_user_id(), 'dismissed_admin_notice');
    103 }
    104 add_action('after_switch_theme', 'dental_blocks_after_switch_theme');
    105123//get-start-function-end//
    106124
  • dental-blocks/2.0/inc/dashboard/admin.js

    r220144 r237182  
    1 jQuery(document).ready(function($) {
    2 $('.notice.is-dismissible').on('click', '.notice-dismiss', function () {
    3     $.ajax({
    4                 type: 'POST',
    5                 url: ajaxurl,
    6                 data: {
    7                     action: 'dental_blocks_dismiss_admin_notice',
    8                 },
    9         });
    10         });
    11 });
     1( function( jQuery ){
     2 jQuery( document ).on( 'click', '.notice-info .notice-dismiss', function () {
     3        var type = jQuery( this ).closest( '.notice-info' ).data( 'notice' );
     4        jQuery.ajax( ajaxurl,
     5          {
     6            type: 'POST',
     7            data: {
     8              action: 'dental_blocks_dismissed_notice_handler',
     9              type: type,
     10              wpnonce: dental_blocks.wpnonce
     11            }
     12          } );
     13      } );
     14}( jQuery ) )
  • dental-blocks/2.0/readme.txt

    r235536 r237182  
    33Contributors: pewilliams
    44Requires at least: 6.1
    5 Tested up to: 6.5
     5Tested up to: 6.6
    66Requires PHP: 5.6
    7 Stable tag: 1.9
     7Stable tag: 2.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
    … …  
    152152* Added woocommerce css.
    153153* Blog template css.
     154
     155= 2.0 =
     156* Updated admin.js file.
     157* Added nonce.
     158* Updated Notice function.
  • dental-blocks/2.0/style.css

    r235536 r237182  
    66Description: Dental Blocks is a user-friendly website template designed for dental clinics and practitioners looking to establish a professional online presence. This theme provides a visually appealing and easy-to-navigate platform for showcasing dental services, introducing dental professionals, and offering important information to patients. With a clean and modern design, the Dental Blocks theme caters to the unique needs of dental practices. It includes sections for services like cleanings, fillings, and cosmetic procedures, allowing clinics to effectively communicate the range of treatments they offer. The theme also incorporates a gallery or portfolio feature to showcase before-and-after images, highlighting successful dental transformations. This theme is suitable for dental clinics, individual practitioners, and dental-related businesses. Its versatile design accommodates different types of dental practices, whether it's a family-oriented clinic, a specialized cosmetic dentistry service, or a general dental practice. Users can easily customize the Dental Blocks theme to match their brand identity. The intuitive interface allows for simple modifications to colors, fonts, and images, ensuring that the website aligns with the clinic's unique style. The theme may also include appointment booking functionality, streamlining the scheduling process for both the clinic and patients.
    77Requires at least: 6.1
    8 Tested up to: 6.5
     8Tested up to: 6.6
    99Requires PHP: 5.6
    10 Version: 1.9
     10Version: 2.0
    1111License: GNU General Public License
    1212License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
Note: See TracChangeset for help on using the changeset viewer.