Make WordPress Themes

Changeset 355713


Ignore:
Timestamp:
10/27/2026 09:01:45 AM (2 hours ago)
Author:
themedropbox
Message:

New version of Nestora - 1.0.3

Location:
nestora/1.0.3
Files:
1 deleted
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • nestora/1.0.3/404.php

    r352928 r355713  
    66 */
    77
    8 get_header(); 
     8get_header();
    99
    1010/**
    … …  
    1414 */
    1515if ( ! function_exists( 'nestora_get_404_image_url' ) ) {
    16     function nestora_get_404_image_url() {
     16        function nestora_get_404_image_url() {
    1717
    1818                $theme_dir = get_template_directory();
    1919                $theme_uri = get_template_directory_uri();
    20        
     20
    2121                $image_path = '/assets/images/404.jpg';
    22        
     22
    2323                if ( file_exists( $theme_dir . $image_path ) ) {
    2424                        return $theme_uri . $image_path;
    2525                }
    26        
     26
    2727                return '';
    2828        }
    … …  
    5757                                        <span class="image fit">
    5858                                                <img src="<?php echo esc_url( nestora_get_404_image_url() ); ?>"
    59                                                      alt="<?php echo esc_attr__( '404 Fehler - Seite nicht gefunden', 'nestora' ); ?>">
     59                                                        alt="<?php echo esc_attr__( '404 Fehler - Seite nicht gefunden', 'nestora' ); ?>">
    6060                                        </span>
    6161                                </div>
    … …  
    6666</section>
    6767
    68 <?php 
     68<?php
    6969get_footer();
  • nestora/1.0.3/archive.php

    r352928 r355713  
    66 */
    77
    8 defined('ABSPATH') || exit;
     8defined( 'ABSPATH' ) || exit;
    99
    10 get_header('shop');
     10get_header( 'shop' );
    1111?>
    1212
    1313<main id="primary" class="site-main nestora-shop">
    1414
    15     <div class="container">
     15        <div class="container">
    1616
    17         <header class="woocommerce-products-header">
     17                <header class="woocommerce-products-header">
    1818
    19             <?php if (apply_filters('woocommerce_show_page_title', true)) : ?>
    20                 <h1 class="woocommerce-products-header__title page-title">
    21                     <?php woocommerce_page_title(); ?>
    22                 </h1>
    23             <?php endif; ?>
     19                        <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
     20                                <h1 class="woocommerce-products-header__title page-title">
     21                                        <?php woocommerce_page_title(); ?>
     22                                </h1>
     23                        <?php endif; ?>
    2424
    25             <?php
    26             /**
    27             * Archive description.
    28             */
    29             do_action('woocommerce_archive_description');
    30             ?>
     25                        <?php
     26                        /**
     27                        * Archive description.
     28                        */
     29                        do_action( 'woocommerce_archive_description' );
     30                        ?>
    3131
    32         </header>
     32                </header>
    3333
    34         <?php if (woocommerce_product_loop()) : ?>
     34                <?php if ( woocommerce_product_loop() ) : ?>
    3535
    36             <div class="shop-toolbar">
     36                        <div class="shop-toolbar">
    3737
    38                 <div class="shop-result-count">
    39                     <?php woocommerce_result_count(); ?>
    40                 </div>
     38                                <div class="shop-result-count">
     39                                        <?php woocommerce_result_count(); ?>
     40                                </div>
    4141
    42                 <div class="shop-ordering">
    43                     <?php woocommerce_catalog_ordering(); ?>
    44                 </div>
     42                                <div class="shop-ordering">
     43                                        <?php woocommerce_catalog_ordering(); ?>
     44                                </div>
    4545
    46             </div>
     46                        </div>
    4747
    48             <?php
    49             woocommerce_product_loop_start();
     48                        <?php
     49                        woocommerce_product_loop_start();
    5050
    51             if (wc_get_loop_prop('total')) :
     51                        if ( wc_get_loop_prop( 'total' ) ) :
    5252
    53                 while (have_posts()) :
    54                     the_post();
     53                                while ( have_posts() ) :
     54                                        the_post();
    5555
    56                     /**
    57                     * WooCommerce product content.
    58                     */
    59                     wc_get_template_part('content', 'product');
     56                                        /**
     57                                        * WooCommerce product content.
     58                                        */
     59                                        wc_get_template_part( 'content', 'product' );
    6060
    61                 endwhile;
     61                                endwhile;
    6262
    63             endif;
     63                        endif;
    6464
    65             woocommerce_product_loop_end();
     65                        woocommerce_product_loop_end();
    6666
    67             /**
    68             * Pagination.
    69             */
    70             do_action('woocommerce_after_shop_loop');
     67                        /**
     68                        * Pagination.
     69                        */
     70                        do_action( 'woocommerce_after_shop_loop' );
    7171
    72         else :
     72                else :
    7373
    74             /**
    75             * No products found.
    76             */
    77             do_action('woocommerce_no_products_found');
     74                        /**
     75                        * No products found.
     76                        */
     77                        do_action( 'woocommerce_no_products_found' );
    7878
    79         endif;
    80         ?>
     79                endif;
     80                ?>
    8181
    82     </div>
     82        </div>
    8383
    8484</main>
    8585
    8686<?php
    87 get_footer('shop');
     87get_footer( 'shop' );
  • nestora/1.0.3/category.php

    r352928 r355713  
    66 */
    77
    8 defined('ABSPATH') || exit;
     8defined( 'ABSPATH' ) || exit;
    99
    1010get_header();
    … …  
    1313<main id="primary" class="site-main pfotenliebe-category">
    1414
    15     <div class="container">
     15        <div class="container">
    1616
    17         <header class="page-header">
    18             <?php
    19             the_archive_title('<h1 class="page-title">', '</h1>');
    20             the_archive_description('<div class="archive-description">', '</div>');
    21             ?>
    22         </header>
     17                <header class="page-header">
     18                        <?php
     19                        the_archive_title( '<h1 class="page-title">', '</h1>' );
     20                        the_archive_description( '<div class="archive-description">', '</div>' );
     21                        ?>
     22                </header>
    2323
    24         <?php if (have_posts()) : ?>
     24                <?php if ( have_posts() ) : ?>
    2525
    26             <div class="posts-grid">
     26                        <div class="posts-grid">
    2727
    28                 <?php
    29                 while (have_posts()) :
    30                     the_post();
    31                     ?>
     28                                <?php
     29                                while ( have_posts() ) :
     30                                        the_post();
     31                                        ?>
    3232
    33                     <article id="post-<?php the_ID(); ?>" <?php post_class('post-card'); ?>>
     33                                        <article id="post-<?php the_ID(); ?>" <?php post_class( 'post-card' ); ?>>
    3434
    35                         <?php if (has_post_thumbnail()) : ?>
    36                             <a class="post-card__thumb" href="<?php the_permalink(); ?>">
    37                                 <?php the_post_thumbnail('medium_large', ['loading' => 'lazy']); ?>
    38                             </a>
    39                         <?php endif; ?>
     35                                                <?php if ( has_post_thumbnail() ) : ?>
     36                                                        <a class="post-card__thumb" href="<?php the_permalink(); ?>">
     37                                                                <?php the_post_thumbnail( 'medium_large', array( 'loading' => 'lazy' ) ); ?>
     38                                                        </a>
     39                                                <?php endif; ?>
    4040
    41                         <div class="post-card__body">
     41                                                <div class="post-card__body">
    4242
    43                             <h2 class="post-card__title">
    44                                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    45                             </h2>
     43                                                        <h2 class="post-card__title">
     44                                                                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
     45                                                        </h2>
    4646
    47                             <div class="post-card__meta">
    48                                 <span class="post-card__date"><?php echo esc_html(get_the_date()); ?></span>
    49                                 <span class="post-card__author">
    50                                     <?php
    51                                     printf(
    52                                         /* translators: %s: author name */
    53                                         esc_html__('by %s', 'nestora'),
    54                                         esc_html(get_the_author())
    55                                     );
    56                                     ?>
    57                                 </span>
    58                             </div>
     47                                                        <div class="post-card__meta">
     48                                                                <span class="post-card__date"><?php echo esc_html( get_the_date() ); ?></span>
     49                                                                <span class="post-card__author">
     50                                                                        <?php
     51                                                                        printf(
     52                                                                                /* translators: %s: author name */
     53                                                                                esc_html__( 'by %s', 'nestora' ),
     54                                                                                esc_html( get_the_author() )
     55                                                                        );
     56                                                                        ?>
     57                                                                </span>
     58                                                        </div>
    5959
    60                             <div class="post-card__excerpt">
    61                                 <?php the_excerpt(); ?>
    62                             </div>
     60                                                        <div class="post-card__excerpt">
     61                                                                <?php the_excerpt(); ?>
     62                                                        </div>
    6363
    64                             <a class="post-card__more button" href="<?php the_permalink(); ?>">
    65                                 <?php esc_html_e('Read more', 'nestora'); ?>
    66                             </a>
     64                                                        <a class="post-card__more button" href="<?php the_permalink(); ?>">
     65                                                                <?php esc_html_e( 'Read more', 'nestora' ); ?>
     66                                                        </a>
    6767
    68                         </div>
     68                                                </div>
    6969
    70                     </article>
     70                                        </article>
    7171
    72                     <?php
    73                 endwhile;
    74                 ?>
     72                                        <?php
     73                                endwhile;
     74                                ?>
    7575
    76             </div>
     76                        </div>
    7777
    78             <?php
    79             // Pagination
    80             the_posts_pagination([
    81                 'mid_size'  => 1,
    82                 'prev_text' => esc_html__('&laquo; Previous', 'nestora'),
    83                 'next_text' => esc_html__('Next &raquo;', 'nestora'),
    84             ]);
    85             ?>
     78                        <?php
     79                        // Pagination
     80                        the_posts_pagination(
     81                                array(
     82                                        'mid_size'  => 1,
     83                                        'prev_text' => esc_html__( '&laquo; Previous', 'nestora' ),
     84                                        'next_text' => esc_html__( 'Next &raquo;', 'nestora' ),
     85                                )
     86                        );
     87                        ?>
    8688
    87         <?php else : ?>
     89                <?php else : ?>
    8890
    89             <p class="no-posts">
    90                 <?php esc_html_e('No posts found in this category.', 'nestora'); ?>
    91             </p>
     91                        <p class="no-posts">
     92                                <?php esc_html_e( 'No posts found in this category.', 'nestora' ); ?>
     93                        </p>
    9294
    93         <?php endif; ?>
     95                <?php endif; ?>
    9496
    95     </div>
     97        </div>
    9698
    9799</main>
  • nestora/1.0.3/comments.php

    r352928 r355713  
    1010                        <?php
    1111                        printf(
     12                                /* translators: %s: number of comments. */
    1213                                esc_html( _n( '%s comment', '%s comments', get_comments_number(), 'nestora' ) ),
    1314                                esc_html( number_format_i18n( get_comments_number() ) )
    … …  
    1819                <ol class="comment-list">
    1920                        <?php
    20                         wp_list_comments( array(
    21                                 'style'      => 'ol',
    22                                 'short_ping' => true,
    23                                 'avatar_size' => 48,
    24                         ) );
     21                        wp_list_comments(
     22                                array(
     23                                        'style'       => 'ol',
     24                                        'short_ping'  => true,
     25                                        'avatar_size' => 48,
     26                                )
     27                        );
    2528                        ?>
    2629                </ol>
  • nestora/1.0.3/footer.php

    r352930 r355713  
    55
    66<?php
    7 $random_product = wc_get_products( array(
    8     'status'  => 'publish',
    9     'limit'   => 1,
    10     'orderby' => 'rand',
    11     'return'  => 'objects',
    12 ) );
     7$random_product = wc_get_products(
     8        array(
     9                'status'  => 'publish',
     10                'limit'   => 1,
     11                'orderby' => 'rand',
     12                'return'  => 'objects',
     13        )
     14);
    1315
    1416if ( ! empty( $random_product ) ) :
    15     $product = $random_product[0];
    16     $image_id = $product->get_image_id();
    17     $image_url = $image_id
    18         ? wp_get_attachment_image_url( $image_id, 'large' )
    19         : wc_placeholder_img_src( 'large' );
    20 ?>
    21     <div class="sofa-img">
    22         <a href="<?php echo esc_url( $product->get_permalink() ); ?>"
    23            aria-label="<?php echo esc_attr( $product->get_name() ); ?>">
    24             <img src="<?php echo esc_url( $image_url ); ?>"
    25                  alt="<?php echo esc_attr( $product->get_name() ); ?>"
    26                  class="img-fluid">
    27         </a>
    28     </div>
     17        $product  = $random_product[0];
     18        $image_id = $product->get_image_id();
     19        $image_url = $image_id
     20                ? wp_get_attachment_image_url( $image_id, 'large' )
     21                : wc_placeholder_img_src( 'large' );
     22        ?>
     23        <div class="sofa-img">
     24                <a href="<?php echo esc_url( $product->get_permalink() ); ?>"
     25                        aria-label="<?php echo esc_attr( $product->get_name() ); ?>">
     26                        <img src="<?php echo esc_url( $image_url ); ?>"
     27                                alt="<?php echo esc_attr( $product->get_name() ); ?>"
     28                                class="img-fluid">
     29                </a>
     30        </div>
    2931<?php endif; ?>
    3032
    … …  
    3234
    3335<div class="row">
    34     <div class="col-lg-8">
    35         <div class="subscription-form" id="newsletter">
    36 
    37             <h3 class="d-flex align-items-center">
    38                 <span class="me-1">
    39                     <img
    40                         src="<?php echo esc_url( get_theme_file_uri( 'assets/images/envelope-outline.svg' ) ); ?>"
    41                         alt="Newsletter"
    42                         class="img-fluid"
    43                     >
    44                 </span>
    45                 <span>Subscribe to Newsletter</span>
    46             </h3>
    47 
    48             <?php
    49             $newsletter_status = isset( $_GET['newsletter_status'] )
    50                 ? sanitize_key( wp_unslash( $_GET['newsletter_status'] ) )
    51                 : '';
    52 
    53             $newsletter_messages = array(
    54                 'success' => array(
    55                     'class'   => 'alert-success',
    56                     'message' => 'Thank you for subscribing! Your subscription confirmation has been sent.',
    57                 ),
    58                 'invalid' => array(
    59                     'class'   => 'alert-danger',
    60                     'message' => 'Please enter your name and a valid email address.',
    61                 ),
    62                 'exists' => array(
    63                     'class'   => 'alert-warning',
    64                     'message' => 'This email address is already subscribed.',
    65                 ),
    66                 'email_error' => array(
    67                     'class'   => 'alert-warning',
    68                     'message' => 'Your subscription was saved, but an email could not be sent. Please try again later.',
    69                 ),
    70                 'error' => array(
    71                     'class'   => 'alert-danger',
    72                     'message' => 'Something went wrong. Please refresh the page and try again.',
    73                 ),
    74             );
    75             ?>
    76 
    77             <?php if ( isset( $newsletter_messages[ $newsletter_status ] ) ) : ?>
    78                 <div
    79                     class="alert <?php echo esc_attr( $newsletter_messages[ $newsletter_status ]['class'] ); ?> mt-3"
    80                     role="<?php echo 'success' === $newsletter_status ? 'status' : 'alert'; ?>"
    81                     aria-live="polite"
    82                 >
    83                     <?php echo esc_html( $newsletter_messages[ $newsletter_status ]['message'] ); ?>
    84                 </div>
    85             <?php endif; ?>
    86 
    87             <form
    88                 action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"
    89                 method="post"
    90                 class="row g-3"
    91             >
    92                 <input
    93                     type="hidden"
    94                     name="action"
    95                     value="nestora_newsletter_subscribe"
    96                 >
    97 
    98                 <?php wp_nonce_field( 'nestora_newsletter_subscribe', 'nestora_newsletter_nonce' ); ?>
    99 
    100                 <div class="col-auto">
    101                     <input
    102                         type="text"
    103                         name="nestora_newsletter_name"
    104                         class="form-control"
    105                         placeholder="Enter your name"
    106                         aria-label="Your name"
    107                         autocomplete="name"
    108                         maxlength="100"
    109                         required
    110                     >
    111                 </div>
    112 
    113                 <div class="col-auto">
    114                     <input
    115                         type="email"
    116                         name="nestora_newsletter_email"
    117                         class="form-control"
    118                         placeholder="Enter your email"
    119                         aria-label="Your email"
    120                         autocomplete="email"
    121                         maxlength="254"
    122                         required
    123                     >
    124                 </div>
    125 
    126                 <!-- Honeypot spam protection -->
    127                 <div style="position:absolute;left:-9999px;" aria-hidden="true">
    128                     <label for="delta-newsletter-website">Leave this field empty</label>
    129                     <input
    130                         type="text"
    131                         name="nestora_newsletter_website"
    132                         id="delta-newsletter-website"
    133                         tabindex="-1"
    134                         autocomplete="off"
    135                     >
    136                 </div>
    137 
    138                 <div class="col-auto">
    139                     <button
    140                         type="submit"
    141                         class="btn btn-primary"
    142                         aria-label="Subscribe to newsletter"
    143                     >
    144                         <span class="fa fa-paper-plane" aria-hidden="true"></span>
    145                     </button>
    146                 </div>
    147             </form>
    148 
    149         </div>
    150     </div>
     36        <div class="col-lg-8">
     37                <div class="subscription-form" id="newsletter">
     38
     39                        <h3 class="d-flex align-items-center">
     40                                <span class="me-1">
     41                                        <img
     42                                                src="<?php echo esc_url( get_theme_file_uri( 'assets/images/envelope-outline.svg' ) ); ?>"
     43                                                alt="Newsletter"
     44                                                class="img-fluid"
     45                                        >
     46                                </span>
     47                                <span>Subscribe to Newsletter</span>
     48                        </h3>
     49
     50                        <?php
     51                        $newsletter_status = isset( $_GET['newsletter_status'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display-only status flag.
     52                                ? sanitize_key( wp_unslash( $_GET['newsletter_status'] ) )
     53                                : '';
     54
     55                        $newsletter_messages = array(
     56                                'success'    => array(
     57                                        'class'   => 'alert-success',
     58                                        'message' => 'Thank you for subscribing! Your subscription confirmation has been sent.',
     59                                ),
     60                                'invalid'    => array(
     61                                        'class'   => 'alert-danger',
     62                                        'message' => 'Please enter your name and a valid email address.',
     63                                ),
     64                                'exists'      => array(
     65                                        'class'   => 'alert-warning',
     66                                        'message' => 'This email address is already subscribed.',
     67                                ),
     68                                'email_error' => array(
     69                                        'class'   => 'alert-warning',
     70                                        'message' => 'Your subscription was saved, but an email could not be sent. Please try again later.',
     71                                ),
     72                                'error'      => array(
     73                                        'class'   => 'alert-danger',
     74                                        'message' => 'Something went wrong. Please refresh the page and try again.',
     75                                ),
     76                        );
     77                        ?>
     78
     79                        <?php if ( isset( $newsletter_messages[ $newsletter_status ] ) ) : ?>
     80                                <div
     81                                        class="alert <?php echo esc_attr( $newsletter_messages[ $newsletter_status ]['class'] ); ?> mt-3"
     82                                        role="<?php echo 'success' === $newsletter_status ? 'status' : 'alert'; ?>"
     83                                        aria-live="polite"
     84                                >
     85                                        <?php echo esc_html( $newsletter_messages[ $newsletter_status ]['message'] ); ?>
     86                                </div>
     87                        <?php endif; ?>
     88
     89                        <form
     90                                action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"
     91                                method="post"
     92                                class="row g-3"
     93                        >
     94                                <input
     95                                        type="hidden"
     96                                        name="action"
     97                                        value="nestora_newsletter_subscribe"
     98                                >
     99
     100                                <?php wp_nonce_field( 'nestora_newsletter_subscribe', 'nestora_newsletter_nonce' ); ?>
     101
     102                                <div class="col-auto">
     103                                        <input
     104                                                type="text"
     105                                                name="nestora_newsletter_name"
     106                                                class="form-control"
     107                                                placeholder="Enter your name"
     108                                                aria-label="Your name"
     109                                                autocomplete="name"
     110                                                maxlength="100"
     111                                                required
     112                                        >
     113                                </div>
     114
     115                                <div class="col-auto">
     116                                        <input
     117                                                type="email"
     118                                                name="nestora_newsletter_email"
     119                                                class="form-control"
     120                                                placeholder="Enter your email"
     121                                                aria-label="Your email"
     122                                                autocomplete="email"
     123                                                maxlength="254"
     124                                                required
     125                                        >
     126                                </div>
     127
     128                                <!-- Honeypot spam protection -->
     129                                <div style="position:absolute;left:-9999px;" aria-hidden="true">
     130                                        <label for="delta-newsletter-website">Leave this field empty</label>
     131                                        <input
     132                                                type="text"
     133                                                name="nestora_newsletter_website"
     134                                                id="delta-newsletter-website"
     135                                                tabindex="-1"
     136                                                autocomplete="off"
     137                                        >
     138                                </div>
     139
     140                                <div class="col-auto">
     141                                        <button
     142                                                type="submit"
     143                                                class="btn btn-primary"
     144                                                aria-label="Subscribe to newsletter"
     145                                        >
     146                                                <span class="fa fa-paper-plane" aria-hidden="true"></span>
     147                                        </button>
     148                                </div>
     149                        </form>
     150
     151                </div>
     152        </div>
    151153</div>
    152154
    … …  
    167169
    168170                                                <?php
    169 $nestora_social_links = array(
    170     'facebook' => array(
    171         'url'   => get_theme_mod( 'nestora_social_facebook', '' ),
    172         'icon'  => 'fa-brands fa-facebook-f',
    173         'label' => 'Facebook',
    174     ),
    175     'twitter' => array(
    176         'url'   => get_theme_mod( 'nestora_social_twitter', '' ),
    177         'icon'  => 'fa-brands fa-x-twitter',
    178         'label' => 'Twitter / X',
    179     ),
    180     'instagram' => array(
    181         'url'   => get_theme_mod( 'nestora_social_instagram', '' ),
    182         'icon'  => 'fa-brands fa-instagram',
    183         'label' => 'Instagram',
    184     ),
    185     'linkedin' => array(
    186         'url'   => get_theme_mod( 'nestora_social_linkedin', '' ),
    187         'icon'  => 'fa-brands fa-linkedin-in',
    188         'label' => 'LinkedIn',
    189     ),
    190 );
    191 
    192 $nestora_designer_name = get_theme_mod(
    193         'nestora_designer_name',
    194         'Nestora'
    195 );
    196 
    197 $nestora_designer_url = get_theme_mod(
    198         'nestora_designer_url',
    199         'https://example.com'
    200 );
    201 
    202 $nestora_distributor_name = get_theme_mod(
    203         'nestora_distributor_name',
    204         'Nestora'
    205 );
    206 
    207 $nestora_distributor_url = get_theme_mod(
    208         'nestora_distributor_url',
    209         'https://example.com'
    210 );
    211 ?>
     171                                                $nestora_social_links = array(
     172                                                        'facebook' => array(
     173                                                                'url'   => get_theme_mod( 'nestora_social_facebook', '' ),
     174                                                                'icon'  => 'fa-brands fa-facebook-f',
     175                                                                'label' => 'Facebook',
     176                                                        ),
     177                                                        'twitter'  => array(
     178                                                                'url'   => get_theme_mod( 'nestora_social_twitter', '' ),
     179                                                                'icon'  => 'fa-brands fa-x-twitter',
     180                                                                'label' => 'Twitter / X',
     181                                                        ),
     182                                                        'instagram' => array(
     183                                                                'url'   => get_theme_mod( 'nestora_social_instagram', '' ),
     184                                                                'icon'  => 'fa-brands fa-instagram',
     185                                                                'label' => 'Instagram',
     186                                                        ),
     187                                                        'linkedin' => array(
     188                                                                'url'   => get_theme_mod( 'nestora_social_linkedin', '' ),
     189                                                                'icon'  => 'fa-brands fa-linkedin-in',
     190                                                                'label' => 'LinkedIn',
     191                                                        ),
     192                                                );
     193
     194                                                $nestora_designer_name = get_theme_mod(
     195                                                        'nestora_designer_name',
     196                                                        'Nestora'
     197                                                );
     198
     199                                                $nestora_designer_url = get_theme_mod(
     200                                                        'nestora_designer_url',
     201                                                        'https://example.com'
     202                                                );
     203
     204                                                $nestora_distributor_name = get_theme_mod(
     205                                                        'nestora_distributor_name',
     206                                                        'Nestora'
     207                                                );
     208
     209                                                $nestora_distributor_url = get_theme_mod(
     210                                                        'nestora_distributor_url',
     211                                                        'https://example.com'
     212                                                );
     213                                                ?>
    212214
    213215<ul class="list-unstyled custom-social">
    214     <?php foreach ( $nestora_social_links as $social ) : ?>
    215 
    216         <?php if ( ! empty( $social['url'] ) ) : ?>
    217             <li>
    218                 <a
    219                     href="<?php echo esc_url( $social['url'] ); ?>"
    220                     aria-label="<?php echo esc_attr( $social['label'] ); ?>"
    221                     target="_blank"
    222                     rel="noopener noreferrer"
    223                 >
    224                     <span class="<?php echo esc_attr( $social['icon'] ); ?>" aria-hidden="true"></span>
    225                 </a>
    226             </li>
    227         <?php endif; ?>
    228 
    229     <?php endforeach; ?>
     216        <?php foreach ( $nestora_social_links as $social ) : ?>
     217
     218                <?php if ( ! empty( $social['url'] ) ) : ?>
     219                        <li>
     220                                <a
     221                                        href="<?php echo esc_url( $social['url'] ); ?>"
     222                                        aria-label="<?php echo esc_attr( $social['label'] ); ?>"
     223                                        target="_blank"
     224                                        rel="noopener noreferrer"
     225                                >
     226                                        <span class="<?php echo esc_attr( $social['icon'] ); ?>" aria-hidden="true"></span>
     227                                </a>
     228                        </li>
     229                <?php endif; ?>
     230
     231        <?php endforeach; ?>
    230232</ul>
    231233                                        </div>
    … …  
    252254<div class="row pt-4">
    253255
    254     <div class="col-lg-6">
     256        <div class="col-lg-6">
    255257                                <p class="mb-2 text-center text-lg-start">
    256                     <?php
    257                     // Output copyright with allowed HTML.
    258                     echo wp_kses_post( $nestora_copyright );
    259                     ?>
    260                     &mdash;
    261                     <?php esc_html_e( 'Designed with love by', 'nestora' ); ?>
    262                     <a href="<?php echo esc_url( $nestora_designer_url ); ?>">
    263                         <?php echo esc_html( $nestora_designer_name ); ?>
    264                     </a>
    265                     <?php esc_html_e( 'Distributed By', 'nestora' ); ?>
    266                     <a href="<?php echo esc_url( $nestora_distributor_url ); ?>">
    267                         <?php echo esc_html( $nestora_distributor_name ); ?>
    268                     </a>
    269                 </p>
    270     </div>
    271 
    272     <div class="col-lg-6 text-center text-lg-end">
    273 
    274         <?php
    275         wp_nav_menu( array(
    276             'theme_location' => 'footer',
    277             'container'      => false,
    278             'menu_class'     => 'list-unstyled d-inline-flex ms-auto',
    279             'fallback_cb'    => false,
    280             'depth'          => 1,
    281         ) );
    282         ?>
    283 
    284     </div>
     258                                        <?php
     259                                        // Output copyright with allowed HTML.
     260                                        echo wp_kses_post( $nestora_copyright );
     261                                        ?>
     262                                        &mdash;
     263                                        <?php esc_html_e( 'Designed with love by', 'nestora' ); ?>
     264                                        <a href="<?php echo esc_url( $nestora_designer_url ); ?>">
     265                                                <?php echo esc_html( $nestora_designer_name ); ?>
     266                                        </a>
     267                                        <?php esc_html_e( 'Distributed By', 'nestora' ); ?>
     268                                        <a href="<?php echo esc_url( $nestora_distributor_url ); ?>">
     269                                                <?php echo esc_html( $nestora_distributor_name ); ?>
     270                                        </a>
     271                                </p>
     272        </div>
     273
     274        <div class="col-lg-6 text-center text-lg-end">
     275
     276                <?php
     277                wp_nav_menu(
     278                        array(
     279                                'theme_location' => 'footer',
     280                                'container'      => false,
     281                                'menu_class'     => 'list-unstyled d-inline-flex ms-auto',
     282                                'fallback_cb'    => false,
     283                                'depth'          => 1,
     284                        )
     285                );
     286                ?>
     287
     288        </div>
    285289
    286290</div>
  • nestora/1.0.3/functions.php

    r352928 r355713  
    33         * Enqueue theme styles and scripts.
    44         */
    5         function nestora_enqueue_assets() {
    6        
    7                 // Bootstrap CSS
    8                 wp_enqueue_style(
    9                         'bootstrap',
    10                         get_template_directory_uri() . '/assets/css/bootstrap.min.css',
    11                         array(),
    12                         '5.3.0'
    13                 );
    14        
    15                 // Font Awesome
    16                 wp_enqueue_style(
    17                         'font-awesome',
    18                         get_template_directory_uri() . '/assets/css/all.min.css',
    19                         array(),
    20                         '6.0.0-beta3'
    21                 );
    22        
    23                 // Tiny Slider CSS
    24                 wp_enqueue_style(
    25                         'tiny-slider',
    26                         get_template_directory_uri() . '/assets/css/tiny-slider.css',
    27                         array(),
    28                         '2.9.4'
    29                 );
    30        
    31                 // Theme CSS
    32                 wp_enqueue_style(
    33                         'theme-style',
    34                         get_template_directory_uri() . '/assets/css/style.css',
    35                         array('bootstrap'),
    36                         '1.0.0'
    37                 );
    38        
    39        
    40                 // Bootstrap JS
    41                 wp_enqueue_script(
    42                         'bootstrap',
    43                         get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js',
    44                         array(),
    45                         '5.3.0',
    46                         true
    47                 );
    48        
    49                 // Tiny Slider JS
    50                 wp_enqueue_script(
    51                         'tiny-slider',
    52                         get_template_directory_uri() . '/assets/js/tiny-slider.js',
    53                         array(),
    54                         '2.9.4',
    55                         true
    56                 );
    57        
    58                 // Custom JS
    59                 wp_enqueue_script(
    60                         'theme-custom',
    61                         get_template_directory_uri() . '/assets/js/custom.js',
    62                         array('bootstrap', 'tiny-slider'),
    63                         '1.0.0',
    64                         true
    65                 );
    66         }
    67         add_action('wp_enqueue_scripts', 'nestora_enqueue_assets');
     5function nestora_enqueue_assets() {
     6        $nestora_version = wp_get_theme()->get( 'Version' );
    687
    69         include_once('inc/functions-essentials.php');//mandatory file
    70         include_once('inc/functions-alpha.php');
    71         include_once('inc/functions-beta.php');
    72         include_once('inc/functions-gamma.php');
    73         include_once('inc/functions-epsilon.php');
    74         include_once('inc/functions-delta.php');
     8        // Bootstrap CSS
     9        wp_enqueue_style(
     10                'bootstrap',
     11                get_template_directory_uri() . '/assets/css/bootstrap.min.css',
     12                array(),
     13                '5.3.0'
     14        );
     15
     16        // Font Awesome
     17        wp_enqueue_style(
     18                'font-awesome',
     19                get_template_directory_uri() . '/assets/css/all.min.css',
     20                array(),
     21                '6.0.0-beta3'
     22        );
     23
     24        // Tiny Slider CSS
     25        wp_enqueue_style(
     26                'tiny-slider',
     27                get_template_directory_uri() . '/assets/css/tiny-slider.css',
     28                array(),
     29                '2.9.4'
     30        );
     31
     32        // Theme CSS
     33        wp_enqueue_style(
     34                'theme-style',
     35                get_template_directory_uri() . '/assets/css/style.css',
     36                array( 'bootstrap' ),
     37                $nestora_version
     38        );
     39
     40        // Bootstrap JS
     41        wp_enqueue_script(
     42                'bootstrap',
     43                get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js',
     44                array(),
     45                '5.3.0',
     46                true
     47        );
     48
     49        // Tiny Slider JS
     50        wp_enqueue_script(
     51                'tiny-slider',
     52                get_template_directory_uri() . '/assets/js/tiny-slider.js',
     53                array(),
     54                '2.9.4',
     55                true
     56        );
     57
     58        // Custom JS
     59        wp_enqueue_script(
     60                'theme-custom',
     61                get_template_directory_uri() . '/assets/js/custom.js',
     62                array( 'bootstrap', 'tiny-slider' ),
     63                $nestora_version,
     64                true
     65        );
     66}
     67        add_action( 'wp_enqueue_scripts', 'nestora_enqueue_assets' );
     68
     69        require_once 'inc/functions-essentials.php';//mandatory file
     70        require_once 'inc/functions-alpha.php';
     71        require_once 'inc/functions-beta.php';
     72        require_once 'inc/functions-gamma.php';
     73        require_once 'inc/functions-epsilon.php';
     74        require_once 'inc/functions-delta.php';
  • nestora/1.0.3/header.php

    r352928 r355713  
    33
    44<head>
    5     <meta charset="<?php bloginfo('charset'); ?>">
     5        <meta charset="<?php bloginfo( 'charset' ); ?>">
    66
    7     <meta name="viewport" content="width=device-width, initial-scale=1">
     7        <meta name="viewport" content="width=device-width, initial-scale=1">
    88
    9     <meta name="description" content="<?php bloginfo('description'); ?>">
     9        <meta name="description" content="<?php bloginfo( 'description' ); ?>">
    1010
    11     <?php wp_head(); ?>
     11        <?php wp_head(); ?>
    1212</head>
    1313
    … …  
    1717
    1818<header class="site-header">
    19     <!-- Add your navigation/header content here -->
     19        <!-- Add your navigation/header content here -->
    2020</header>
    2121<?php get_template_part( 'parts/nav' ); ?>
  • nestora/1.0.3/inc/functions-alpha.php

    r352930 r355713  
    77
    88if ( ! defined( 'ABSPATH' ) ) {
    9     exit;
     9        exit;
    1010}
    1111
    … …  
    1515function nestora_products_highlights_customizer( $wp_customize ) {
    1616
    17     // Add Section
    18     $wp_customize->add_section( 'nestora_products_highlights', array(
    19         'title'       => __( 'Products Highlights', 'nestora' ),
    20         'priority'    => 130,
    21         'description' => __( 'Configure the Products Highlights section', 'nestora' ),
    22     ) );
    23 
    24     // ============================================
    25     // HEADING
    26     // ============================================
    27     $wp_customize->add_setting( 'nestora_products_highlights_heading', array(
    28         'default'           => __( 'Wir helfen Ihnen, Ihr Traumzuhause zu gestalten', 'nestora' ),
    29         'sanitize_callback' => 'sanitize_text_field',
    30         'transport'         => 'refresh',
    31     ) );
    32 
    33     $wp_customize->add_control( 'nestora_products_highlights_heading', array(
    34         'label'   => __( 'Heading', 'nestora' ),
    35         'section' => 'nestora_products_highlights',
    36         'type'    => 'text',
    37     ) );
    38 
    39     // ============================================
    40     // DESCRIPTION
    41     // ============================================
    42     $wp_customize->add_setting( 'nestora_products_highlights_description', array(
    43         'default'           => __( 'Entdecken Sie unsere handgefertigten Möbelstücke – zeitloses Design, hochwertige Materialien und deutsche Handwerkskunst für Ihr Zuhause.', 'nestora' ),
    44         'sanitize_callback' => 'sanitize_textarea_field',
    45         'transport'         => 'refresh',
    46     ) );
    47 
    48     $wp_customize->add_control( 'nestora_products_highlights_description', array(
    49         'label'   => __( 'Description', 'nestora' ),
    50         'section' => 'nestora_products_highlights',
    51         'type'    => 'textarea',
    52     ) );
    53 
    54     // ============================================
    55     // WOOCOMMERCE CATEGORY DROPDOWN
    56     // ============================================
    57     $categories = array( '' => __( '— Kategorie wählen —', 'nestora' ) );
    58     if ( class_exists( 'woocommerce' ) ) {
    59         $terms = get_terms( array(
    60             'taxonomy'   => 'product_cat',
    61             'hide_empty' => false,
    62         ) );
    63         if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
    64             foreach ( $terms as $term ) {
    65                 $categories[ $term->slug ] = $term->name;
    66             }
    67         }
    68     }
    69 
    70     $wp_customize->add_setting( 'nestora_products_highlights_category', array(
    71         'default'           => '',
    72         'sanitize_callback' => 'sanitize_text_field',
    73         'transport'         => 'refresh',
    74     ) );
    75 
    76     $wp_customize->add_control( 'nestora_products_highlights_category', array(
    77         'label'       => __( 'Product Category', 'nestora' ),
    78         'description' => __( 'Select a WooCommerce category to link the button to.', 'nestora' ),
    79         'section'     => 'nestora_products_highlights',
    80         'type'        => 'select',
    81         'choices'     => $categories,
    82     ) );
    83 
    84     // ============================================
    85     // FEATURES (Multiple, Extendable)
    86     // ============================================
    87     $default_features = array(
    88         __( 'Hochwertige Massivholzmöbel', 'nestora' ),
    89         __( 'Nachhaltige Materialien', 'nestora' ),
    90         __( 'Deutsche Handwerkskunst', 'nestora' ),
    91         __( 'Kostenlose Lieferung ab 500 €', 'nestora' ),
    92     );
    93 
    94     $wp_customize->add_setting( 'nestora_products_highlights_features', array(
    95         'default'           => wp_json_encode( $default_features ),
    96         'sanitize_callback' => 'nestora_sanitize_features',
    97         'transport'         => 'refresh',
    98     ) );
    99 
    100     $wp_customize->add_control( new Nestora_Customize_Features_Control( $wp_customize, 'nestora_products_highlights_features', array(
    101         'label'       => __( 'Features', 'nestora' ),
    102         'description' => __( 'Add features for the products highlights section', 'nestora' ),
    103         'section'     => 'nestora_products_highlights',
    104     ) ) );
    105 
    106     // ============================================
    107     // HIGHLIGHT IMAGES (3 images) — fallback to theme images
    108     // ============================================
    109     $fallback_images = array(
    110         1 => get_template_directory_uri() . '/images/img-grid-1.jpg',
    111         2 => get_template_directory_uri() . '/images/img-grid-2.jpg',
    112         3 => get_template_directory_uri() . '/images/img-grid-3.jpg',
    113     );
    114 
    115     for ( $i = 1; $i <= 3; $i++ ) {
    116         $wp_customize->add_setting( "nestora_products_highlights_image_$i", array(
    117             'default'           => $fallback_images[ $i ],
    118             'sanitize_callback' => 'esc_url_raw',
    119             'transport'         => 'refresh',
    120         ) );
    121 
    122         $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, "nestora_products_highlights_image_$i", array(
    123             'label'       => sprintf( __( 'Highlight Image %d', 'nestora' ), $i ),
    124             'description' => __( 'Leave empty to use the theme default image.', 'nestora' ),
    125             'section'     => 'nestora_products_highlights',
    126         ) ) );
    127     }
     17        // Add Section
     18        $wp_customize->add_section(
     19                'nestora_products_highlights',
     20                array(
     21                        'title'       => __( 'Products Highlights', 'nestora' ),
     22                        'priority'    => 130,
     23                        'description' => __( 'Configure the Products Highlights section', 'nestora' ),
     24                )
     25        );
     26
     27        // ============================================
     28        // HEADING
     29        // ============================================
     30        $wp_customize->add_setting(
     31                'nestora_products_highlights_heading',
     32                array(
     33                        'default'           => __( 'Wir helfen Ihnen, Ihr Traumzuhause zu gestalten', 'nestora' ),
     34                        'sanitize_callback' => 'sanitize_text_field',
     35                        'transport'         => 'refresh',
     36                )
     37        );
     38
     39        $wp_customize->add_control(
     40                'nestora_products_highlights_heading',
     41                array(
     42                        'label'   => __( 'Heading', 'nestora' ),
     43                        'section' => 'nestora_products_highlights',
     44                        'type'    => 'text',
     45                )
     46        );
     47
     48        // ============================================
     49        // DESCRIPTION
     50        // ============================================
     51        $wp_customize->add_setting(
     52                'nestora_products_highlights_description',
     53                array(
     54                        'default'           => __( 'Entdecken Sie unsere handgefertigten Möbelstücke – zeitloses Design, hochwertige Materialien und deutsche Handwerkskunst für Ihr Zuhause.', 'nestora' ),
     55                        'sanitize_callback' => 'sanitize_textarea_field',
     56                        'transport'         => 'refresh',
     57                )
     58        );
     59
     60        $wp_customize->add_control(
     61                'nestora_products_highlights_description',
     62                array(
     63                        'label'   => __( 'Description', 'nestora' ),
     64                        'section' => 'nestora_products_highlights',
     65                        'type'    => 'textarea',
     66                )
     67        );
     68
     69        // ============================================
     70        // WOOCOMMERCE CATEGORY DROPDOWN
     71        // ============================================
     72        $categories = array( '' => __( '— Kategorie wählen —', 'nestora' ) );
     73        if ( class_exists( 'woocommerce' ) ) {
     74                $terms = get_terms(
     75                        array(
     76                                'taxonomy'   => 'product_cat',
     77                                'hide_empty' => false,
     78                        )
     79                );
     80                if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
     81                        foreach ( $terms as $term ) {
     82                                $categories[ $term->slug ] = $term->name;
     83                        }
     84                }
     85        }
     86
     87        $wp_customize->add_setting(
     88                'nestora_products_highlights_category',
     89                array(
     90                        'default'           => '',
     91                        'sanitize_callback' => 'sanitize_text_field',
     92                        'transport'         => 'refresh',
     93                )
     94        );
     95
     96        $wp_customize->add_control(
     97                'nestora_products_highlights_category',
     98                array(
     99                        'label'       => __( 'Product Category', 'nestora' ),
     100                        'description' => __( 'Select a WooCommerce category to link the button to.', 'nestora' ),
     101                        'section'     => 'nestora_products_highlights',
     102                        'type'        => 'select',
     103                        'choices'     => $categories,
     104                )
     105        );
     106
     107        // ============================================
     108        // FEATURES (Multiple, Extendable)
     109        // ============================================
     110        $default_features = array(
     111                __( 'Hochwertige Massivholzmöbel', 'nestora' ),
     112                __( 'Nachhaltige Materialien', 'nestora' ),
     113                __( 'Deutsche Handwerkskunst', 'nestora' ),
     114                __( 'Kostenlose Lieferung ab 500 €', 'nestora' ),
     115        );
     116
     117        $wp_customize->add_setting(
     118                'nestora_products_highlights_features',
     119                array(
     120                        'default'           => wp_json_encode( $default_features ),
     121                        'sanitize_callback' => 'nestora_sanitize_features',
     122                        'transport'         => 'refresh',
     123                )
     124        );
     125
     126        $wp_customize->add_control(
     127                new Nestora_Customize_Features_Control(
     128                        $wp_customize,
     129                        'nestora_products_highlights_features',
     130                        array(
     131                                'label'       => __( 'Features', 'nestora' ),
     132                                'description' => __( 'Add features for the products highlights section', 'nestora' ),
     133                                'section'     => 'nestora_products_highlights',
     134                        )
     135                )
     136        );
     137
     138        // ============================================
     139        // HIGHLIGHT IMAGES (3 images) — fallback to theme images
     140        // ============================================
     141        $fallback_images = array(
     142                1 => get_template_directory_uri() . '/images/img-grid-1.jpg',
     143                2 => get_template_directory_uri() . '/images/img-grid-2.jpg',
     144                3 => get_template_directory_uri() . '/images/img-grid-3.jpg',
     145        );
     146
     147        for ( $i = 1; $i <= 3; $i++ ) {
     148                $wp_customize->add_setting(
     149                        "nestora_products_highlights_image_$i",
     150                        array(
     151                                'default'           => $fallback_images[ $i ],
     152                                'sanitize_callback' => 'esc_url_raw',
     153                                'transport'         => 'refresh',
     154                        )
     155                );
     156
     157                $wp_customize->add_control(
     158                        new WP_Customize_Image_Control(
     159                                $wp_customize,
     160                                "nestora_products_highlights_image_$i",
     161                                array(
     162                                        'label'       => sprintf( /* translators: %d: image number. */ __( 'Highlight Image %d', 'nestora' ), $i ),
     163                                        'description' => __( 'Leave empty to use the theme default image.', 'nestora' ),
     164                                        'section'     => 'nestora_products_highlights',
     165                                )
     166                        )
     167                );
     168        }
    128169}
    129170add_action( 'customize_register', 'nestora_products_highlights_customizer' );
    … …  
    133174 */
    134175function nestora_sanitize_features( $value ) {
    135     $features = json_decode( $value, true );
    136 
    137     if ( ! is_array( $features ) ) {
    138         return wp_json_encode( array( '' ) );
    139     }
    140 
    141     $sanitized = array();
    142     foreach ( $features as $feature ) {
    143         $sanitized[] = sanitize_text_field( $feature );
    144     }
    145 
    146     return wp_json_encode( $sanitized );
     176        $features = json_decode( $value, true );
     177
     178        if ( ! is_array( $features ) ) {
     179                return wp_json_encode( array( '' ) );
     180        }
     181
     182        $sanitized = array();
     183        foreach ( $features as $feature ) {
     184                $sanitized[] = sanitize_text_field( $feature );
     185        }
     186
     187        return wp_json_encode( $sanitized );
    147188}
    148189
    … …  
    151192 */
    152193function nestora_get_products_highlights_features() {
    153     $features_json = get_theme_mod( 'nestora_products_highlights_features', wp_json_encode( array() ) );
    154     $features      = json_decode( $features_json, true );
    155 
    156     if ( ! is_array( $features ) ) {
    157         return array();
    158     }
    159 
    160     return array_values( array_filter( $features, function( $feature ) {
    161         return ! empty( trim( $feature ) );
    162     } ) );
     194        $features_json = get_theme_mod( 'nestora_products_highlights_features', wp_json_encode( array() ) );
     195        $features      = json_decode( $features_json, true );
     196
     197        if ( ! is_array( $features ) ) {
     198                return array();
     199        }
     200
     201        return array_values(
     202                array_filter(
     203                        $features,
     204                        function ( $feature ) {
     205                                return ! empty( trim( $feature, " \n\r\t\v\x00" ) );
     206                        }
     207                )
     208        );
    163209}
    164210
    … …  
    168214if ( class_exists( 'WP_Customize_Control' ) ) {
    169215
    170     class Nestora_Customize_Features_Control extends WP_Customize_Control {
    171 
    172         public $type = 'nestora_features';
    173 
    174         public function render_content() {
    175             $features = json_decode( $this->value(), true );
    176 
    177             if ( ! is_array( $features ) || empty( $features ) ) {
    178                 $features = array( '' );
    179             }
    180             ?>
    181             <label>
    182                 <?php if ( ! empty( $this->label ) ) : ?>
    183                     <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
    184                 <?php endif; ?>
    185                 <?php if ( ! empty( $this->description ) ) : ?>
    186                     <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
    187                 <?php endif; ?>
    188             </label>
    189 
    190             <div class="nestora-features-wrapper">
    191                 <div class="nestora-features-list">
    192                     <?php foreach ( $features as $feature ) : ?>
    193                         <div class="nestora-feature-item">
    194                             <input type="text"
    195                                    class="nestora-feature-input"
    196                                    value="<?php echo esc_attr( $feature ); ?>"
    197                                    placeholder="<?php esc_attr_e( 'Enter feature', 'nestora' ); ?>" />
    198                             <button type="button" class="button nestora-remove-feature" aria-label="<?php esc_attr_e( 'Remove feature', 'nestora' ); ?>">
    199                                 <span class="dashicons dashicons-minus"></span>
    200                             </button>
    201                         </div>
    202                     <?php endforeach; ?>
    203                 </div>
    204                 <button type="button" class="button button-secondary nestora-add-feature">
    205                     <span class="dashicons dashicons-plus"></span>
    206                     <?php esc_html_e( 'Add Feature', 'nestora' ); ?>
    207                 </button>
    208                 <input type="hidden" class="nestora-features-value" <?php $this->link(); ?> value="<?php echo esc_attr( $this->value() ); ?>" />
    209             </div>
    210             <?php
    211         }
    212     }
     216        class Nestora_Customize_Features_Control extends WP_Customize_Control {
     217
     218                public $type = 'nestora_features';
     219
     220                public function render_content() {
     221                        $features = json_decode( $this->value(), true );
     222
     223                        if ( ! is_array( $features ) || empty( $features ) ) {
     224                                $features = array( '' );
     225                        }
     226                        ?>
     227                        <label>
     228                                <?php if ( ! empty( $this->label ) ) : ?>
     229                                        <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     230                                <?php endif; ?>
     231                                <?php if ( ! empty( $this->description ) ) : ?>
     232                                        <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     233                                <?php endif; ?>
     234                        </label>
     235
     236                        <div class="nestora-features-wrapper">
     237                                <div class="nestora-features-list">
     238                                        <?php foreach ( $features as $feature ) : ?>
     239                                                <div class="nestora-feature-item">
     240                                                        <input type="text"
     241                                                                        class="nestora-feature-input"
     242                                                                        value="<?php echo esc_attr( $feature ); ?>"
     243                                                                        placeholder="<?php esc_attr_e( 'Enter feature', 'nestora' ); ?>" />
     244                                                        <button type="button" class="button nestora-remove-feature" aria-label="<?php esc_attr_e( 'Remove feature', 'nestora' ); ?>">
     245                                                                <span class="dashicons dashicons-minus"></span>
     246                                                        </button>
     247                                                </div>
     248                                        <?php endforeach; ?>
     249                                </div>
     250                                <button type="button" class="button button-secondary nestora-add-feature">
     251                                        <span class="dashicons dashicons-plus"></span>
     252                                        <?php esc_html_e( 'Add Feature', 'nestora' ); ?>
     253                                </button>
     254                                <input type="hidden" class="nestora-features-value" <?php $this->link(); ?> value="<?php echo esc_attr( $this->value() ); ?>" />
     255                        </div>
     256                        <?php
     257                }
     258        }
    213259}
    214260
    … …  
    217263 */
    218264function nestora_customizer_controls_assets() {
    219     if ( ! is_customize_preview() ) {
    220         return;
    221     }
    222 
    223     $js_path  = get_template_directory() . '/assets/js/customizer-features.js';
    224     $css_path = get_template_directory() . '/assets/css/customizer-features.css';
    225 
    226     if ( file_exists( $css_path ) ) {
    227         wp_enqueue_style(
    228             'nestora-customizer-features',
    229             get_template_directory_uri() . '/assets/css/customizer-features.css',
    230             array(),
    231             filemtime( $css_path )
    232         );
    233     }
    234 
    235     if ( file_exists( $js_path ) ) {
    236         wp_enqueue_script(
    237             'nestora-customizer-features',
    238             get_template_directory_uri() . '/assets/js/customizer-features.js',
    239             array( 'jquery', 'customize-controls' ),
    240             filemtime( $js_path ),
    241             true
    242         );
    243     }
     265        if ( ! is_customize_preview() ) {
     266                return;
     267        }
     268
     269        $js_path  = get_template_directory() . '/assets/js/customizer-features.js';
     270        $css_path = get_template_directory() . '/assets/css/customizer-features.css';
     271
     272        if ( file_exists( $css_path ) ) {
     273                wp_enqueue_style(
     274                        'nestora-customizer-features',
     275                        get_template_directory_uri() . '/assets/css/customizer-features.css',
     276                        array(),
     277                        filemtime( $css_path )
     278                );
     279        }
     280
     281        if ( file_exists( $js_path ) ) {
     282                wp_enqueue_script(
     283                        'nestora-customizer-features',
     284                        get_template_directory_uri() . '/assets/js/customizer-features.js',
     285                        array( 'jquery', 'customize-controls' ),
     286                        filemtime( $js_path ),
     287                        true
     288                );
     289        }
    244290}
    245291add_action( 'customize_controls_enqueue_scripts', 'nestora_customizer_controls_assets' );
    246292
    247293
    248     // ============================================
    249     // customized section for popular categories
    250     // ============================================
     294        // ============================================
     295        // customized section for popular categories
     296        // ============================================
    251297
    252298
    … …  
    256302function nestora_category_highlights_customize_register( $wp_customize ) {
    257303
    258     // ---- Section ----
    259     $wp_customize->add_section(
    260         'nestora_category_highlights',
    261         array(
    262             'title'       => __( 'Category Highlights', 'nestora' ),
    263             'description' => __( 'Add WooCommerce category highlights. Use the + icon to add and the × icon to remove.', 'nestora' ),
    264             'priority'    => 30,
    265             'capability'  => 'edit_theme_options',
    266         )
    267     );
    268 
    269     // ---- Repeater Setting (stored as JSON string) ----
    270     $wp_customize->add_setting(
    271         'nestora_category_highlights_items',
    272         array(
    273             'default'           => wp_json_encode( array( 0, 0, 0 ) ),
    274             'sanitize_callback' => 'nestora_sanitize_repeater_json',
    275             'transport'         => 'refresh',
    276             'type'              => 'option',
    277         )
    278     );
    279 
    280     // ---- Repeater Control (custom) ----
    281     $wp_customize->add_control(
    282         new Nestora_Category_Repeater_Control(
    283             $wp_customize,
    284             'nestora_category_highlights_items',
    285             array(
    286                 'label'       => __( 'Highlighted Categories', 'nestora' ),
    287                 'description' => __( 'Select WooCommerce categories. Click + to add a new one.', 'nestora' ),
    288                 'section'     => 'nestora_category_highlights',
    289                 'settings'    => 'nestora_category_highlights_items',
    290                 'choices'     => nestora_get_product_categories_choices(),
    291             )
    292         )
    293     );
     304        // ---- Section ----
     305        $wp_customize->add_section(
     306                'nestora_category_highlights',
     307                array(
     308                        'title'       => __( 'Category Highlights', 'nestora' ),
     309                        'description' => __( 'Add WooCommerce category highlights. Use the + icon to add and the × icon to remove.', 'nestora' ),
     310                        'priority'    => 30,
     311                        'capability'  => 'edit_theme_options',
     312                )
     313        );
     314
     315        // ---- Repeater Setting (stored as JSON string) ----
     316        $wp_customize->add_setting(
     317                'nestora_category_highlights_items',
     318                array(
     319                        'default'           => wp_json_encode( array( 0, 0, 0 ) ),
     320                        'sanitize_callback' => 'nestora_sanitize_repeater_json',
     321                        'transport'         => 'refresh',
     322                        'type'              => 'option',
     323                )
     324        );
     325
     326        // ---- Repeater Control (custom) ----
     327        $wp_customize->add_control(
     328                new Nestora_Category_Repeater_Control(
     329                        $wp_customize,
     330                        'nestora_category_highlights_items',
     331                        array(
     332                                'label'       => __( 'Highlighted Categories', 'nestora' ),
     333                                'description' => __( 'Select WooCommerce categories. Click + to add a new one.', 'nestora' ),
     334                                'section'     => 'nestora_category_highlights',
     335                                'settings'    => 'nestora_category_highlights_items',
     336                                'choices'     => nestora_get_product_categories_choices(),
     337                        )
     338                )
     339        );
    294340}
    295341add_action( 'customize_register', 'nestora_category_highlights_customize_register' );
    … …  
    299345 */
    300346function nestora_get_product_categories_choices() {
    301     $choices = array( 0 => __( '— Select a category —', 'nestora' ) );
    302 
    303     if ( taxonomy_exists( 'product_cat' ) ) {
    304         $terms = get_terms(
    305             array(
    306                 'taxonomy'   => 'product_cat',
    307                 'hide_empty' => false,
    308             )
    309         );
    310 
    311         if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
    312             foreach ( $terms as $term ) {
    313                 $choices[ $term->term_id ] = $term->name;
    314             }
    315         }
    316     }
    317 
    318     return $choices;
     347        $choices = array( 0 => __( '— Select a category —', 'nestora' ) );
     348
     349        if ( taxonomy_exists( 'product_cat' ) ) {
     350                $terms = get_terms(
     351                        array(
     352                                'taxonomy'   => 'product_cat',
     353                                'hide_empty' => false,
     354                        )
     355                );
     356
     357                if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
     358                        foreach ( $terms as $term ) {
     359                                $choices[ $term->term_id ] = $term->name;
     360                        }
     361                }
     362        }
     363
     364        return $choices;
    319365}
    320366
    … …  
    323369 */
    324370function nestora_sanitize_repeater_json( $value ) {
    325     if ( is_array( $value ) ) {
    326         return wp_json_encode( array_map( 'absint', $value ) );
    327     }
    328 
    329     $decoded = json_decode( $value, true );
    330     if ( is_array( $decoded ) ) {
    331         return wp_json_encode( array_map( 'absint', $decoded ) );
    332     }
    333 
    334     if ( is_string( $value ) && false !== strpos( $value, ',' ) ) {
    335         return wp_json_encode( array_map( 'absint', explode( ',', $value ) ) );
    336     }
    337 
    338     return wp_json_encode( array() );
     371        if ( is_array( $value ) ) {
     372                return wp_json_encode( array_map( 'absint', $value ) );
     373        }
     374
     375        $decoded = json_decode( $value, true );
     376        if ( is_array( $decoded ) ) {
     377                return wp_json_encode( array_map( 'absint', $decoded ) );
     378        }
     379
     380        if ( is_string( $value ) && false !== strpos( $value, ',' ) ) {
     381                return wp_json_encode( array_map( 'absint', explode( ',', $value ) ) );
     382        }
     383
     384        return wp_json_encode( array() );
    339385}
    340386
    … …  
    346392 */
    347393function nestora_get_category_highlight_items() {
    348     $raw = get_option( 'nestora_category_highlights_items', wp_json_encode( array( 0, 0, 0 ) ) );
    349 
    350     if ( is_array( $raw ) ) {
    351         return array_map( 'absint', $raw );
    352     }
    353 
    354     $decoded = json_decode( $raw, true );
    355     if ( ! is_array( $decoded ) ) {
    356         return array();
    357     }
    358 
    359     return array_map( 'absint', $decoded );
     394        $raw = get_option( 'nestora_category_highlights_items', wp_json_encode( array( 0, 0, 0 ) ) );
     395
     396        if ( is_array( $raw ) ) {
     397                return array_map( 'absint', $raw );
     398        }
     399
     400        $decoded = json_decode( $raw, true );
     401        if ( ! is_array( $decoded ) ) {
     402                return array();
     403        }
     404
     405        return array_map( 'absint', $decoded );
    360406}
    361407
    … …  
    364410 */
    365411function nestora_register_custom_controls() {
    366     if ( ! class_exists( 'WP_Customize_Control' ) ) {
    367         return;
    368     }
    369 
    370     class Nestora_Category_Repeater_Control extends WP_Customize_Control {
    371 
    372         public $type    = 'nestora-category-repeater';
    373         public $choices = array();
    374 
    375         public function enqueue() {
    376             wp_enqueue_script(
    377                 'nestora-customizer-repeater',
    378                 get_template_directory_uri() . '/js/customizer-repeater.js',
    379                 array( 'jquery', 'customize-controls' ),
    380                 '1.1.0',
    381                 true
    382             );
    383 
    384             wp_enqueue_style(
    385                 'nestora-customizer-repeater',
    386                 get_template_directory_uri() . '/css/customizer-repeater.css',
    387                 array(),
    388                 '1.1.0'
    389             );
    390         }
    391 
    392         /**
    393         * Render control content
    394         */
    395         protected function render_content() {
    396             $value = $this->value();
    397 
    398             $items = json_decode( $value, true );
    399             if ( ! is_array( $items ) || empty( $items ) ) {
    400                 $items = array( 0, 0, 0 );
    401             }
    402             ?>
    403             <label>
    404                 <?php if ( ! empty( $this->label ) ) : ?>
    405                     <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
    406                 <?php endif; ?>
    407                 <?php if ( ! empty( $this->description ) ) : ?>
    408                     <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
    409                 <?php endif; ?>
    410             </label>
    411 
    412             <div class="nestora-repeater" data-setting="<?php echo esc_attr( $this->id ); ?>">
    413                 <div class="nestora-repeater-items">
    414                     <?php foreach ( $items as $index => $category_id ) : ?>
    415                         <?php $this->render_row( $index, $category_id ); ?>
    416                     <?php endforeach; ?>
    417                 </div>
    418 
    419                 <button type="button" class="button nestora-repeater-add">
    420                     <span class="dashicons dashicons-plus-alt2"></span>
    421                     <?php esc_html_e( 'Add Category', 'nestora' ); ?>
    422                 </button>
    423 
    424                 <input
    425                     type="hidden"
    426                     class="nestora-repeater-value"
    427                     <?php $this->link(); ?>
    428                     value="<?php echo esc_attr( $value ); ?>"
    429                 />
    430 
    431                 <script type="text/html" class="nestora-repeater-template">
    432                     <?php $this->render_row( '__INDEX__', 0 ); ?>
    433                 </script>
    434             </div>
    435             <?php
    436         }
    437 
    438         /**
    439         * Render a single repeater row
    440         */
    441         protected function render_row( $index, $selected ) {
    442             ?>
    443             <div class="nestora-repeater-row" data-index="<?php echo esc_attr( $index ); ?>">
    444                 <select class="nestora-repeater-select">
    445                     <?php foreach ( $this->choices as $id => $name ) : ?>
    446                         <option value="<?php echo esc_attr( $id ); ?>" <?php selected( $selected, $id ); ?>>
    447                             <?php echo esc_html( $name ); ?>
    448                         </option>
    449                     <?php endforeach; ?>
    450                 </select>
    451 
    452                 <button type="button" class="nestora-repeater-remove" title="<?php esc_attr_e( 'Remove', 'nestora' ); ?>">
    453                     <span class="dashicons dashicons-no-alt"></span>
    454                 </button>
    455             </div>
    456             <?php
    457         }
    458     }
     412        if ( ! class_exists( 'WP_Customize_Control' ) ) {
     413                return;
     414        }
     415
     416        class Nestora_Category_Repeater_Control extends WP_Customize_Control {
     417
     418                public $type    = 'nestora-category-repeater';
     419                public $choices = array();
     420
     421                public function enqueue() {
     422                        wp_enqueue_script(
     423                                'nestora-customizer-repeater',
     424                                get_template_directory_uri() . '/js/customizer-repeater.js',
     425                                array( 'jquery', 'customize-controls' ),
     426                                '1.1.0',
     427                                true
     428                        );
     429
     430                        wp_enqueue_style(
     431                                'nestora-customizer-repeater',
     432                                get_template_directory_uri() . '/css/customizer-repeater.css',
     433                                array(),
     434                                '1.1.0'
     435                        );
     436                }
     437
     438                /**
     439                * Render control content
     440                */
     441                protected function render_content() {
     442                        $value = $this->value();
     443
     444                        $items = json_decode( $value, true );
     445                        if ( ! is_array( $items ) || empty( $items ) ) {
     446                                $items = array( 0, 0, 0 );
     447                        }
     448                        ?>
     449                        <label>
     450                                <?php if ( ! empty( $this->label ) ) : ?>
     451                                        <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     452                                <?php endif; ?>
     453                                <?php if ( ! empty( $this->description ) ) : ?>
     454                                        <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     455                                <?php endif; ?>
     456                        </label>
     457
     458                        <div class="nestora-repeater" data-setting="<?php echo esc_attr( $this->id ); ?>">
     459                                <div class="nestora-repeater-items">
     460                                        <?php foreach ( $items as $index => $category_id ) : ?>
     461                                                <?php $this->render_row( $index, $category_id ); ?>
     462                                        <?php endforeach; ?>
     463                                </div>
     464
     465                                <button type="button" class="button nestora-repeater-add">
     466                                        <span class="dashicons dashicons-plus-alt2"></span>
     467                                        <?php esc_html_e( 'Add Category', 'nestora' ); ?>
     468                                </button>
     469
     470                                <input
     471                                        type="hidden"
     472                                        class="nestora-repeater-value"
     473                                        <?php $this->link(); ?>
     474                                        value="<?php echo esc_attr( $value ); ?>"
     475                                />
     476
     477                                <script type="text/html" class="nestora-repeater-template">
     478                                        <?php $this->render_row( '__INDEX__', 0 ); ?>
     479                                </script>
     480                        </div>
     481                        <?php
     482                }
     483
     484                /**
     485                * Render a single repeater row
     486                */
     487                protected function render_row( $index, $selected ) {
     488                        ?>
     489                        <div class="nestora-repeater-row" data-index="<?php echo esc_attr( $index ); ?>">
     490                                <select class="nestora-repeater-select">
     491                                        <?php foreach ( $this->choices as $id => $name ) : ?>
     492                                                <option value="<?php echo esc_attr( $id ); ?>" <?php selected( $selected, $id ); ?>>
     493                                                        <?php echo esc_html( $name ); ?>
     494                                                </option>
     495                                        <?php endforeach; ?>
     496                                </select>
     497
     498                                <button type="button" class="nestora-repeater-remove" title="<?php esc_attr_e( 'Remove', 'nestora' ); ?>">
     499                                        <span class="dashicons dashicons-no-alt"></span>
     500                                </button>
     501                        </div>
     502                        <?php
     503                }
     504        }
    459505}
    460506add_action( 'customize_register', 'nestora_register_custom_controls', 5 );
  • nestora/1.0.3/inc/functions-beta.php

    r352930 r355713  
    77
    88if ( ! function_exists( 'nestora_theme_enqueue_styles' ) ) {
    9     function nestora_theme_enqueue_styles() {
    10 
    11         $theme = wp_get_theme();
    12 
    13         /* -----------------------------------------------------------------
    14         * Styles
    15         * ----------------------------------------------------------------- */
    16 
    17         // Theme base stylesheet (style.css)
    18         $base_path = get_stylesheet_directory() . '/style.css';
    19         wp_enqueue_style(
    20             'nestora-style',
    21             get_stylesheet_uri(),
    22             array(),
    23             file_exists( $base_path ) ? filemtime( $base_path ) : $theme->get( 'Version' )
    24         );
    25 
    26         // Swiper bundle CSS
    27         $swiper_css_path = get_template_directory() . '/assets/css/swiper-bundle.min.css';
    28         wp_enqueue_style(
    29             'nestora-swiper',
    30             get_template_directory_uri() . '/assets/css/swiper-bundle.min.css',
    31             array(), // no dependency — load before theme CSS
    32             file_exists( $swiper_css_path ) ? filemtime( $swiper_css_path ) : $theme->get( 'Version' )
    33         );
    34 
    35         // Custom theme styles — depends on swiper CSS so it loads after
    36         $custom_path = get_template_directory() . '/assets/css/themes.css';
    37         wp_enqueue_style(
    38             'nestora-theme',
    39             get_template_directory_uri() . '/assets/css/themes.css',
    40             array( 'nestora-style', 'nestora-swiper' ),
    41             file_exists( $custom_path ) ? filemtime( $custom_path ) : $theme->get( 'Version' )
    42         );
    43     }
     9        function nestora_theme_enqueue_styles() {
     10
     11                $theme = wp_get_theme();
     12
     13                /* -----------------------------------------------------------------
     14                * Styles
     15                * ----------------------------------------------------------------- */
     16
     17                // Theme base stylesheet (style.css)
     18                $base_path = get_stylesheet_directory() . '/style.css';
     19                wp_enqueue_style(
     20                        'nestora-style',
     21                        get_stylesheet_uri(),
     22                        array(),
     23                        file_exists( $base_path ) ? filemtime( $base_path ) : $theme->get( 'Version' )
     24                );
     25
     26                // Swiper bundle CSS
     27                $swiper_css_path = get_template_directory() . '/assets/css/swiper-bundle.min.css';
     28                wp_enqueue_style(
     29                        'nestora-swiper',
     30                        get_template_directory_uri() . '/assets/css/swiper-bundle.min.css',
     31                        array(), // no dependency — load before theme CSS
     32                        file_exists( $swiper_css_path ) ? filemtime( $swiper_css_path ) : $theme->get( 'Version' )
     33                );
     34
     35                // Custom theme styles — depends on swiper CSS so it loads after
     36                $custom_path = get_template_directory() . '/assets/css/themes.css';
     37                wp_enqueue_style(
     38                        'nestora-theme',
     39                        get_template_directory_uri() . '/assets/css/themes.css',
     40                        array( 'nestora-style', 'nestora-swiper' ),
     41                        file_exists( $custom_path ) ? filemtime( $custom_path ) : $theme->get( 'Version' )
     42                );
     43        }
    4444}
    4545add_action( 'wp_enqueue_scripts', 'nestora_theme_enqueue_styles' );
    … …  
    4747
    4848if ( ! function_exists( 'nestora_theme_enqueue_scripts' ) ) {
    49     function nestora_theme_enqueue_scripts() {
    50 
    51         $theme = wp_get_theme();
    52 
    53         /* -----------------------------------------------------------------
    54         * Scripts
    55         * ----------------------------------------------------------------- */
    56 
    57         // Swiper bundle JS (no jQuery dependency)
    58         $swiper_js_path = get_template_directory() . '/assets/js/swiper-bundle.min.js';
    59         wp_enqueue_script(
    60             'nestora-swiper',
    61             get_template_directory_uri() . '/assets/js/swiper-bundle.min.js',
    62             array(),            // no deps
    63             file_exists( $swiper_js_path ) ? filemtime( $swiper_js_path ) : $theme->get( 'Version' ),
    64             true                // load in footer
    65         );
    66 
    67         // Custom theme JS — depends on Swiper so it runs after it's ready
    68         $custom_js_path = get_template_directory() . '/assets/js/custom.js';
    69         wp_enqueue_script(
    70             'nestora-custom',
    71             get_template_directory_uri() . '/assets/js/custom.js',
    72             array( 'nestora-swiper' ),
    73             file_exists( $custom_js_path ) ? filemtime( $custom_js_path ) : $theme->get( 'Version' ),
    74             true
    75         );
    76     }
     49        function nestora_theme_enqueue_scripts() {
     50
     51                $theme = wp_get_theme();
     52
     53                /* -----------------------------------------------------------------
     54                * Scripts
     55                * ----------------------------------------------------------------- */
     56
     57                // Swiper bundle JS (no jQuery dependency)
     58                $swiper_js_path = get_template_directory() . '/assets/js/swiper-bundle.min.js';
     59                wp_enqueue_script(
     60                        'nestora-swiper',
     61                        get_template_directory_uri() . '/assets/js/swiper-bundle.min.js',
     62                        array(),            // no deps
     63                        file_exists( $swiper_js_path ) ? filemtime( $swiper_js_path ) : $theme->get( 'Version' ),
     64                        true                // load in footer
     65                );
     66
     67                // Custom theme JS — depends on Swiper so it runs after it's ready
     68                $custom_js_path = get_template_directory() . '/assets/js/custom.js';
     69                wp_enqueue_script(
     70                        'nestora-custom',
     71                        get_template_directory_uri() . '/assets/js/custom.js',
     72                        array( 'nestora-swiper' ),
     73                        file_exists( $custom_js_path ) ? filemtime( $custom_js_path ) : $theme->get( 'Version' ),
     74                        true
     75                );
     76        }
    7777}
    7878add_action( 'wp_enqueue_scripts', 'nestora_theme_enqueue_scripts' );
    … …  
    8282 */
    8383if ( ! function_exists( 'nestora_theme_setup' ) ) {
    84     function nestora_theme_setup() {
    85 
    86         /* ---------- Core ---------- */
    87         add_theme_support( 'title-tag' );
    88         add_theme_support( 'automatic-feed-links' );
    89         add_theme_support( 'post-thumbnails' );
    90         add_theme_support( 'customize-selective-refresh-widgets' );
    91         add_theme_support( 'html5', array(
    92             'search-form',
    93             'comment-form',
    94             'comment-list',
    95             'gallery',
    96             'caption',
    97             'style',
    98             'script',
    99         ) );
    100 
    101         /* ---------- Gallery + media ---------- */
    102         add_theme_support( 'gallery' );            // classic [gallery] shortcode
    103         add_theme_support( 'align-wide' );         // wide/full alignment
    104         add_theme_support( 'responsive-embeds' );  // responsive iframes
    105         add_theme_support( 'editor-styles' );
    106         add_editor_style( 'assets/css/editor.css' );
    107 
    108         /* ---------- Post formats (optional but useful for galleries) ---------- */
    109         add_theme_support( 'post-formats', array(
    110             'gallery',
    111             'image',
    112             'video',
    113             'quote',
    114             'link',
    115         ) );
    116 
    117         /* ---------- WooCommerce ---------- */
    118         add_theme_support( 'woocommerce' );
    119         add_theme_support( 'wc-product-gallery-zoom' );
    120         add_theme_support( 'wc-product-gallery-lightbox' );
    121         add_theme_support( 'wc-product-gallery-slider' );
    122     }
     84        function nestora_theme_setup() {
     85
     86                /* ---------- Core ---------- */
     87                add_theme_support( 'title-tag' );
     88                add_theme_support( 'automatic-feed-links' );
     89                add_theme_support( 'post-thumbnails' );
     90                add_theme_support( 'customize-selective-refresh-widgets' );
     91                add_theme_support(
     92                        'html5',
     93                        array(
     94                                'search-form',
     95                                'comment-form',
     96                                'comment-list',
     97                                'gallery',
     98                                'caption',
     99                                'style',
     100                                'script',
     101                        )
     102                );
     103
     104                /* ---------- Gallery + media ---------- */
     105                add_theme_support( 'gallery' );            // classic [gallery] shortcode
     106                add_theme_support( 'align-wide' );         // wide/full alignment
     107                add_theme_support( 'responsive-embeds' );  // responsive iframes
     108                add_theme_support( 'editor-styles' );
     109                add_editor_style( 'assets/css/editor.css' );
     110
     111                /* ---------- Post formats (optional but useful for galleries) ---------- */
     112                add_theme_support(
     113                        'post-formats',
     114                        array(
     115                                'gallery',
     116                                'image',
     117                                'video',
     118                                'quote',
     119                                'link',
     120                        )
     121                );
     122
     123                /* ---------- WooCommerce ---------- */
     124                add_theme_support( 'woocommerce' );
     125                add_theme_support( 'wc-product-gallery-zoom' );
     126                add_theme_support( 'wc-product-gallery-lightbox' );
     127                add_theme_support( 'wc-product-gallery-slider' );
     128        }
    123129}
    124130add_action( 'after_setup_theme', 'nestora_theme_setup' );
    125131
    126132
    127 add_filter( 'template_include', 'load_custom_woocommerce_templates', 99 );
    128 
    129 function load_custom_woocommerce_templates( $template ) {
    130 
    131     $theme_dir = get_stylesheet_directory();
    132 
    133     // Cart page
    134  
    135 // Custom Shop page
    136 if ( function_exists( 'is_shop' ) && is_shop() ) {
    137     $custom_template = $theme_dir . '/woocommerce-custom/page-shop-custom.php';
    138 
    139 // Custom Cart page
    140 } elseif ( function_exists( 'is_cart' ) && is_cart() ) {
    141     $custom_template = $theme_dir . '/woocommerce-custom/page-cart-custom.php';
    142 
    143 // Checkout and order-received pages
    144 }
    145 
    146  elseif ( function_exists( 'is_checkout' ) && is_checkout() ) {
    147 
    148         if ( function_exists( 'is_order_received_page' ) && is_order_received_page() ) {
    149             $custom_template = $theme_dir . '/woocommerce-custom/page-order-received-custom.php';
    150         } else {
    151             $custom_template = $theme_dir . '/woocommerce-custom/page-checkout-custom.php';
    152         }
    153 
    154     // WooCommerce product category archives
    155     } elseif ( function_exists( 'is_category' ) && is_category() ) {
    156         $custom_template = $theme_dir . '/templates/category-recent-blog.php';
    157                
    158                
    159 
    160     } else {
    161         return $template;
    162     }
    163        
    164     if ( isset( $custom_template ) && file_exists( $custom_template ) ) {
    165         return $custom_template;
    166     }
    167 
    168     return $template;
     133add_filter( 'template_include', 'nestora_load_custom_woocommerce_templates', 99 );
     134
     135function nestora_load_custom_woocommerce_templates( $template ) {
     136
     137        $theme_dir = get_stylesheet_directory();
     138
     139        // Cart page
     140
     141        // Custom Shop page
     142        if ( function_exists( 'is_shop' ) && is_shop() ) {
     143                $custom_template = $theme_dir . '/woocommerce-custom/page-shop-custom.php';
     144
     145                // Custom Cart page
     146        } elseif ( function_exists( 'is_cart' ) && is_cart() ) {
     147                $custom_template = $theme_dir . '/woocommerce-custom/page-cart-custom.php';
     148
     149                // Checkout and order-received pages
     150        } elseif ( function_exists( 'is_checkout' ) && is_checkout() ) {
     151
     152                if ( function_exists( 'is_order_received_page' ) && is_order_received_page() ) {
     153                        $custom_template = $theme_dir . '/woocommerce-custom/page-order-received-custom.php';
     154                } else {
     155                        $custom_template = $theme_dir . '/woocommerce-custom/page-checkout-custom.php';
     156                }
     157
     158                // WooCommerce product category archives
     159        } elseif ( function_exists( 'is_category' ) && is_category() ) {
     160                $custom_template = $theme_dir . '/templates/category-recent-blog.php';
     161
     162        } else {
     163                return $template;
     164        }
     165
     166        if ( isset( $custom_template ) && file_exists( $custom_template ) ) {
     167                return $custom_template;
     168        }
     169
     170        return $template;
    169171}
    170172
    … …  
    183185
    184186        $fields = array(
    185                 'nestora_designer_name' => array(
     187                'nestora_designer_name'    => array(
    186188                        'label'   => __( 'Designer Name', 'nestora' ),
    187189                        'default' => 'Nestora',
    188190                        'type'    => 'text',
    189191                ),
    190                 'nestora_designer_url' => array(
     192                'nestora_designer_url'     => array(
    191193                        'label'   => __( 'Designer URL', 'nestora' ),
    192194                        'default' => 'https://example.com',
    … …  
    198200                        'type'    => 'text',
    199201                ),
    200                 'nestora_distributor_url' => array(
     202                'nestora_distributor_url'  => array(
    201203                        'label'   => __( 'Distributor URL', 'nestora' ),
    202204                        'default' => 'https://example.com',
  • nestora/1.0.3/inc/functions-delta.php

    r352930 r355713  
    198198        }
    199199
    200 
    201200        /* =====================================================
    202201         * SAVE NAME
    … …  
    216215        }
    217216
    218 
    219217        /* =====================================================
    220218         * SAVE DESIGNATION
    … …  
    234232        }
    235233
    236 
    237234        /* =====================================================
    238235         * AUTOMATICALLY ASSIGN TESTIMONIAL CATEGORY
    … …  
    270267                return;
    271268        }
    272 
    273269
    274270        $dummy_testimonials = array(
    … …  
    300296        );
    301297
    302 
    303298        require_once ABSPATH . 'wp-admin/includes/file.php';
    304299        require_once ABSPATH . 'wp-admin/includes/media.php';
    305300        require_once ABSPATH . 'wp-admin/includes/image.php';
    306301
    307        
    308302        global $wp_filesystem;
    309        
     303
    310304        if ( ! $wp_filesystem ) {
    311305                require_once ABSPATH . 'wp-admin/includes/file.php';
    312        
     306
    313307                WP_Filesystem();
    314308        }
    315        
     309
    316310        foreach ( $dummy_testimonials as $testimonial ) {
    317311
    … …  
    329323                );
    330324
    331 
    332325                /*
    333326                 * If already exists, make sure
    … …  
    358351                        continue;
    359352                }
    360 
    361353
    362354                /*
    … …  
    374366                );
    375367
    376 
    377368                if ( is_wp_error( $post_id ) ) {
    378369                        continue;
    379370                }
    380 
    381371
    382372                /*
    … …  
    389379                );
    390380
    391 
    392381                /*
    393382                 * Save name.
    … …  
    399388                );
    400389
    401 
    402390                /*
    403391                 * Save designation.
    … …  
    409397                );
    410398
    411                
    412                
    413                
    414399                if ( ! $wp_filesystem->put_contents( $file_path, $image_data, FS_CHMOD_FILE ) ) {
    415400                        continue;
    … …  
    420405                }
    421406
    422 
    423407                /*
    424408                 * Upload directory.
    … …  
    430414                }
    431415
    432 
    433416                /*
    434417                 * Read image.
    435418                 */
    436419                $image_data =
    437                         file_get_contents(
     420                        file_get_contents( // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local file path.
    438421                                $image_path
    439422                        );
    … …  
    442425                        continue;
    443426                }
    444 
    445427
    446428                /*
    … …  
    453435                        );
    454436
    455 
    456437                $file_path =
    457438                        $upload_dir['path'] .
    … …  
    459440                        $filename;
    460441
    461 
    462442                /*
    463443                 * Save image.
    464444                 */
    465445                $saved = false;
    466                 if (  $wp_filesystem ) {
    467                                
     446                if ( $wp_filesystem ) {
     447
    468448                        $saved = $wp_filesystem->put_contents(
    469449                                $file_path,
    … …  
    471451                                FS_CHMOD_FILE
    472452                        );
    473                        
     453
    474454                }
    475455
    … …  
    477457                        continue;
    478458                }
    479 
    480459
    481460                /*
    … …  
    488467                        );
    489468
    490 
    491469                /*
    492470                 * Attachment.
    … …  
    496474                                $filetype['type'],
    497475
    498                         'post_title' =>
     476                        'post_title'     =>
    499477                                sanitize_text_field(
    500478                                        $testimonial['name']
    501479                                ),
    502480
    503                         'post_content' => '',
    504 
    505                         'post_status' => 'inherit',
    506                 );
    507 
     481                        'post_content'   => '',
     482
     483                        'post_status'    => 'inherit',
     484                );
    508485
    509486                $attachment_id =
    … …  
    513490                                $post_id
    514491                        );
    515 
    516492
    517493                if (
    … …  
    524500                }
    525501
    526 
    527502                /*
    528503                 * Generate metadata.
    … …  
    534509                        );
    535510
    536 
    537511                wp_update_attachment_metadata(
    538512                        $attachment_id,
    … …  
    540514                );
    541515
    542 
    543516                /*
    544517                 * Set featured image.
    … …  
    566539        }
    567540
    568 
    569541        nestora_create_dummy_testimonials();
    570 
    571542
    572543        update_option(
    … …  
    599570        }
    600571
    601 
    602572        $category_id =
    603573                nestora_create_testimonial_category();
    … …  
    606576                return;
    607577        }
    608 
    609578
    610579        $testimonial_names = array(
    … …  
    613582                'Sarah Williams',
    614583        );
    615 
    616584
    617585        foreach ( $testimonial_names as $name ) {
    … …  
    627595                );
    628596
    629 
    630597                foreach ( $posts as $post_id ) {
    631598
    … …  
    638605        }
    639606
    640 
    641607        update_option(
    642608                'nestora_testimonial_category_fixed',
    … …  
    656622function nestora_enqueue_single_product_styles() {
    657623
    658     // Single product page CSS.
    659     if ( function_exists( 'is_product' ) && is_product() ) {
    660 
    661         wp_enqueue_style(
    662             'nestora-single-product',
    663             get_template_directory_uri() . '/assets/css/product.css',
    664             array(),
    665             wp_get_theme()->get( 'Version' )
    666         );
    667 
    668     }
    669 
    670     // WooCommerce Shop page CSS.
    671     if ( function_exists( 'is_shop' ) && is_shop() ) {
    672 
    673         wp_enqueue_style(
    674             'nestora-shop',
    675             get_template_directory_uri() . '/assets/css/shop.css',
    676             array(),
    677             wp_get_theme()->get( 'Version' )
    678         );
    679 
    680     }
    681 
     624        // Single product page CSS.
     625        if ( function_exists( 'is_product' ) && is_product() ) {
     626
     627                wp_enqueue_style(
     628                        'nestora-single-product',
     629                        get_template_directory_uri() . '/assets/css/product.css',
     630                        array(),
     631                        wp_get_theme()->get( 'Version' )
     632                );
     633
     634        }
     635
     636        // WooCommerce Shop page CSS.
     637        if ( function_exists( 'is_shop' ) && is_shop() ) {
     638
     639                wp_enqueue_style(
     640                        'nestora-shop',
     641                        get_template_directory_uri() . '/assets/css/shop.css',
     642                        array(),
     643                        wp_get_theme()->get( 'Version' )
     644                );
     645
     646        }
    682647}
    683648add_action( 'wp_enqueue_scripts', 'nestora_enqueue_single_product_styles' );
    … …  
    689654function nestora_social_media_customizer( $wp_customize ) {
    690655
    691     // Social media section.
    692     $wp_customize->add_section(
    693         'nestora_social_media_section',
    694         array(
    695             'title'       => __( 'Social Media Links', 'nestora' ),
    696             'description' => __( 'Manage the social media icons and links displayed in your footer.', 'nestora' ),
    697             'priority'    => 160,
    698         )
    699     );
    700 
    701     // Supported social platforms.
    702     $social_platforms = array(
    703         'facebook' => array(
    704             'label'   => __( 'Facebook URL', 'nestora' ),
    705             'default' => '',
    706         ),
    707         'twitter' => array(
    708             'label'   => __( 'Twitter / X URL', 'nestora' ),
    709             'default' => '',
    710         ),
    711         'instagram' => array(
    712             'label'   => __( 'Instagram URL', 'nestora' ),
    713             'default' => '',
    714         ),
    715         'linkedin' => array(
    716             'label'   => __( 'LinkedIn URL', 'nestora' ),
    717             'default' => '',
    718         ),
    719     );
    720 
    721     foreach ( $social_platforms as $platform => $data ) {
    722 
    723         $setting_id = 'nestora_social_' . $platform;
    724 
    725         $wp_customize->add_setting(
    726             $setting_id,
    727             array(
    728                 'default'           => $data['default'],
    729                 'sanitize_callback' => 'esc_url_raw',
    730                 'transport'         => 'refresh',
    731             )
    732         );
    733 
    734         $wp_customize->add_control(
    735             $setting_id,
    736             array(
    737                 'label'       => $data['label'],
    738                 'section'     => 'nestora_social_media_section',
    739                 'type'        => 'url',
    740                 'input_attrs' => array(
    741                     'placeholder' => 'https://',
    742                 ),
    743             )
    744         );
    745     }
     656        // Social media section.
     657        $wp_customize->add_section(
     658                'nestora_social_media_section',
     659                array(
     660                        'title'       => __( 'Social Media Links', 'nestora' ),
     661                        'description' => __( 'Manage the social media icons and links displayed in your footer.', 'nestora' ),
     662                        'priority'    => 160,
     663                )
     664        );
     665
     666        // Supported social platforms.
     667        $social_platforms = array(
     668                'facebook' => array(
     669                        'label'   => __( 'Facebook URL', 'nestora' ),
     670                        'default' => '',
     671                ),
     672                'twitter'  => array(
     673                        'label'   => __( 'Twitter / X URL', 'nestora' ),
     674                        'default' => '',
     675                ),
     676                'instagram' => array(
     677                        'label'   => __( 'Instagram URL', 'nestora' ),
     678                        'default' => '',
     679                ),
     680                'linkedin' => array(
     681                        'label'   => __( 'LinkedIn URL', 'nestora' ),
     682                        'default' => '',
     683                ),
     684        );
     685
     686        foreach ( $social_platforms as $platform => $data ) {
     687
     688                $setting_id = 'nestora_social_' . $platform;
     689
     690                $wp_customize->add_setting(
     691                        $setting_id,
     692                        array(
     693                                'default'           => $data['default'],
     694                                'sanitize_callback' => 'esc_url_raw',
     695                                'transport'         => 'refresh',
     696                        )
     697                );
     698
     699                $wp_customize->add_control(
     700                        $setting_id,
     701                        array(
     702                                'label'       => $data['label'],
     703                                'section'     => 'nestora_social_media_section',
     704                                'type'        => 'url',
     705                                'input_attrs' => array(
     706                                        'placeholder' => 'https://',
     707                                ),
     708                        )
     709                );
     710        }
    746711}
    747712add_action( 'customize_register', 'nestora_social_media_customizer' );
    … …  
    761726function nestora_handle_newsletter_subscription() {
    762727
    763     $redirect_url = wp_get_referer();
    764 
    765     if ( ! $redirect_url ) {
    766         $redirect_url = home_url( '/' );
    767     }
    768 
    769     $redirect_url = remove_query_arg(
    770         'newsletter_status',
    771         $redirect_url
    772     );
    773 
    774     $redirect_url = strtok( $redirect_url, '#' );
    775 
    776     $redirect_with_status = function ( $status ) use ( $redirect_url ) {
    777         $url = add_query_arg(
    778             'newsletter_status',
    779             $status,
    780             $redirect_url
    781         );
    782 
    783         wp_safe_redirect( $url . '#newsletter' );
    784         exit;
    785     };
    786 
    787     // Verify form security.
    788     if (
    789         ! isset( $_POST['nestora_newsletter_nonce'] ) ||
    790         ! wp_verify_nonce(
    791             sanitize_text_field(
    792                 wp_unslash( $_POST['nestora_newsletter_nonce'] )
    793             ),
    794             'nestora_newsletter_subscribe'
    795         )
    796     ) {
    797         $redirect_with_status( 'error' );
    798     }
    799 
    800     // Reject honeypot submissions.
    801     if ( ! empty( $_POST['nestora_newsletter_website'] ) ) {
    802         $redirect_with_status( 'error' );
    803     }
    804 
    805     // Sanitize submitted fields.
    806     $name = isset( $_POST['nestora_newsletter_name'] )
    807         ? sanitize_text_field(
    808             wp_unslash( $_POST['nestora_newsletter_name'] )
    809         )
    810         : '';
    811 
    812     $email = isset( $_POST['nestora_newsletter_email'] )
    813         ? sanitize_email(
    814             wp_unslash( $_POST['nestora_newsletter_email'] )
    815         )
    816         : '';
    817 
    818     if (
    819         '' === $name ||
    820         strlen( $name ) > 100 ||
    821         ! is_email( $email ) ||
    822         strlen( $email ) > 254
    823     ) {
    824         $redirect_with_status( 'invalid' );
    825     }
    826 
    827     $email_key = strtolower( $email );
    828 
    829     // Read subscribers from WordPress options.
    830     $subscribers = get_option(
    831         'nestora_newsletter_subscribers',
    832         array()
    833     );
    834 
    835     if ( ! is_array( $subscribers ) ) {
    836         $subscribers = array();
    837     }
    838 
    839     // Prevent duplicate subscriptions.
    840     if ( isset( $subscribers[ $email_key ] ) ) {
    841         $redirect_with_status( 'exists' );
    842     }
    843 
    844     // Save subscriber.
    845     $subscribers[ $email_key ] = array(
    846         'name'  => $name,
    847         'email' => $email,
    848         'date'  => current_time( 'timestamp', true ),
    849     );
    850 
    851     update_option(
    852         'nestora_newsletter_subscribers',
    853         $subscribers,
    854         false
    855     );
    856 
    857     // Confirm the record was stored.
    858     $saved = get_option(
    859         'nestora_newsletter_subscribers',
    860         array()
    861     );
    862 
    863     if (
    864         ! is_array( $saved ) ||
    865         ! isset( $saved[ $email_key ] )
    866     ) {
    867         $redirect_with_status( 'error' );
    868     }
    869 
    870     // Notify administrator.
    871     $admin_email = sanitize_email(
    872         get_option( 'admin_email' )
    873     );
    874 
    875     $admin_message  = "A new newsletter subscription was received.\n\n";
    876     $admin_message .= 'Name: ' . $name . "\n";
    877     $admin_message .= 'Email: ' . $email . "\n";
    878 
    879     $admin_sent = wp_mail(
    880         $admin_email,
    881         'New newsletter subscriber: ' . $name,
    882         $admin_message
    883     );
    884 
    885     // Confirm subscription to the visitor.
    886     $subscriber_message  = "Hello {$name},\n\n";
    887     $subscriber_message .= "Thank you for subscribing to our newsletter.\n\n";
    888     $subscriber_message .= get_bloginfo( 'name' );
    889 
    890     $subscriber_sent = wp_mail(
    891         $email,
    892         'Newsletter subscription confirmed',
    893         $subscriber_message
    894     );
    895 
    896     if ( $admin_sent && $subscriber_sent ) {
    897         $redirect_with_status( 'success' );
    898     }
    899 
    900     // Subscriber remains saved if email delivery fails.
    901     $redirect_with_status( 'email_error' );
     728        $redirect_url = wp_get_referer();
     729
     730        if ( ! $redirect_url ) {
     731                $redirect_url = home_url( '/' );
     732        }
     733
     734        $redirect_url = remove_query_arg(
     735                'newsletter_status',
     736                $redirect_url
     737        );
     738
     739        $redirect_url = strtok( $redirect_url, '#' );
     740
     741        $redirect_with_status = function ( $status ) use ( $redirect_url ) {
     742                $url = add_query_arg(
     743                        'newsletter_status',
     744                        $status,
     745                        $redirect_url
     746                );
     747
     748                wp_safe_redirect( $url . '#newsletter' );
     749                exit;
     750        };
     751
     752        // Verify form security.
     753        if (
     754                ! isset( $_POST['nestora_newsletter_nonce'] ) ||
     755                ! wp_verify_nonce(
     756                        sanitize_text_field(
     757                                wp_unslash( $_POST['nestora_newsletter_nonce'] )
     758                        ),
     759                        'nestora_newsletter_subscribe'
     760                )
     761        ) {
     762                $redirect_with_status( 'error' );
     763        }
     764
     765        // Reject honeypot submissions.
     766        if ( ! empty( $_POST['nestora_newsletter_website'] ) ) {
     767                $redirect_with_status( 'error' );
     768        }
     769
     770        // Sanitize submitted fields.
     771        $name = isset( $_POST['nestora_newsletter_name'] )
     772                ? sanitize_text_field(
     773                        wp_unslash( $_POST['nestora_newsletter_name'] )
     774                )
     775                : '';
     776
     777        $email = isset( $_POST['nestora_newsletter_email'] )
     778                ? sanitize_email(
     779                        wp_unslash( $_POST['nestora_newsletter_email'] )
     780                )
     781                : '';
     782
     783        if (
     784                '' === $name ||
     785                strlen( $name ) > 100 ||
     786                ! is_email( $email ) ||
     787                strlen( $email ) > 254
     788        ) {
     789                $redirect_with_status( 'invalid' );
     790        }
     791
     792        $email_key = strtolower( $email );
     793
     794        // Read subscribers from WordPress options.
     795        $subscribers = get_option(
     796                'nestora_newsletter_subscribers',
     797                array()
     798        );
     799
     800        if ( ! is_array( $subscribers ) ) {
     801                $subscribers = array();
     802        }
     803
     804        // Prevent duplicate subscriptions.
     805        if ( isset( $subscribers[ $email_key ] ) ) {
     806                $redirect_with_status( 'exists' );
     807        }
     808
     809        // Save subscriber.
     810        $subscribers[ $email_key ] = array(
     811                'name'  => $name,
     812                'email' => $email,
     813                'date'  => time(),
     814        );
     815
     816        update_option(
     817                'nestora_newsletter_subscribers',
     818                $subscribers,
     819                false
     820        );
     821
     822        // Confirm the record was stored.
     823        $saved = get_option(
     824                'nestora_newsletter_subscribers',
     825                array()
     826        );
     827
     828        if (
     829                ! is_array( $saved ) ||
     830                ! isset( $saved[ $email_key ] )
     831        ) {
     832                $redirect_with_status( 'error' );
     833        }
     834
     835        // Notify administrator.
     836        $admin_email = sanitize_email(
     837                get_option( 'admin_email' )
     838        );
     839
     840        $admin_message  = "A new newsletter subscription was received.\n\n";
     841        $admin_message .= 'Name: ' . $name . "\n";
     842        $admin_message .= 'Email: ' . $email . "\n";
     843
     844        $admin_sent = wp_mail(
     845                $admin_email,
     846                'New newsletter subscriber: ' . $name,
     847                $admin_message
     848        );
     849
     850        // Confirm subscription to the visitor.
     851        $subscriber_message  = "Hello {$name},\n\n";
     852        $subscriber_message .= "Thank you for subscribing to our newsletter.\n\n";
     853        $subscriber_message .= get_bloginfo( 'name' );
     854
     855        $subscriber_sent = wp_mail(
     856                $email,
     857                'Newsletter subscription confirmed',
     858                $subscriber_message
     859        );
     860
     861        if ( $admin_sent && $subscriber_sent ) {
     862                $redirect_with_status( 'success' );
     863        }
     864
     865        // Subscriber remains saved if email delivery fails.
     866        $redirect_with_status( 'email_error' );
    902867}
    903868
    904869add_action(
    905     'admin_post_nopriv_nestora_newsletter_subscribe',
    906     'nestora_handle_newsletter_subscription'
     870        'admin_post_nopriv_nestora_newsletter_subscribe',
     871        'nestora_handle_newsletter_subscription'
    907872);
    908873
    909874add_action(
    910     'admin_post_nestora_newsletter_subscribe',
    911     'nestora_handle_newsletter_subscription'
     875        'admin_post_nestora_newsletter_subscribe',
     876        'nestora_handle_newsletter_subscription'
    912877);
    913878
    … …  
    917882if ( class_exists( 'WP_Customize_Control' ) ) {
    918883
    919     class Delta_Newsletter_Subscribers_Control extends WP_Customize_Control {
    920 
    921         public $type = 'nestora_newsletter_subscribers';
    922 
    923         public function render_content() {
    924 
    925             if ( ! current_user_can( 'manage_options' ) ) {
    926                 return;
    927             }
    928 
    929             $subscribers = get_option(
    930                 'nestora_newsletter_subscribers',
    931                 array()
    932             );
    933 
    934             if ( ! is_array( $subscribers ) ) {
    935                 $subscribers = array();
    936             }
    937 
    938             uasort(
    939                 $subscribers,
    940                 function ( $a, $b ) {
    941                     return ( $b['date'] ?? 0 ) <=> ( $a['date'] ?? 0 );
    942                 }
    943             );
    944 
    945             $export_url = wp_nonce_url(
    946                 admin_url(
    947                     'admin-post.php?action=nestora_export_newsletter_csv'
    948                 ),
    949                 'nestora_export_newsletter_csv'
    950             );
    951             ?>
    952 
    953             <div style="width:100%;">
    954 
    955                 <p>
    956                     <strong>
    957                         <?php
    958                         printf(
    959                             esc_html__( 'Total subscribers: %d', 'nestora' ),
    960                             count( $subscribers )
    961                         );
    962                         ?>
    963                     </strong>
    964                 </p>
    965 
    966                 <p>
    967                     <a
    968                         class="button button-primary"
    969                         href="<?php echo esc_url( $export_url ); ?>"
    970                         target="_blank"
    971                     >
    972                         <?php esc_html_e( 'Export CSV', 'nestora' ); ?>
    973                     </a>
    974                 </p>
    975 
    976                 <?php if ( empty( $subscribers ) ) : ?>
    977 
    978                     <p><?php esc_html_e( 'No subscribers yet.', 'nestora' ); ?></p>
    979 
    980                 <?php else : ?>
    981 
    982                     <div style="max-height:350px;overflow-y:auto;">
    983 
    984                         <?php foreach ( $subscribers as $subscriber ) : ?>
    985 
    986                             <div style="padding:10px 0;border-bottom:1px solid #ddd;">
    987 
    988                                 <strong>
    989                                     <?php
    990                                     echo esc_html(
    991                                         $subscriber['name'] ?? ''
    992                                     );
    993                                     ?>
    994                                 </strong>
    995 
    996                                 <p style="margin:4px 0;word-break:break-word;">
    997                                     <?php
    998                                     echo esc_html(
    999                                         $subscriber['email'] ?? ''
    1000                                     );
    1001                                     ?>
    1002                                 </p>
    1003 
    1004                                 <?php
    1005                                 $timestamp = absint(
    1006                                     $subscriber['date'] ?? 0
    1007                                 );
    1008 
    1009                                 if ( $timestamp ) :
    1010                                     ?>
    1011                                     <small>
    1012                                         <?php
    1013                                         echo esc_html(
    1014                                             wp_date(
    1015                                                 get_option( 'date_format' ) .
    1016                                                 ' ' .
    1017                                                 get_option( 'time_format' ),
    1018                                                 $timestamp
    1019                                             )
    1020                                         );
    1021                                         ?>
    1022                                     </small>
    1023                                 <?php endif; ?>
    1024 
    1025                             </div>
    1026 
    1027                         <?php endforeach; ?>
    1028 
    1029                     </div>
    1030 
    1031                 <?php endif; ?>
    1032 
    1033 
    1034             </div>
    1035 
    1036             <?php
    1037         }
    1038     }
     884        class Nestora_Newsletter_Subscribers_Control extends WP_Customize_Control {
     885
     886                public $type = 'nestora_newsletter_subscribers';
     887
     888                public function render_content() {
     889
     890                        if ( ! current_user_can( 'manage_options' ) ) {
     891                                return;
     892                        }
     893
     894                        $subscribers = get_option(
     895                                'nestora_newsletter_subscribers',
     896                                array()
     897                        );
     898
     899                        if ( ! is_array( $subscribers ) ) {
     900                                $subscribers = array();
     901                        }
     902
     903                        uasort(
     904                                $subscribers,
     905                                function ( $a, $b ) {
     906                                        return ( $b['date'] ?? 0 ) <=> ( $a['date'] ?? 0 );
     907                                }
     908                        );
     909
     910                        $export_url = wp_nonce_url(
     911                                admin_url(
     912                                        'admin-post.php?action=nestora_export_newsletter_csv'
     913                                ),
     914                                'nestora_export_newsletter_csv'
     915                        );
     916                        ?>
     917
     918                        <div style="width:100%;">
     919
     920                                <p>
     921                                        <strong>
     922                                                <?php
     923                                                printf(
     924                                                        /* translators: %d: number of subscribers. */
     925                                                        esc_html__( 'Total subscribers: %d', 'nestora' ),
     926                                                        count( $subscribers )
     927                                                );
     928                                                ?>
     929                                        </strong>
     930                                </p>
     931
     932                                <p>
     933                                        <a
     934                                                class="button button-primary"
     935                                                href="<?php echo esc_url( $export_url ); ?>"
     936                                                target="_blank"
     937                                        >
     938                                                <?php esc_html_e( 'Export CSV', 'nestora' ); ?>
     939                                        </a>
     940                                </p>
     941
     942                                <?php if ( empty( $subscribers ) ) : ?>
     943
     944                                        <p><?php esc_html_e( 'No subscribers yet.', 'nestora' ); ?></p>
     945
     946                                <?php else : ?>
     947
     948                                        <div style="max-height:350px;overflow-y:auto;">
     949
     950                                                <?php foreach ( $subscribers as $subscriber ) : ?>
     951
     952                                                        <div style="padding:10px 0;border-bottom:1px solid #ddd;">
     953
     954                                                                <strong>
     955                                                                        <?php
     956                                                                        echo esc_html(
     957                                                                                $subscriber['name'] ?? ''
     958                                                                        );
     959                                                                        ?>
     960                                                                </strong>
     961
     962                                                                <p style="margin:4px 0;word-break:break-word;">
     963                                                                        <?php
     964                                                                        echo esc_html(
     965                                                                                $subscriber['email'] ?? ''
     966                                                                        );
     967                                                                        ?>
     968                                                                </p>
     969
     970                                                                <?php
     971                                                                $timestamp = absint(
     972                                                                        $subscriber['date'] ?? 0
     973                                                                );
     974
     975                                                                if ( $timestamp ) :
     976                                                                        ?>
     977                                                                        <small>
     978                                                                                <?php
     979                                                                                echo esc_html(
     980                                                                                        wp_date(
     981                                                                                                get_option( 'date_format' ) .
     982                                                                                                ' ' .
     983                                                                                                get_option( 'time_format' ),
     984                                                                                                $timestamp
     985                                                                                        )
     986                                                                                );
     987                                                                                ?>
     988                                                                        </small>
     989                                                                <?php endif; ?>
     990
     991                                                        </div>
     992
     993                                                <?php endforeach; ?>
     994
     995                                        </div>
     996
     997                                <?php endif; ?>
     998
     999
     1000                        </div>
     1001
     1002                        <?php
     1003                }
     1004        }
    10391005}
    10401006
    … …  
    10441010function nestora_newsletter_customize_register( $wp_customize ) {
    10451011
    1046     if ( ! current_user_can( 'manage_options' ) ) {
    1047         return;
    1048     }
    1049 
    1050     $wp_customize->add_section(
    1051         'nestora_newsletter_subscribers_section',
    1052         array(
    1053             'title'       => __( 'Newsletter Subscribers', 'nestora' ),
    1054             'description' => __( 'View and export saved newsletter subscribers.', 'nestora' ),
    1055             'priority'    => 200,
    1056         )
    1057     );
    1058 
    1059     $wp_customize->add_setting(
    1060         'nestora_newsletter_subscribers_display',
    1061         array(
    1062             'default'           => '',
    1063             'sanitize_callback' => 'sanitize_text_field',
    1064         )
    1065     );
    1066 
    1067     $wp_customize->add_control(
    1068         new Delta_Newsletter_Subscribers_Control(
    1069             $wp_customize,
    1070             'nestora_newsletter_subscribers_display',
    1071             array(
    1072                 'label'    => __( 'Saved Subscribers', 'nestora' ),
    1073                 'section'  => 'nestora_newsletter_subscribers_section',
    1074                 'settings' => 'nestora_newsletter_subscribers_display',
    1075             )
    1076         )
    1077     );
     1012        if ( ! current_user_can( 'manage_options' ) ) {
     1013                return;
     1014        }
     1015
     1016        $wp_customize->add_section(
     1017                'nestora_newsletter_subscribers_section',
     1018                array(
     1019                        'title'       => __( 'Newsletter Subscribers', 'nestora' ),
     1020                        'description' => __( 'View and export saved newsletter subscribers.', 'nestora' ),
     1021                        'priority'    => 200,
     1022                )
     1023        );
     1024
     1025        $wp_customize->add_setting(
     1026                'nestora_newsletter_subscribers_display',
     1027                array(
     1028                        'default'           => '',
     1029                        'sanitize_callback' => 'sanitize_text_field',
     1030                )
     1031        );
     1032
     1033        $wp_customize->add_control(
     1034                new Nestora_Newsletter_Subscribers_Control(
     1035                        $wp_customize,
     1036                        'nestora_newsletter_subscribers_display',
     1037                        array(
     1038                                'label'    => __( 'Saved Subscribers', 'nestora' ),
     1039                                'section'  => 'nestora_newsletter_subscribers_section',
     1040                                'settings' => 'nestora_newsletter_subscribers_display',
     1041                        )
     1042                )
     1043        );
    10781044}
    10791045
    10801046add_action(
    1081     'customize_register',
    1082     'nestora_newsletter_customize_register'
     1047        'customize_register',
     1048        'nestora_newsletter_customize_register'
    10831049);
    10841050
    … …  
    10881054function nestora_export_newsletter_csv() {
    10891055
    1090     if ( ! current_user_can( 'manage_options' ) ) {
    1091         wp_die(
    1092             esc_html__(
    1093                 'You do not have permission to export subscribers.',
    1094                 'nestora'
    1095             )
    1096         );
    1097     }
    1098 
    1099     check_admin_referer( 'nestora_export_newsletter_csv' );
    1100 
    1101     $subscribers = get_option(
    1102         'nestora_newsletter_subscribers',
    1103         array()
    1104     );
    1105 
    1106     if ( ! is_array( $subscribers ) ) {
    1107         $subscribers = array();
    1108     }
    1109 
    1110     $csv_output = '"Name","Email","Subscription Date"' . "\r\n";
    1111 
    1112     foreach ( $subscribers as $subscriber ) {
    1113 
    1114         $timestamp = absint( $subscriber['date'] ?? 0 );
    1115 
    1116         $row = array(
    1117             $subscriber['name'] ?? '',
    1118             $subscriber['email'] ?? '',
    1119             $timestamp
    1120                 ? wp_date( 'Y-m-d H:i:s', $timestamp )
    1121                 : '',
    1122         );
    1123 
    1124         $fields = array();
    1125 
    1126         foreach ( $row as $field ) {
    1127 
    1128             $field = (string) $field;
    1129 
    1130             // Reduce spreadsheet formula-injection risk.
    1131             if ( preg_match( '/^[\s]*[=+\-@]/', $field ) ) {
    1132                 $field = "'" . $field;
    1133             }
    1134 
    1135             $field = str_replace( '"', '""', $field );
    1136 
    1137             $fields[] = '"' . $field . '"';
    1138         }
    1139 
    1140         $csv_output .= implode( ',', $fields ) . "\r\n";
    1141     }
    1142 
    1143     nocache_headers();
    1144 
    1145     header( 'Content-Type: text/csv; charset=utf-8' );
    1146     header(
    1147         'Content-Disposition: attachment; filename=newsletter-subscribers.csv'
    1148     );
    1149 
    1150     echo "\xEF\xBB\xBF";
    1151     echo $csv_output;
    1152     exit;
     1056        if ( ! current_user_can( 'manage_options' ) ) {
     1057                wp_die(
     1058                        esc_html__(
     1059                                'You do not have permission to export subscribers.',
     1060                                'nestora'
     1061                        )
     1062                );
     1063        }
     1064
     1065        check_admin_referer( 'nestora_export_newsletter_csv' );
     1066
     1067        $subscribers = get_option(
     1068                'nestora_newsletter_subscribers',
     1069                array()
     1070        );
     1071
     1072        if ( ! is_array( $subscribers ) ) {
     1073                $subscribers = array();
     1074        }
     1075
     1076        $csv_output = '"Name","Email","Subscription Date"' . "\r\n";
     1077
     1078        foreach ( $subscribers as $subscriber ) {
     1079
     1080                $timestamp = absint( $subscriber['date'] ?? 0 );
     1081
     1082                $row = array(
     1083                        $subscriber['name'] ?? '',
     1084                        $subscriber['email'] ?? '',
     1085                        $timestamp
     1086                                ? wp_date( 'Y-m-d H:i:s', $timestamp )
     1087                                : '',
     1088                );
     1089
     1090                $fields = array();
     1091
     1092                foreach ( $row as $field ) {
     1093
     1094                        $field = (string) $field;
     1095
     1096                        // Reduce spreadsheet formula-injection risk.
     1097                        if ( preg_match( '/^[\s]*[=+\-@]/', $field ) ) {
     1098                                $field = "'" . $field;
     1099                        }
     1100
     1101                        $field = str_replace( '"', '""', $field );
     1102
     1103                        $fields[] = '"' . $field . '"';
     1104                }
     1105
     1106                $csv_output .= implode( ',', $fields ) . "\r\n";
     1107        }
     1108
     1109        nocache_headers();
     1110
     1111        header( 'Content-Type: text/csv; charset=utf-8' );
     1112        header(
     1113                'Content-Disposition: attachment; filename=newsletter-subscribers.csv'
     1114        );
     1115
     1116        echo "\xEF\xBB\xBF";
     1117        echo $csv_output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- CSV download, fields are escaped above.
     1118        exit;
    11531119}
    11541120
    11551121add_action(
    1156     'admin_post_nestora_export_newsletter_csv',
    1157     'nestora_export_newsletter_csv'
     1122        'admin_post_nestora_export_newsletter_csv',
     1123        'nestora_export_newsletter_csv'
    11581124);
    11591125
  • nestora/1.0.3/inc/functions-epsilon.php

    r352928 r355713  
    55
    66if ( ! defined( 'ABSPATH' ) ) {
    7     exit;
     7        exit;
    88}
    99
    … …  
    1313function nestora_register_hero_settings() {
    1414
    15     register_setting(
    16         'nestora_hero_group',
    17         'nestora_hero_settings',
    18         array(
    19             'sanitize_callback' => 'nestora_sanitize_hero_settings',
    20             'default'           => array(),
    21         )
    22     );
    23 
    24     add_theme_page(
    25         esc_html__( 'Nestora Hero', 'nestora' ),
    26         esc_html__( 'Nestora Hero', 'nestora' ),
    27         'edit_theme_options',
    28         'nestora-hero',
    29         'nestora_hero_settings_page'
    30     );
     15        register_setting(
     16                'nestora_hero_group',
     17                'nestora_hero_settings',
     18                array(
     19                        'sanitize_callback' => 'nestora_sanitize_hero_settings',
     20                        'default'           => array(),
     21                )
     22        );
     23
     24        add_theme_page(
     25                esc_html__( 'Nestora Hero', 'nestora' ),
     26                esc_html__( 'Nestora Hero', 'nestora' ),
     27                'edit_theme_options',
     28                'nestora-hero',
     29                'nestora_hero_settings_page'
     30        );
    3131}
    3232add_action( 'admin_menu', 'nestora_register_hero_settings' );
    … …  
    3737function nestora_sanitize_hero_settings( $input ) {
    3838
    39     $output = array();
    40 
    41     if ( ! is_array( $input ) ) {
    42         return $output;
    43     }
    44 
    45     $text_fields = array(
    46         'title',
    47         'subtitle',
    48         'description',
    49         'button1_text',
    50         'button2_text',
    51     );
    52 
    53     foreach ( $text_fields as $field ) {
    54         $output[ $field ] = isset( $input[ $field ] )
    55             ? sanitize_text_field( $input[ $field ] )
    56             : '';
    57     }
    58 
    59     $output['button1_url'] = isset( $input['button1_url'] )
    60         ? esc_url_raw( $input['button1_url'] )
    61         : '';
    62 
    63     $output['button2_url'] = isset( $input['button2_url'] )
    64         ? esc_url_raw( $input['button2_url'] )
    65         : '';
    66 
    67     $output['images'] = array();
    68 
    69     if ( isset( $input['images'] ) && is_array( $input['images'] ) ) {
    70         foreach ( $input['images'] as $image_id ) {
    71             $image_id = absint( $image_id );
    72 
    73             if (
    74                 $image_id &&
    75                 wp_attachment_is_image( $image_id )
    76             ) {
    77                 $output['images'][] = $image_id;
    78             }
    79         }
    80     }
    81 
    82     return $output;
     39        $output = array();
     40
     41        if ( ! is_array( $input ) ) {
     42                return $output;
     43        }
     44
     45        $text_fields = array(
     46                'title',
     47                'subtitle',
     48                'description',
     49                'button1_text',
     50                'button2_text',
     51        );
     52
     53        foreach ( $text_fields as $field ) {
     54                $output[ $field ] = isset( $input[ $field ] )
     55                        ? sanitize_text_field( $input[ $field ] )
     56                        : '';
     57        }
     58
     59        $output['button1_url'] = isset( $input['button1_url'] )
     60                ? esc_url_raw( $input['button1_url'] )
     61                : '';
     62
     63        $output['button2_url'] = isset( $input['button2_url'] )
     64                ? esc_url_raw( $input['button2_url'] )
     65                : '';
     66
     67        $output['images'] = array();
     68
     69        if ( isset( $input['images'] ) && is_array( $input['images'] ) ) {
     70                foreach ( $input['images'] as $image_id ) {
     71                        $image_id = absint( $image_id );
     72
     73                        if (
     74                                $image_id &&
     75                                wp_attachment_is_image( $image_id )
     76                        ) {
     77                                $output['images'][] = $image_id;
     78                        }
     79                }
     80        }
     81
     82        return $output;
    8383}
    8484
    … …  
    8888function nestora_hero_admin_scripts( $hook ) {
    8989
    90     if ( 'appearance_page_nestora-hero' !== $hook ) {
    91         return;
    92     }
    93 
    94     wp_enqueue_media();
    95 
    96     wp_add_inline_script(
    97         'jquery',
    98         "
     90        if ( 'appearance_page_nestora-hero' !== $hook ) {
     91                return;
     92        }
     93
     94        wp_enqueue_media();
     95
     96        wp_add_inline_script(
     97                'jquery',
     98                "
    9999        jQuery(function($) {
    100100            var frame;
    … …  
    171171        });
    172172        "
    173     );
     173        );
    174174}
    175175add_action( 'admin_enqueue_scripts', 'nestora_hero_admin_scripts' );
    … …  
    180180function nestora_hero_settings_page() {
    181181
    182     if ( ! current_user_can( 'edit_theme_options' ) ) {
    183         return;
    184     }
    185 
    186     $defaults = array(
    187         'title'        => 'Modern Interior',
    188         'subtitle'     => 'Design Studio',
    189         'description'  => 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.',
    190         'button1_text' => 'Shop Now',
    191         'button1_url'  => '#',
    192         'button2_text' => 'Explore',
    193         'button2_url'  => '#',
    194         'images'       => array(),
    195     );
    196 
    197     $settings = get_option( 'nestora_hero_settings', array() );
    198 
    199     if ( ! is_array( $settings ) ) {
    200         $settings = array();
    201     }
    202 
    203     $settings = wp_parse_args( $settings, $defaults );
    204 
    205     $image_ids = is_array( $settings['images'] )
    206         ? array_map( 'absint', $settings['images'] )
    207         : array();
    208 
    209     $field = 'nestora_hero_settings';
    210     ?>
    211 
    212     <div class="wrap">
    213         <h1><?php esc_html_e( 'Nestora Hero Settings', 'nestora' ); ?></h1>
    214 
    215         <p>
    216             <?php
    217             esc_html_e(
    218                 'Edit your hero section text, buttons and slider images.',
    219                 'nestora'
    220             );
    221             ?>
    222         </p>
    223 
    224         <form method="post" action="options.php">
    225 
    226             <?php settings_fields( 'nestora_hero_group' ); ?>
    227 
    228             <table class="form-table">
    229 
    230                 <tr>
    231                     <th>
    232                         <label for="nestora-title">
    233                             <?php esc_html_e( 'Main Title', 'nestora' ); ?>
    234                         </label>
    235                     </th>
    236                     <td>
    237                         <input
    238                             type="text"
    239                             class="regular-text"
    240                             id="nestora-title"
    241                             name="<?php echo esc_attr( $field ); ?>[title]"
    242                             value="<?php echo esc_attr( $settings['title'] ); ?>"
    243                         >
    244                     </td>
    245                 </tr>
    246 
    247                 <tr>
    248                     <th>
    249                         <label for="nestora-subtitle">
    250                             <?php esc_html_e( 'Subtitle', 'nestora' ); ?>
    251                         </label>
    252                     </th>
    253                     <td>
    254                         <input
    255                             type="text"
    256                             class="regular-text"
    257                             id="nestora-subtitle"
    258                             name="<?php echo esc_attr( $field ); ?>[subtitle]"
    259                             value="<?php echo esc_attr( $settings['subtitle'] ); ?>"
    260                         >
    261                     </td>
    262                 </tr>
    263 
    264                 <tr>
    265                     <th>
    266                         <label for="nestora-description">
    267                             <?php esc_html_e( 'Description', 'nestora' ); ?>
    268                         </label>
    269                     </th>
    270                     <td>
    271                         <textarea
    272                             class="large-text"
    273                             rows="4"
    274                             id="nestora-description"
    275                             name="<?php echo esc_attr( $field ); ?>[description]"
    276                         ><?php echo esc_textarea( $settings['description'] ); ?></textarea>
    277                     </td>
    278                 </tr>
    279 
    280                 <tr>
    281                     <th>
    282                         <?php esc_html_e( 'First Button', 'nestora' ); ?>
    283                     </th>
    284                     <td>
    285                         <p>
    286                             <label for="nestora-button1-text">
    287                                 <?php esc_html_e( 'Button Text', 'nestora' ); ?>
    288                             </label><br>
    289                             <input
    290                                 type="text"
    291                                 class="regular-text"
    292                                 id="nestora-button1-text"
    293                                 name="<?php echo esc_attr( $field ); ?>[button1_text]"
    294                                 value="<?php echo esc_attr( $settings['button1_text'] ); ?>"
    295                             >
    296                         </p>
    297 
    298                         <p>
    299                             <label for="nestora-button1-url">
    300                                 <?php esc_html_e( 'Button URL', 'nestora' ); ?>
    301                             </label><br>
    302                             <input
    303                                 type="url"
    304                                 class="regular-text"
    305                                 id="nestora-button1-url"
    306                                 name="<?php echo esc_attr( $field ); ?>[button1_url]"
    307                                 value="<?php echo esc_attr( $settings['button1_url'] ); ?>"
    308                             >
    309                         </p>
    310                     </td>
    311                 </tr>
    312 
    313                 <tr>
    314                     <th>
    315                         <?php esc_html_e( 'Second Button', 'nestora' ); ?>
    316                     </th>
    317                     <td>
    318                         <p>
    319                             <label for="nestora-button2-text">
    320                                 <?php esc_html_e( 'Button Text', 'nestora' ); ?>
    321                             </label><br>
    322                             <input
    323                                 type="text"
    324                                 class="regular-text"
    325                                 id="nestora-button2-text"
    326                                 name="<?php echo esc_attr( $field ); ?>[button2_text]"
    327                                 value="<?php echo esc_attr( $settings['button2_text'] ); ?>"
    328                             >
    329                         </p>
    330 
    331                         <p>
    332                             <label for="nestora-button2-url">
    333                                 <?php esc_html_e( 'Button URL', 'nestora' ); ?>
    334                             </label><br>
    335                             <input
    336                                 type="url"
    337                                 class="regular-text"
    338                                 id="nestora-button2-url"
    339                                 name="<?php echo esc_attr( $field ); ?>[button2_url]"
    340                                 value="<?php echo esc_attr( $settings['button2_url'] ); ?>"
    341                             >
    342                         </p>
    343                     </td>
    344                 </tr>
    345 
    346                 <tr>
    347                     <th>
    348                         <?php esc_html_e( 'Hero Slider Images', 'nestora' ); ?>
    349                     </th>
    350                     <td>
    351                         <input
    352                             type="hidden"
    353                             id="nestora-hero-image-ids"
    354                             name="<?php echo esc_attr( $field ); ?>[images]"
    355                             value="<?php echo esc_attr( implode( ',', $image_ids ) ); ?>"
    356                         >
    357 
    358                         <button
    359                             type="button"
    360                             class="button button-secondary"
    361                             id="nestora-select-images"
    362                         >
    363                             <?php esc_html_e( 'Select Images', 'nestora' ); ?>
    364                         </button>
    365 
    366                         <button
    367                             type="button"
    368                             class="button"
    369                             id="nestora-remove-images"
    370                         >
    371                             <?php esc_html_e( 'Remove Images', 'nestora' ); ?>
    372                         </button>
    373 
    374                         <p class="description">
    375                             <?php
    376                             esc_html_e(
    377                                 'Select multiple images. They will change every two seconds. If no images are selected, the theme fallback image will be used.',
    378                                 'nestora'
    379                             );
    380                             ?>
    381                         </p>
    382 
    383                         <div id="nestora-hero-image-preview" style="margin-top:10px;">
    384                             <?php foreach ( $image_ids as $image_id ) : ?>
    385                                 <?php
    386                                 $thumbnail = wp_get_attachment_image_url(
    387                                     $image_id,
    388                                     'thumbnail'
    389                                 );
    390                                 ?>
    391                                 <?php if ( $thumbnail ) : ?>
    392                                     <img
    393                                         src="<?php echo esc_url( $thumbnail ); ?>"
    394                                         alt=""
    395                                         style="width:100px;height:80px;object-fit:cover;margin:5px;"
    396                                     >
    397                                 <?php endif; ?>
    398                             <?php endforeach; ?>
    399                         </div>
    400                     </td>
    401                 </tr>
    402 
    403             </table>
    404 
    405             <?php submit_button( __( 'Save Hero Settings', 'nestora' ) ); ?>
    406 
    407         </form>
    408     </div>
    409 
    410     <?php
     182        if ( ! current_user_can( 'edit_theme_options' ) ) {
     183                return;
     184        }
     185
     186        $defaults = array(
     187                'title'        => 'Modern Interior',
     188                'subtitle'     => 'Design Studio',
     189                'description'  => 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.',
     190                'button1_text' => 'Shop Now',
     191                'button1_url'  => '#',
     192                'button2_text' => 'Explore',
     193                'button2_url'  => '#',
     194                'images'       => array(),
     195        );
     196
     197        $settings = get_option( 'nestora_hero_settings', array() );
     198
     199        if ( ! is_array( $settings ) ) {
     200                $settings = array();
     201        }
     202
     203        $settings = wp_parse_args( $settings, $defaults );
     204
     205        $image_ids = is_array( $settings['images'] )
     206                ? array_map( 'absint', $settings['images'] )
     207                : array();
     208
     209        $field = 'nestora_hero_settings';
     210        ?>
     211
     212        <div class="wrap">
     213                <h1><?php esc_html_e( 'Nestora Hero Settings', 'nestora' ); ?></h1>
     214
     215                <p>
     216                        <?php
     217                        esc_html_e(
     218                                'Edit your hero section text, buttons and slider images.',
     219                                'nestora'
     220                        );
     221                        ?>
     222                </p>
     223
     224                <form method="post" action="options.php">
     225
     226                        <?php settings_fields( 'nestora_hero_group' ); ?>
     227
     228                        <table class="form-table">
     229
     230                                <tr>
     231                                        <th>
     232                                                <label for="nestora-title">
     233                                                        <?php esc_html_e( 'Main Title', 'nestora' ); ?>
     234                                                </label>
     235                                        </th>
     236                                        <td>
     237                                                <input
     238                                                        type="text"
     239                                                        class="regular-text"
     240                                                        id="nestora-title"
     241                                                        name="<?php echo esc_attr( $field ); ?>[title]"
     242                                                        value="<?php echo esc_attr( $settings['title'] ); ?>"
     243                                                >
     244                                        </td>
     245                                </tr>
     246
     247                                <tr>
     248                                        <th>
     249                                                <label for="nestora-subtitle">
     250                                                        <?php esc_html_e( 'Subtitle', 'nestora' ); ?>
     251                                                </label>
     252                                        </th>
     253                                        <td>
     254                                                <input
     255                                                        type="text"
     256                                                        class="regular-text"
     257                                                        id="nestora-subtitle"
     258                                                        name="<?php echo esc_attr( $field ); ?>[subtitle]"
     259                                                        value="<?php echo esc_attr( $settings['subtitle'] ); ?>"
     260                                                >
     261                                        </td>
     262                                </tr>
     263
     264                                <tr>
     265                                        <th>
     266                                                <label for="nestora-description">
     267                                                        <?php esc_html_e( 'Description', 'nestora' ); ?>
     268                                                </label>
     269                                        </th>
     270                                        <td>
     271                                                <textarea
     272                                                        class="large-text"
     273                                                        rows="4"
     274                                                        id="nestora-description"
     275                                                        name="<?php echo esc_attr( $field ); ?>[description]"
     276                                                ><?php echo esc_textarea( $settings['description'] ); ?></textarea>
     277                                        </td>
     278                                </tr>
     279
     280                                <tr>
     281                                        <th>
     282                                                <?php esc_html_e( 'First Button', 'nestora' ); ?>
     283                                        </th>
     284                                        <td>
     285                                                <p>
     286                                                        <label for="nestora-button1-text">
     287                                                                <?php esc_html_e( 'Button Text', 'nestora' ); ?>
     288                                                        </label><br>
     289                                                        <input
     290                                                                type="text"
     291                                                                class="regular-text"
     292                                                                id="nestora-button1-text"
     293                                                                name="<?php echo esc_attr( $field ); ?>[button1_text]"
     294                                                                value="<?php echo esc_attr( $settings['button1_text'] ); ?>"
     295                                                        >
     296                                                </p>
     297
     298                                                <p>
     299                                                        <label for="nestora-button1-url">
     300                                                                <?php esc_html_e( 'Button URL', 'nestora' ); ?>
     301                                                        </label><br>
     302                                                        <input
     303                                                                type="url"
     304                                                                class="regular-text"
     305                                                                id="nestora-button1-url"
     306                                                                name="<?php echo esc_attr( $field ); ?>[button1_url]"
     307                                                                value="<?php echo esc_attr( $settings['button1_url'] ); ?>"
     308                                                        >
     309                                                </p>
     310                                        </td>
     311                                </tr>
     312
     313                                <tr>
     314                                        <th>
     315                                                <?php esc_html_e( 'Second Button', 'nestora' ); ?>
     316                                        </th>
     317                                        <td>
     318                                                <p>
     319                                                        <label for="nestora-button2-text">
     320                                                                <?php esc_html_e( 'Button Text', 'nestora' ); ?>
     321                                                        </label><br>
     322                                                        <input
     323                                                                type="text"
     324                                                                class="regular-text"
     325                                                                id="nestora-button2-text"
     326                                                                name="<?php echo esc_attr( $field ); ?>[button2_text]"
     327                                                                value="<?php echo esc_attr( $settings['button2_text'] ); ?>"
     328                                                        >
     329                                                </p>
     330
     331                                                <p>
     332                                                        <label for="nestora-button2-url">
     333                                                                <?php esc_html_e( 'Button URL', 'nestora' ); ?>
     334                                                        </label><br>
     335                                                        <input
     336                                                                type="url"
     337                                                                class="regular-text"
     338                                                                id="nestora-button2-url"
     339                                                                name="<?php echo esc_attr( $field ); ?>[button2_url]"
     340                                                                value="<?php echo esc_attr( $settings['button2_url'] ); ?>"
     341                                                        >
     342                                                </p>
     343                                        </td>
     344                                </tr>
     345
     346                                <tr>
     347                                        <th>
     348                                                <?php esc_html_e( 'Hero Slider Images', 'nestora' ); ?>
     349                                        </th>
     350                                        <td>
     351                                                <input
     352                                                        type="hidden"
     353                                                        id="nestora-hero-image-ids"
     354                                                        name="<?php echo esc_attr( $field ); ?>[images]"
     355                                                        value="<?php echo esc_attr( implode( ',', $image_ids ) ); ?>"
     356                                                >
     357
     358                                                <button
     359                                                        type="button"
     360                                                        class="button button-secondary"
     361                                                        id="nestora-select-images"
     362                                                >
     363                                                        <?php esc_html_e( 'Select Images', 'nestora' ); ?>
     364                                                </button>
     365
     366                                                <button
     367                                                        type="button"
     368                                                        class="button"
     369                                                        id="nestora-remove-images"
     370                                                >
     371                                                        <?php esc_html_e( 'Remove Images', 'nestora' ); ?>
     372                                                </button>
     373
     374                                                <p class="description">
     375                                                        <?php
     376                                                        esc_html_e(
     377                                                                'Select multiple images. They will change every two seconds. If no images are selected, the theme fallback image will be used.',
     378                                                                'nestora'
     379                                                        );
     380                                                        ?>
     381                                                </p>
     382
     383                                                <div id="nestora-hero-image-preview" style="margin-top:10px;">
     384                                                        <?php foreach ( $image_ids as $image_id ) : ?>
     385                                                                <?php
     386                                                                $thumbnail = wp_get_attachment_image_url(
     387                                                                        $image_id,
     388                                                                        'thumbnail'
     389                                                                );
     390                                                                ?>
     391                                                                <?php if ( $thumbnail ) : ?>
     392                                                                        <img
     393                                                                                src="<?php echo esc_url( $thumbnail ); ?>"
     394                                                                                alt=""
     395                                                                                style="width:100px;height:80px;object-fit:cover;margin:5px;"
     396                                                                        >
     397                                                                <?php endif; ?>
     398                                                        <?php endforeach; ?>
     399                                                </div>
     400                                        </td>
     401                                </tr>
     402
     403                        </table>
     404
     405                        <?php submit_button( __( 'Save Hero Settings', 'nestora' ) ); ?>
     406
     407                </form>
     408        </div>
     409
     410        <?php
    411411}
    412412
  • nestora/1.0.3/inc/functions-essentials.php

    r352928 r355713  
    11<?php
    2         if(!function_exists('pre')){
    3                 function pre($data){
    4                         if(isset($_GET['debug'])){
    5                                 pree($data);
    6                         }
    7                 }       
    8         }
    9                
    10         if(!function_exists('pree')){
    11                 function pree($data){
    12                                 echo '<pre>';
    13                                 print_r($data);
    14                                 echo '</pre>'; 
    15                
    16                 }       
    17         }
    182        /**
    193         * Set the content width in pixels, based on the theme's design.
    204         */
    21         function nestora_content_width() {
    22                 $GLOBALS['content_width'] = apply_filters( 'nestora_content_width', 1200 );
    23         }
     5function nestora_content_width() {
     6        $GLOBALS['content_width'] = apply_filters( 'nestora_content_width', 1200 );
     7}
    248        add_action( 'after_setup_theme', 'nestora_content_width', 0 );
    259        /**
    … …  
    2812         * WordPress.org Theme Review compatibility and standard theme features.
    2913         */
    30        
    31         if ( ! function_exists( 'nestora_setup' ) ) {
    32        
    33                 /**
    34                 * Sets up theme defaults and registers support for WordPress features.
    35                 */
    36                 function nestora_setup() {
    37        
    38                         /*
    39                         * Make theme available for translation.
    40                         */
    41                         load_theme_textdomain(
    42                                 'nestora',
    43                                 get_template_directory() . '/languages'
    44                         );
    45        
    46                         /*
    47                         * Let WordPress manage the document title.
    48                         */
    49                         add_theme_support( 'title-tag' );
    50        
    51                         /*
    52                         * Enable featured images.
    53                         */
    54                         add_theme_support( 'post-thumbnails' );
    55        
    56                         /*
    57                         * Custom logo.
    58                         */
    59                         add_theme_support(
    60                                 'custom-logo',
    61                                 array(
    62                                         'height'      => 100,
    63                                         'width'       => 300,
    64                                         'flex-height' => true,
    65                                         'flex-width'  => true,
    66                                 )
    67                         );
    68        
    69                         /*
    70                         * Custom header.
    71                         */
    72                         add_theme_support(
    73                                 'custom-header',
    74                                 array(
    75                                         'width'         => 1600,
    76                                         'height'        => 300,
    77                                         'flex-width'    => true,
    78                                         'flex-height'   => true,
    79                                         'default-text-color' => '000000',
    80                                         'header-text'   => true,
    81                                 )
    82                         );
    83        
    84                         /*
    85                         * Custom background.
    86                         */
    87                         add_theme_support(
    88                                 'custom-background',
    89                                 array(
    90                                         'default-color' => 'ffffff',
    91                                 )
    92                         );
    93        
    94                         /*
    95                         * HTML5 markup support.
    96                         */
    97                         add_theme_support(
    98                                 'html5',
    99                                 array(
    100                                         'search-form',
    101                                         'comment-form',
    102                                         'comment-list',
    103                                         'gallery',
    104                                         'caption',
    105                                         'style',
    106                                         'script',
    107                                 )
    108                         );
    109        
    110                         /*
    111                         * Responsive embedded content.
    112                         */
    113                         add_theme_support( 'responsive-embeds' );
    114        
    115                         /*
    116                         * Wide and full-width blocks.
    117                         */
    118                         add_theme_support( 'align-wide' );
    119        
    120                         /*
    121                         * WordPress block styles.
    122                         */
    123                         add_theme_support( 'wp-block-styles' );
    124        
    125                         /*
    126                         * Editor styles.
    127                         */
    128                         add_theme_support( 'editor-styles' );
    129        
    130                         /*
    131                         * Let the editor use the theme stylesheet.
    132                         */
    133                         add_editor_style( 'style.css' );
    134        
    135                         /*
    136                         * Automatic feed links.
    137                         */
    138                         add_theme_support( 'automatic-feed-links' );
    139        
    140                         /*
    141                         * Register primary navigation menu.
    142                         */
    143                         register_nav_menus(
    144                                 array(
    145                                         'primary' => __( 'Primary Menu', 'nestora' ),
    146                                         'footer'  => __( 'Footer Menu', 'nestora' ),
    147                                 )
    148                         );
    149        
    150                         /*
    151                         * Selective refresh for widgets.
    152                         */
    153                         add_theme_support( 'customize-selective-refresh-widgets' );
    154                 }
    155        
    156         }
     14
     15if ( ! function_exists( 'nestora_setup' ) ) {
     16
     17        /**
     18        * Sets up theme defaults and registers support for WordPress features.
     19        */
     20        function nestora_setup() {
     21
     22                /*
     23                * Make theme available for translation.
     24                */
     25                load_theme_textdomain(
     26                        'nestora',
     27                        get_template_directory() . '/languages'
     28                );
     29
     30                /*
     31                * Let WordPress manage the document title.
     32                */
     33                add_theme_support( 'title-tag' );
     34
     35                /*
     36                * Enable featured images.
     37                */
     38                add_theme_support( 'post-thumbnails' );
     39
     40                /*
     41                * Custom logo.
     42                */
     43                add_theme_support(
     44                        'custom-logo',
     45                        array(
     46                                'height'      => 100,
     47                                'width'       => 300,
     48                                'flex-height' => true,
     49                                'flex-width'  => true,
     50                        )
     51                );
     52
     53                /*
     54                * Custom header.
     55                */
     56                add_theme_support(
     57                        'custom-header',
     58                        array(
     59                                'width'              => 1600,
     60                                'height'             => 300,
     61                                'flex-width'         => true,
     62                                'flex-height'        => true,
     63                                'default-text-color' => '000000',
     64                                'header-text'        => true,
     65                        )
     66                );
     67
     68                /*
     69                * Custom background.
     70                */
     71                add_theme_support(
     72                        'custom-background',
     73                        array(
     74                                'default-color' => 'ffffff',
     75                        )
     76                );
     77
     78                /*
     79                * HTML5 markup support.
     80                */
     81                add_theme_support(
     82                        'html5',
     83                        array(
     84                                'search-form',
     85                                'comment-form',
     86                                'comment-list',
     87                                'gallery',
     88                                'caption',
     89                                'style',
     90                                'script',
     91                        )
     92                );
     93
     94                /*
     95                * Responsive embedded content.
     96                */
     97                add_theme_support( 'responsive-embeds' );
     98
     99                /*
     100                * Wide and full-width blocks.
     101                */
     102                add_theme_support( 'align-wide' );
     103
     104                /*
     105                * WordPress block styles.
     106                */
     107                add_theme_support( 'wp-block-styles' );
     108
     109                /*
     110                * Editor styles.
     111                */
     112                add_theme_support( 'editor-styles' );
     113
     114                /*
     115                * Let the editor use the theme stylesheet.
     116                */
     117                add_editor_style( 'style.css' );
     118
     119                /*
     120                * Automatic feed links.
     121                */
     122                add_theme_support( 'automatic-feed-links' );
     123
     124                /*
     125                * Register primary navigation menu.
     126                */
     127                register_nav_menus(
     128                        array(
     129                                'primary' => __( 'Primary Menu', 'nestora' ),
     130                                'footer'  => __( 'Footer Menu', 'nestora' ),
     131                        )
     132                );
     133
     134                /*
     135                * Selective refresh for widgets.
     136                */
     137                add_theme_support( 'customize-selective-refresh-widgets' );
     138        }
     139
     140}
    157141        add_action( 'after_setup_theme', 'nestora_setup' );
    158        
    159        
     142
     143
    160144        /**
    161145         * Register widget areas.
    162146         */
    163         function nestora_widgets_init() {
    164        
    165                 register_sidebar(
    166                         array(
    167                                 'name'          => __( 'Sidebar', 'nestora' ),
    168                                 'id'            => 'sidebar-1',
    169                                 'description'   => __( 'Add widgets here to appear in the sidebar.', 'nestora' ),
    170                                 'before_widget' => '<section id="%1$s" class="widget %2$s">',
    171                                 'after_widget'  => '</section>',
    172                                 'before_title'  => '<h2 class="widget-title">',
    173                                 'after_title'   => '</h2>',
    174                         )
    175                 );
    176        
    177                 register_sidebar(
    178                         array(
    179                                 'name'          => __( 'Footer Widget Area', 'nestora' ),
    180                                 'id'            => 'footer-1',
    181                                 'description'   => __( 'Add widgets here to appear in the footer.', 'nestora' ),
    182                                 'before_widget' => '<section id="%1$s" class="widget %2$s">',
    183                                 'after_widget'  => '</section>',
    184                                 'before_title'  => '<h2 class="widget-title">',
    185                                 'after_title'   => '</h2>',
    186                         )
    187                 );
    188         }
     147function nestora_widgets_init() {
     148
     149        register_sidebar(
     150                array(
     151                        'name'          => __( 'Sidebar', 'nestora' ),
     152                        'id'            => 'sidebar-1',
     153                        'description'   => __( 'Add widgets here to appear in the sidebar.', 'nestora' ),
     154                        'before_widget' => '<section id="%1$s" class="widget %2$s">',
     155                        'after_widget'  => '</section>',
     156                        'before_title'  => '<h2 class="widget-title">',
     157                        'after_title'   => '</h2>',
     158                )
     159        );
     160
     161        register_sidebar(
     162                array(
     163                        'name'          => __( 'Footer Widget Area', 'nestora' ),
     164                        'id'            => 'footer-1',
     165                        'description'   => __( 'Add widgets here to appear in the footer.', 'nestora' ),
     166                        'before_widget' => '<section id="%1$s" class="widget %2$s">',
     167                        'after_widget'  => '</section>',
     168                        'before_title'  => '<h2 class="widget-title">',
     169                        'after_title'   => '</h2>',
     170                )
     171        );
     172}
    189173        add_action( 'widgets_init', 'nestora_widgets_init' );
    190        
    191        
     174
     175
    192176        /**
    193177         * Enqueue theme stylesheet.
    194178         */
    195         function nestora_enqueue_styles() {
    196        
    197                 wp_enqueue_style(
    198                         'nestora-style',
    199                         get_stylesheet_uri(),
    200                         array(),
    201                         wp_get_theme()->get( 'Version' )
    202                 );
    203 
    204         }
     179function nestora_enqueue_styles() {
     180
     181        wp_enqueue_style(
     182                'nestora-style',
     183                get_stylesheet_uri(),
     184                array(),
     185                wp_get_theme()->get( 'Version' )
     186        );
     187}
    205188        add_action( 'wp_enqueue_scripts', 'nestora_enqueue_styles' );
    206        
    207        
     189
     190
    208191        /**
    209192         * Add standard WordPress body classes support.
    210193         */
    211         function nestora_body_classes( $classes ) {
    212        
    213                 if ( is_singular() && ! is_page_template( 'templates/full-width.php' ) ) {
    214                         $classes[] = 'nestora-singular';
    215                 }
    216        
    217                 return $classes;
    218         }
     194function nestora_body_classes( $classes ) {
     195
     196        if ( is_singular() && ! is_page_template( 'templates/full-width.php' ) ) {
     197                $classes[] = 'nestora-singular';
     198        }
     199
     200        return $classes;
     201}
    219202        add_filter( 'body_class', 'nestora_body_classes' );
    220        
    221        
     203
     204
    222205        /**
    223206         * Enqueue comment-reply script on singular posts with threaded comments.
    224207         */
    225         function nestora_enqueue_comment_reply() {
    226                 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    227                         wp_enqueue_script( 'comment-reply' );
    228                 }
    229         }
     208function nestora_enqueue_comment_reply() {
     209        if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
     210                wp_enqueue_script( 'comment-reply' );
     211        }
     212}
    230213        add_action( 'wp_enqueue_scripts', 'nestora_enqueue_comment_reply' );
    231214        /**
    232215         * Register a simple block pattern (transition to block themes).
    233216         */
    234         function nestora_register_block_patterns() {
    235                 if ( ! function_exists( 'register_block_pattern' ) ) {
    236                         return;
    237                 }
    238        
    239                 register_block_pattern(
    240                         'nestora/hero',
    241                         array(
    242                                 'title'       => __( 'nestora Hero', 'nestora' ),
    243                                 'description' => __( 'A simple hero section with heading and button.', 'nestora' ),
    244                                 'categories'  => array( 'featured' ),
    245                                 'content'     => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}}} -->
     217function nestora_register_block_patterns() {
     218        if ( ! function_exists( 'register_block_pattern' ) ) {
     219                return;
     220        }
     221
     222        register_block_pattern(
     223                'nestora/hero',
     224                array(
     225                        'title'       => __( 'nestora Hero', 'nestora' ),
     226                        'description' => __( 'A simple hero section with heading and button.', 'nestora' ),
     227                        'categories'  => array( 'featured' ),
     228                        'content'     => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}}} -->
    246229        <div class="wp-block-group alignfull" style="padding-top:4rem;padding-bottom:4rem">
    247230        <!-- wp:heading {"textAlign":"center","level":1} -->
    … …  
    257240        </div>
    258241        <!-- /wp:group -->',
    259                         )
    260                 );
    261         }
     242                )
     243        );
     244}
    262245        add_action( 'init', 'nestora_register_block_patterns' );
    263        
    264        
     246
     247
    265248        /**
    266249         * Register a custom block style.
    267250         */
    268         function nestora_register_block_styles() {
    269                 if ( ! function_exists( 'register_block_style' ) ) {
    270                         return;
     251function nestora_register_block_styles() {
     252        if ( ! function_exists( 'register_block_style' ) ) {
     253                return;
     254        }
     255
     256        register_block_style(
     257                'core/button',
     258                array(
     259                        'name'  => 'nestora-outline',
     260                        'label' => __( 'Outline', 'nestora' ),
     261                )
     262        );
     263}
     264        add_action( 'init', 'nestora_register_block_styles' );
     265
     266if ( ! function_exists( 'nestora_dynamic_body_classes' ) ) {
     267
     268        function nestora_dynamic_body_classes( $classes ) {
     269
     270                $queried_object = get_queried_object();
     271
     272                /*
     273                 * Post / Page / CPT.
     274                 */
     275                if ( $queried_object instanceof WP_Post ) {
     276
     277                        if ( ! empty( $queried_object->post_type ) ) {
     278                                $classes[] = 'post-type-' . sanitize_html_class(
     279                                        $queried_object->post_type
     280                                );
     281                        }
     282
     283                        if ( ! empty( $queried_object->post_name ) ) {
     284                                $classes[] = 'slug-' . sanitize_html_class(
     285                                        $queried_object->post_name
     286                                );
     287                        }
    271288                }
    272        
    273                 register_block_style(
    274                         'core/button',
    275                         array(
    276                                 'name'  => 'nestora-outline',
    277                                 'label' => __( 'Outline', 'nestora' ),
    278                         )
    279                 );
    280         }
    281         add_action( 'init', 'nestora_register_block_styles' );
    282        
    283         if ( ! function_exists( 'nestora_dynamic_body_classes' ) ) {
    284 
    285                 function nestora_dynamic_body_classes( $classes ) {
    286        
    287                         $queried_object = get_queried_object();
    288        
    289                         /*
    290                          * Post / Page / CPT.
    291                          */
    292                         if ( $queried_object instanceof WP_Post ) {
    293        
    294                                 if ( ! empty( $queried_object->post_type ) ) {
    295                                         $classes[] = 'post-type-' . sanitize_html_class(
    296                                                 $queried_object->post_type
    297                                         );
     289
     290                /*
     291                 * Taxonomy / Category / Tag.
     292                 */
     293                if ( $queried_object instanceof WP_Term ) {
     294
     295                        if ( ! empty( $queried_object->taxonomy ) ) {
     296                                $classes[] = 'taxonomy-' . sanitize_html_class(
     297                                        $queried_object->taxonomy
     298                                );
     299                        }
     300
     301                        if ( ! empty( $queried_object->slug ) ) {
     302                                $classes[] = 'slug-' . sanitize_html_class(
     303                                        $queried_object->slug
     304                                );
     305                        }
     306                }
     307
     308                /*
     309                 * Custom query vars.
     310                 */
     311                global $wp;
     312
     313                if ( ! empty( $wp->query_vars ) ) {
     314
     315                        $public_query_vars = $wp->public_query_vars;
     316
     317                        foreach ( $wp->query_vars as $key => $value ) {
     318
     319                                if ( in_array( $key, $public_query_vars, true ) ) {
     320                                        continue;
    298321                                }
    299        
    300                                 if ( ! empty( $queried_object->post_name ) ) {
    301                                         $classes[] = 'slug-' . sanitize_html_class(
    302                                                 $queried_object->post_name
    303                                         );
     322
     323                                if ( '' === $value || is_array( $value ) || is_object( $value ) ) {
     324                                        continue;
    304325                                }
    305                         }
    306        
    307                         /*
    308                          * Taxonomy / Category / Tag.
    309                          */
    310                         if ( $queried_object instanceof WP_Term ) {
    311        
    312                                 if ( ! empty( $queried_object->taxonomy ) ) {
    313                                         $classes[] = 'taxonomy-' . sanitize_html_class(
    314                                                 $queried_object->taxonomy
    315                                         );
     326
     327                                $key   = sanitize_html_class( $key );
     328                                $value = sanitize_html_class( $value );
     329
     330                                $classes[] = 'query-' . $key;
     331                                $classes[] = 'query-' . $key . '-' . $value;
     332                                $classes[] = 'slug-' . $value;
     333                        }
     334                }
     335
     336                $request = trim( $wp->request, '/' );
     337
     338                if ( $request ) {
     339
     340                        $segments = explode( '/', $request );
     341
     342                        foreach ( $segments as $segment ) {
     343
     344                                $segment = sanitize_html_class( $segment );
     345
     346                                if ( $segment ) {
     347                                        $classes[] = 'slug-' . $segment;
    316348                                }
    317        
    318                                 if ( ! empty( $queried_object->slug ) ) {
    319                                         $classes[] = 'slug-' . sanitize_html_class(
    320                                                 $queried_object->slug
    321                                         );
    322                                 }
    323                         }
    324        
    325                         /*
    326                          * Custom query vars.
    327                          */
    328                         global $wp;
    329        
    330                         if ( ! empty( $wp->query_vars ) ) {
    331        
    332                                 $public_query_vars = $wp->public_query_vars;
    333        
    334                                 foreach ( $wp->query_vars as $key => $value ) {
    335        
    336                                         if ( in_array( $key, $public_query_vars, true ) ) {
    337                                                 continue;
    338                                         }
    339        
    340                                         if ( '' === $value || is_array( $value ) || is_object( $value ) ) {
    341                                                 continue;
    342                                         }
    343        
    344                                         $key   = sanitize_html_class( $key );
    345                                         $value = sanitize_html_class( $value );
    346        
    347                                         $classes[] = 'query-' . $key;
    348                                         $classes[] = 'query-' . $key . '-' . $value;
    349                                         $classes[] = 'slug-' . $value;
    350                                 }
    351                         }
    352                                
    353                         $request = trim( $wp->request, '/' );
    354        
    355                         if ( $request ) {
    356        
    357                                 $segments = explode( '/', $request );
    358        
    359                                 foreach ( $segments as $segment ) {
    360        
    361                                         $segment = sanitize_html_class( $segment );
    362        
    363                                         if ( $segment ) {
    364                                                 $classes[] = 'slug-' . $segment;
    365                                         }
    366                                 }
    367                         }
    368        
    369                         return array_unique( $classes );
     349                        }
    370350                }
    371         }
    372        
     351
     352                return array_unique( $classes );
     353        }
     354}
     355
    373356        add_filter(
    374357                'body_class',
  • nestora/1.0.3/inc/functions-gamma.php

    r352928 r355713  
    55function nestora_setup_recent_blog() {
    66
    7     $category_slug = 'recent-blog';
    8     $category_name = 'Recent Blog';
    9 
    10     // Find or create the category.
    11     $category = get_category_by_slug( $category_slug );
    12 
    13     if ( ! $category ) {
    14         $category_result = wp_insert_term(
    15             $category_name,
    16             'category',
    17             array(
    18                 'slug' => $category_slug,
    19             )
    20         );
    21 
    22         if ( is_wp_error( $category_result ) ) {
    23             return;
    24         }
    25 
    26         $category_id = (int) $category_result['term_id'];
    27     } else {
    28         $category_id = (int) $category->term_id;
    29     }
    30 
    31     // Add category term metadata.
    32     if ( ! metadata_exists( 'term', $category_id, 'nestora-blog' ) ) {
    33         add_term_meta( $category_id, 'nestora-blog', '1', true );
    34     }
    35 
    36     // German sample blog posts.
    37     $sample_posts = array(
    38         array(
    39             'title'   => 'So richten Sie Ihr Zuhause stilvoll und gemütlich ein',
    40             'content' => 'Mit passenden Möbeln, harmonischen Farben und liebevollen Details schaffen Sie ein Zuhause, in dem Sie sich rundum wohlfühlen. Entdecken Sie praktische Einrichtungsideen für jeden Wohnbereich.',
    41         ),
    42         array(
    43             'title'   => 'Polstermöbel richtig pflegen und lange schön halten',
    44             'content' => 'Mit der richtigen Pflege bleiben Sofas und Sessel lange sauber und bequem. Regelmäßiges Absaugen, geeignete Reinigungsmittel und eine schonende Behandlung helfen, Ihre Polstermöbel dauerhaft zu erhalten.',
    45         ),
    46         array(
    47             'title'   => 'Platzsparende Möbelideen für kleine Wohnungen',
    48             'content' => 'Multifunktionale Möbel, clevere Aufbewahrungslösungen und helle Farben können kleine Räume größer wirken lassen. Erfahren Sie, wie Sie vorhandenen Platz optimal nutzen.',
    49         ),
    50     );
    51 
    52     foreach ( $sample_posts as $sample_post ) {
    53 
    54         // Prevent duplicate sample posts.
    55         $existing_posts = get_posts(
    56             array(
    57                 'post_type'      => 'post',
    58                 'post_status'    => 'any',
    59                 'posts_per_page' => 1,
    60                 'meta_key'       => '_nestora_sample_blog',
    61                 'meta_value'     => sanitize_title( $sample_post['title'] ),
    62                 'fields'         => 'ids',
    63             )
    64         );
    65 
    66         if ( ! empty( $existing_posts ) ) {
    67             $post_id = (int) $existing_posts[0];
    68 
    69             // Ensure the sample post belongs to Recent Blog.
    70             wp_set_object_terms( $post_id, array( $category_id ), 'category', false );
    71 
    72             continue;
    73         }
    74 
    75         // Create a normal WordPress post.
    76         $post_id = wp_insert_post(
    77             array(
    78                 'post_title'    => $sample_post['title'],
    79                 'post_content'  => $sample_post['content'],
    80                 'post_status'   => 'publish',
    81                 'post_type'     => 'post',
    82                 'post_category' => array( $category_id ),
    83             ),
    84             true
    85         );
    86 
    87         if ( ! is_wp_error( $post_id ) && $post_id ) {
    88             update_post_meta(
    89                 $post_id,
    90                 '_nestora_sample_blog',
    91                 sanitize_title( $sample_post['title'] )
    92             );
    93         }
    94     }
     7        $category_slug = 'recent-blog';
     8        $category_name = 'Recent Blog';
     9
     10        // Find or create the category.
     11        $category = get_category_by_slug( $category_slug );
     12
     13        if ( ! $category ) {
     14                $category_result = wp_insert_term(
     15                        $category_name,
     16                        'category',
     17                        array(
     18                                'slug' => $category_slug,
     19                        )
     20                );
     21
     22                if ( is_wp_error( $category_result ) ) {
     23                        return;
     24                }
     25
     26                $category_id = (int) $category_result['term_id'];
     27        } else {
     28                $category_id = (int) $category->term_id;
     29        }
     30
     31        // Add category term metadata.
     32        if ( ! metadata_exists( 'term', $category_id, 'nestora-blog' ) ) {
     33                add_term_meta( $category_id, 'nestora-blog', '1', true );
     34        }
     35
     36        // German sample blog posts.
     37        $sample_posts = array(
     38                array(
     39                        'title'   => 'So richten Sie Ihr Zuhause stilvoll und gemütlich ein',
     40                        'content' => 'Mit passenden Möbeln, harmonischen Farben und liebevollen Details schaffen Sie ein Zuhause, in dem Sie sich rundum wohlfühlen. Entdecken Sie praktische Einrichtungsideen für jeden Wohnbereich.',
     41                ),
     42                array(
     43                        'title'   => 'Polstermöbel richtig pflegen und lange schön halten',
     44                        'content' => 'Mit der richtigen Pflege bleiben Sofas und Sessel lange sauber und bequem. Regelmäßiges Absaugen, geeignete Reinigungsmittel und eine schonende Behandlung helfen, Ihre Polstermöbel dauerhaft zu erhalten.',
     45                ),
     46                array(
     47                        'title'   => 'Platzsparende Möbelideen für kleine Wohnungen',
     48                        'content' => 'Multifunktionale Möbel, clevere Aufbewahrungslösungen und helle Farben können kleine Räume größer wirken lassen. Erfahren Sie, wie Sie vorhandenen Platz optimal nutzen.',
     49                ),
     50        );
     51
     52        foreach ( $sample_posts as $sample_post ) {
     53
     54                // Prevent duplicate sample posts.
     55                $existing_posts = get_posts(
     56                        array(
     57                                'post_type'      => 'post',
     58                                'post_status'    => 'any',
     59                                'posts_per_page' => 1,
     60                                'meta_key'       => '_nestora_sample_blog',
     61                                'meta_value'     => sanitize_title( $sample_post['title'] ),
     62                                'fields'         => 'ids',
     63                        )
     64                );
     65
     66                if ( ! empty( $existing_posts ) ) {
     67                        $post_id = (int) $existing_posts[0];
     68
     69                        // Ensure the sample post belongs to Recent Blog.
     70                        wp_set_object_terms( $post_id, array( $category_id ), 'category', false );
     71
     72                        continue;
     73                }
     74
     75                // Create a normal WordPress post.
     76                $post_id = wp_insert_post(
     77                        array(
     78                                'post_title'    => $sample_post['title'],
     79                                'post_content'  => $sample_post['content'],
     80                                'post_status'   => 'publish',
     81                                'post_type'     => 'post',
     82                                'post_category' => array( $category_id ),
     83                        ),
     84                        true
     85                );
     86
     87                if ( ! is_wp_error( $post_id ) && $post_id ) {
     88                        update_post_meta(
     89                                $post_id,
     90                                '_nestora_sample_blog',
     91                                sanitize_title( $sample_post['title'] )
     92                        );
     93                }
     94        }
    9595}
    9696add_action( 'init', 'nestora_setup_recent_blog', 20 );
    … …  
    102102function nestora_get_recent_blog_posts( $number = 3 ) {
    103103
    104     return new WP_Query(
    105         array(
    106             'post_type'           => 'post',
    107             'post_status'         => 'publish',
    108             'posts_per_page'      => absint( $number ),
    109             'ignore_sticky_posts' => true,
    110             'category_name'       => 'recent-blog',
    111             'orderby'             => 'date',
    112             'order'               => 'DESC',
    113         )
    114     );
     104        return new WP_Query(
     105                array(
     106                        'post_type'           => 'post',
     107                        'post_status'         => 'publish',
     108                        'posts_per_page'      => absint( $number ),
     109                        'ignore_sticky_posts' => true,
     110                        'category_name'       => 'recent-blog',
     111                        'orderby'             => 'date',
     112                        'order'               => 'DESC',
     113                )
     114        );
    115115}
    116116
    … …  
    127127function nestora_get_blog_post_image( $post_id, $index = 0 ) {
    128128
    129     // Use the featured image first.
    130     if ( has_post_thumbnail( $post_id ) ) {
    131         return get_the_post_thumbnail_url( $post_id, 'large' );
    132     }
    133 
    134     $fallback_images = array(
    135         'post-1.jpg',
    136         'post-2.jpg',
    137         'post-3.jpg',
    138     );
    139 
    140     $index = absint( $index );
    141 
    142     if ( ! isset( $fallback_images[ $index ] ) ) {
    143         $index = 0;
    144     }
    145 
    146     $image_path = get_template_directory() . '/assets/images/' . $fallback_images[ $index ];
    147     $image_url  = get_template_directory_uri() . '/assets/images/' . $fallback_images[ $index ];
    148 
    149     if ( file_exists( $image_path ) ) {
    150         return $image_url;
    151     }
    152 
    153     // Return an empty string if the fallback image does not exist.
    154     return '';
     129        // Use the featured image first.
     130        if ( has_post_thumbnail( $post_id ) ) {
     131                return get_the_post_thumbnail_url( $post_id, 'large' );
     132        }
     133
     134        $fallback_images = array(
     135                'post-1.jpg',
     136                'post-2.jpg',
     137                'post-3.jpg',
     138        );
     139
     140        $index = absint( $index );
     141
     142        if ( ! isset( $fallback_images[ $index ] ) ) {
     143                $index = 0;
     144        }
     145
     146        $image_path = get_template_directory() . '/assets/images/' . $fallback_images[ $index ];
     147        $image_url  = get_template_directory_uri() . '/assets/images/' . $fallback_images[ $index ];
     148
     149        if ( file_exists( $image_path ) ) {
     150                return $image_url;
     151        }
     152
     153        // Return an empty string if the fallback image does not exist.
     154        return '';
    155155}
    156156
    … …  
    162162/* 1. Add settings submenu under Pages */
    163163function nestora_why_choose_admin_menu() {
    164     add_submenu_page(
    165         'edit.php?post_type=page',
    166         __( 'Why Choose Us Settings', 'nestora' ),
    167         __( 'Why Choose Us', 'nestora' ),
    168         'manage_options',
    169         'nestora-why-choose-settings',
    170         'nestora_why_choose_settings_page'
    171     );
     164        add_submenu_page(
     165                'edit.php?post_type=page',
     166                __( 'Why Choose Us Settings', 'nestora' ),
     167                __( 'Why Choose Us', 'nestora' ),
     168                'manage_options',
     169                'nestora-why-choose-settings',
     170                'nestora_why_choose_settings_page'
     171        );
    172172}
    173173add_action( 'admin_menu', 'nestora_why_choose_admin_menu' );
    … …  
    177177function nestora_register_why_choose_settings() {
    178178
    179     register_setting(
    180         'nestora_why_choose_group',
    181         'nestora_why_choose_title',
    182         array(
    183             'type'              => 'string',
    184             'sanitize_callback' => 'sanitize_text_field',
    185             'default'           => 'Why Choose Us',
    186         )
    187     );
    188 
    189     register_setting(
    190         'nestora_why_choose_group',
    191         'nestora_why_choose_description',
    192         array(
    193             'type'              => 'string',
    194             'sanitize_callback' => 'sanitize_textarea_field',
    195             'default'           => 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.',
    196         )
    197     );
    198 
    199     register_setting(
    200         'nestora_why_choose_group',
    201         'nestora_why_choose_image',
    202         array(
    203             'type'              => 'integer',
    204             'sanitize_callback' => 'absint',
    205             'default'           => 0,
    206         )
    207     );
    208 
    209     for ( $i = 1; $i <= 4; $i++ ) {
    210 
    211         register_setting(
    212             'nestora_why_choose_group',
    213             'nestora_why_choose_feature_' . $i . '_title',
    214             array(
    215                 'type'              => 'string',
    216                 'sanitize_callback' => 'sanitize_text_field',
    217                 'default'           => '',
    218             )
    219         );
    220 
    221         register_setting(
    222             'nestora_why_choose_group',
    223             'nestora_why_choose_feature_' . $i . '_description',
    224             array(
    225                 'type'              => 'string',
    226                 'sanitize_callback' => 'sanitize_textarea_field',
    227                 'default'           => '',
    228             )
    229         );
    230 
    231         register_setting(
    232             'nestora_why_choose_group',
    233             'nestora_why_choose_feature_' . $i . '_icon',
    234             array(
    235                 'type'              => 'integer',
    236                 'sanitize_callback' => 'absint',
    237                 'default'           => 0,
    238             )
    239         );
    240     }
     179        register_setting(
     180                'nestora_why_choose_group',
     181                'nestora_why_choose_title',
     182                array(
     183                        'type'              => 'string',
     184                        'sanitize_callback' => 'sanitize_text_field',
     185                        'default'           => 'Why Choose Us',
     186                )
     187        );
     188
     189        register_setting(
     190                'nestora_why_choose_group',
     191                'nestora_why_choose_description',
     192                array(
     193                        'type'              => 'string',
     194                        'sanitize_callback' => 'sanitize_textarea_field',
     195                        'default'           => 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.',
     196                )
     197        );
     198
     199        register_setting(
     200                'nestora_why_choose_group',
     201                'nestora_why_choose_image',
     202                array(
     203                        'type'              => 'integer',
     204                        'sanitize_callback' => 'absint',
     205                        'default'           => 0,
     206                )
     207        );
     208
     209        for ( $i = 1; $i <= 4; $i++ ) {
     210
     211                register_setting(
     212                        'nestora_why_choose_group',
     213                        'nestora_why_choose_feature_' . $i . '_title',
     214                        array(
     215                                'type'              => 'string',
     216                                'sanitize_callback' => 'sanitize_text_field',
     217                                'default'           => '',
     218                        )
     219                );
     220
     221                register_setting(
     222                        'nestora_why_choose_group',
     223                        'nestora_why_choose_feature_' . $i . '_description',
     224                        array(
     225                                'type'              => 'string',
     226                                'sanitize_callback' => 'sanitize_textarea_field',
     227                                'default'           => '',
     228                        )
     229                );
     230
     231                register_setting(
     232                        'nestora_why_choose_group',
     233                        'nestora_why_choose_feature_' . $i . '_icon',
     234                        array(
     235                                'type'              => 'integer',
     236                                'sanitize_callback' => 'absint',
     237                                'default'           => 0,
     238                        )
     239                );
     240        }
    241241}
    242242add_action( 'admin_init', 'nestora_register_why_choose_settings' );
    … …  
    246246function nestora_why_choose_settings_page() {
    247247
    248     if ( ! current_user_can( 'manage_options' ) ) {
    249         return;
    250     }
    251 
    252     $defaults = array(
    253         1 => array(
    254             'title'       => 'Fast & Free Shipping',
    255             'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
    256         ),
    257         2 => array(
    258             'title'       => 'Easy to Shop',
    259             'description' => 'Aliquam vulputate velit imperdiet dolor tempor tristique.',
    260         ),
    261         3 => array(
    262             'title'       => '24/7 Support',
    263             'description' => 'Nullam ac aliquet velit. Aliquam vulputate velit.',
    264         ),
    265         4 => array(
    266             'title'       => 'Hassle Free Returns',
    267             'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
    268         ),
    269     );
    270 
    271     $image_id = absint( get_option( 'nestora_why_choose_image', 0 ) );
    272     ?>
    273 
    274     <div class="wrap">
    275         <h1><?php esc_html_e( 'Why Choose Us Settings', 'nestora' ); ?></h1>
    276 
    277         <p><?php esc_html_e( 'Manage the Why Choose Us section displayed on your website.', 'nestora' ); ?></p>
    278 
    279         <form method="post" action="options.php">
    280 
    281             <?php settings_fields( 'nestora_why_choose_group' ); ?>
    282 
    283             <h2><?php esc_html_e( 'Section Settings', 'nestora' ); ?></h2>
    284 
    285             <table class="form-table" role="presentation">
    286                 <tr>
    287                     <th scope="row">
    288                         <label for="nestora_why_choose_title">
    289                             <?php esc_html_e( 'Section Title', 'nestora' ); ?>
    290                         </label>
    291                     </th>
    292                     <td>
    293                         <input
    294                             type="text"
    295                             class="regular-text"
    296                             id="nestora_why_choose_title"
    297                             name="nestora_why_choose_title"
    298                             value="<?php echo esc_attr( get_option( 'nestora_why_choose_title', 'Why Choose Us' ) ); ?>"
    299                         >
    300                     </td>
    301                 </tr>
    302 
    303                 <tr>
    304                     <th scope="row">
    305                         <label for="nestora_why_choose_description">
    306                             <?php esc_html_e( 'Section Description', 'nestora' ); ?>
    307                         </label>
    308                     </th>
    309                     <td>
    310                         <textarea
    311                             class="large-text"
    312                             rows="4"
    313                             id="nestora_why_choose_description"
    314                             name="nestora_why_choose_description"
    315                         ><?php echo esc_textarea( get_option( 'nestora_why_choose_description', 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.' ) ); ?></textarea>
    316                     </td>
    317                 </tr>
    318 
    319                 <tr>
    320                     <th scope="row">
    321                         <?php esc_html_e( 'Section Image', 'nestora' ); ?>
    322                     </th>
    323                     <td>
    324                         <input
    325                             type="hidden"
    326                             id="nestora_why_choose_image"
    327                             name="nestora_why_choose_image"
    328                             value="<?php echo esc_attr( $image_id ); ?>"
    329                         >
    330 
    331                         <div id="nestora_why_choose_image_preview">
    332                             <?php
    333                             if ( $image_id ) {
    334                                 echo wp_get_attachment_image(
    335                                     $image_id,
    336                                     'medium',
    337                                     false,
    338                                     array( 'style' => 'max-width:250px;height:auto;' )
    339                                 );
    340                             }
    341                             ?>
    342                         </div>
    343 
    344                         <button type="button" class="button" id="nestora_select_main_image">
    345                             <?php esc_html_e( 'Select Image', 'nestora' ); ?>
    346                         </button>
    347 
    348                         <button type="button" class="button" id="nestora_remove_main_image">
    349                             <?php esc_html_e( 'Remove Image', 'nestora' ); ?>
    350                         </button>
    351                     </td>
    352                 </tr>
    353             </table>
    354 
    355             <hr>
    356 
    357             <h2><?php esc_html_e( 'Feature Items', 'nestora' ); ?></h2>
    358 
    359             <?php foreach ( $defaults as $i => $feature ) : ?>
    360 
    361                 <?php
    362                 $title_id = 'nestora_why_choose_feature_' . $i . '_title';
    363                 $description_id = 'nestora_why_choose_feature_' . $i . '_description';
    364                 $icon_id = 'nestora_why_choose_feature_' . $i . '_icon';
    365 
    366                 $title = get_option( $title_id, $feature['title'] );
    367                 $description = get_option( $description_id, $feature['description'] );
    368                 $icon_id_value = absint( get_option( $icon_id, 0 ) );
    369                 ?>
    370 
    371                 <h3>
    372                     <?php
    373                     echo esc_html(
    374                         sprintf( __( 'Feature %d', 'nestora' ), $i )
    375                     );
    376                     ?>
    377                 </h3>
    378 
    379                 <table class="form-table" role="presentation">
    380                     <tr>
    381                         <th scope="row">
    382                             <label for="<?php echo esc_attr( $title_id ); ?>">
    383                                 <?php esc_html_e( 'Title', 'nestora' ); ?>
    384                             </label>
    385                         </th>
    386                         <td>
    387                             <input
    388                                 type="text"
    389                                 class="regular-text"
    390                                 id="<?php echo esc_attr( $title_id ); ?>"
    391                                 name="<?php echo esc_attr( $title_id ); ?>"
    392                                 value="<?php echo esc_attr( $title ); ?>"
    393                             >
    394                         </td>
    395                     </tr>
    396 
    397                     <tr>
    398                         <th scope="row">
    399                             <label for="<?php echo esc_attr( $description_id ); ?>">
    400                                 <?php esc_html_e( 'Description', 'nestora' ); ?>
    401                             </label>
    402                         </th>
    403                         <td>
    404                             <textarea
    405                                 class="large-text"
    406                                 rows="3"
    407                                 id="<?php echo esc_attr( $description_id ); ?>"
    408                                 name="<?php echo esc_attr( $description_id ); ?>"
    409                             ><?php echo esc_textarea( $description ); ?></textarea>
    410                         </td>
    411                     </tr>
    412 
    413                     <tr>
    414                         <th scope="row">
    415                             <?php esc_html_e( 'Feature Icon', 'nestora' ); ?>
    416                         </th>
    417                         <td>
    418                             <input
    419                                 type="hidden"
    420                                 id="<?php echo esc_attr( $icon_id ); ?>"
    421                                 name="<?php echo esc_attr( $icon_id ); ?>"
    422                                 value="<?php echo esc_attr( $icon_id_value ); ?>"
    423                             >
    424 
    425                             <div id="<?php echo esc_attr( $icon_id ); ?>_preview">
    426                                 <?php
    427                                 if ( $icon_id_value ) {
    428                                     echo wp_get_attachment_image(
    429                                         $icon_id_value,
    430                                         'thumbnail',
    431                                         false,
    432                                         array( 'style' => 'max-width:80px;height:auto;' )
    433                                     );
    434                                 }
    435                                 ?>
    436                             </div>
    437 
    438                             <button
    439                                 type="button"
    440                                 class="button delta-select-feature-icon"
    441                                 data-input="<?php echo esc_attr( $icon_id ); ?>"
    442                                 data-preview="<?php echo esc_attr( $icon_id ); ?>_preview"
    443                             >
    444                                 <?php esc_html_e( 'Select Icon', 'nestora' ); ?>
    445                             </button>
    446 
    447                             <button
    448                                 type="button"
    449                                 class="button delta-remove-feature-icon"
    450                                 data-input="<?php echo esc_attr( $icon_id ); ?>"
    451                                 data-preview="<?php echo esc_attr( $icon_id ); ?>_preview"
    452                             >
    453                                 <?php esc_html_e( 'Remove Icon', 'nestora' ); ?>
    454                             </button>
    455                         </td>
    456                     </tr>
    457                 </table>
    458 
    459                 <hr>
    460 
    461             <?php endforeach; ?>
    462 
    463             <?php submit_button( __( 'Save Why Choose Us Settings', 'nestora' ) ); ?>
    464 
    465         </form>
    466     </div>
    467 
    468     <?php
     248        if ( ! current_user_can( 'manage_options' ) ) {
     249                return;
     250        }
     251
     252        $defaults = array(
     253                1 => array(
     254                        'title'       => 'Fast & Free Shipping',
     255                        'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
     256                ),
     257                2 => array(
     258                        'title'       => 'Easy to Shop',
     259                        'description' => 'Aliquam vulputate velit imperdiet dolor tempor tristique.',
     260                ),
     261                3 => array(
     262                        'title'       => '24/7 Support',
     263                        'description' => 'Nullam ac aliquet velit. Aliquam vulputate velit.',
     264                ),
     265                4 => array(
     266                        'title'       => 'Hassle Free Returns',
     267                        'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
     268                ),
     269        );
     270
     271        $image_id = absint( get_option( 'nestora_why_choose_image', 0 ) );
     272        ?>
     273
     274        <div class="wrap">
     275                <h1><?php esc_html_e( 'Why Choose Us Settings', 'nestora' ); ?></h1>
     276
     277                <p><?php esc_html_e( 'Manage the Why Choose Us section displayed on your website.', 'nestora' ); ?></p>
     278
     279                <form method="post" action="options.php">
     280
     281                        <?php settings_fields( 'nestora_why_choose_group' ); ?>
     282
     283                        <h2><?php esc_html_e( 'Section Settings', 'nestora' ); ?></h2>
     284
     285                        <table class="form-table" role="presentation">
     286                                <tr>
     287                                        <th scope="row">
     288                                                <label for="nestora_why_choose_title">
     289                                                        <?php esc_html_e( 'Section Title', 'nestora' ); ?>
     290                                                </label>
     291                                        </th>
     292                                        <td>
     293                                                <input
     294                                                        type="text"
     295                                                        class="regular-text"
     296                                                        id="nestora_why_choose_title"
     297                                                        name="nestora_why_choose_title"
     298                                                        value="<?php echo esc_attr( get_option( 'nestora_why_choose_title', 'Why Choose Us' ) ); ?>"
     299                                                >
     300                                        </td>
     301                                </tr>
     302
     303                                <tr>
     304                                        <th scope="row">
     305                                                <label for="nestora_why_choose_description">
     306                                                        <?php esc_html_e( 'Section Description', 'nestora' ); ?>
     307                                                </label>
     308                                        </th>
     309                                        <td>
     310                                                <textarea
     311                                                        class="large-text"
     312                                                        rows="4"
     313                                                        id="nestora_why_choose_description"
     314                                                        name="nestora_why_choose_description"
     315                                                ><?php echo esc_textarea( get_option( 'nestora_why_choose_description', 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.' ) ); ?></textarea>
     316                                        </td>
     317                                </tr>
     318
     319                                <tr>
     320                                        <th scope="row">
     321                                                <?php esc_html_e( 'Section Image', 'nestora' ); ?>
     322                                        </th>
     323                                        <td>
     324                                                <input
     325                                                        type="hidden"
     326                                                        id="nestora_why_choose_image"
     327                                                        name="nestora_why_choose_image"
     328                                                        value="<?php echo esc_attr( $image_id ); ?>"
     329                                                >
     330
     331                                                <div id="nestora_why_choose_image_preview">
     332                                                        <?php
     333                                                        if ( $image_id ) {
     334                                                                echo wp_get_attachment_image(
     335                                                                        $image_id,
     336                                                                        'medium',
     337                                                                        false,
     338                                                                        array( 'style' => 'max-width:250px;height:auto;' )
     339                                                                );
     340                                                        }
     341                                                        ?>
     342                                                </div>
     343
     344                                                <button type="button" class="button" id="nestora_select_main_image">
     345                                                        <?php esc_html_e( 'Select Image', 'nestora' ); ?>
     346                                                </button>
     347
     348                                                <button type="button" class="button" id="nestora_remove_main_image">
     349                                                        <?php esc_html_e( 'Remove Image', 'nestora' ); ?>
     350                                                </button>
     351                                        </td>
     352                                </tr>
     353                        </table>
     354
     355                        <hr>
     356
     357                        <h2><?php esc_html_e( 'Feature Items', 'nestora' ); ?></h2>
     358
     359                        <?php foreach ( $defaults as $i => $feature ) : ?>
     360
     361                                <?php
     362                                $title_id       = 'nestora_why_choose_feature_' . $i . '_title';
     363                                $description_id = 'nestora_why_choose_feature_' . $i . '_description';
     364                                $icon_id        = 'nestora_why_choose_feature_' . $i . '_icon';
     365
     366                                $title         = get_option( $title_id, $feature['title'] );
     367                                $description   = get_option( $description_id, $feature['description'] );
     368                                $icon_id_value = absint( get_option( $icon_id, 0 ) );
     369                                ?>
     370
     371                                <h3>
     372                                        <?php
     373                                        echo esc_html(
     374                                                /* translators: %d: feature number. */
     375                                                sprintf( __( 'Feature %d', 'nestora' ), $i )
     376                                        );
     377                                        ?>
     378                                </h3>
     379
     380                                <table class="form-table" role="presentation">
     381                                        <tr>
     382                                                <th scope="row">
     383                                                        <label for="<?php echo esc_attr( $title_id ); ?>">
     384                                                                <?php esc_html_e( 'Title', 'nestora' ); ?>
     385                                                        </label>
     386                                                </th>
     387                                                <td>
     388                                                        <input
     389                                                                type="text"
     390                                                                class="regular-text"
     391                                                                id="<?php echo esc_attr( $title_id ); ?>"
     392                                                                name="<?php echo esc_attr( $title_id ); ?>"
     393                                                                value="<?php echo esc_attr( $title ); ?>"
     394                                                        >
     395                                                </td>
     396                                        </tr>
     397
     398                                        <tr>
     399                                                <th scope="row">
     400                                                        <label for="<?php echo esc_attr( $description_id ); ?>">
     401                                                                <?php esc_html_e( 'Description', 'nestora' ); ?>
     402                                                        </label>
     403                                                </th>
     404                                                <td>
     405                                                        <textarea
     406                                                                class="large-text"
     407                                                                rows="3"
     408                                                                id="<?php echo esc_attr( $description_id ); ?>"
     409                                                                name="<?php echo esc_attr( $description_id ); ?>"
     410                                                        ><?php echo esc_textarea( $description ); ?></textarea>
     411                                                </td>
     412                                        </tr>
     413
     414                                        <tr>
     415                                                <th scope="row">
     416                                                        <?php esc_html_e( 'Feature Icon', 'nestora' ); ?>
     417                                                </th>
     418                                                <td>
     419                                                        <input
     420                                                                type="hidden"
     421                                                                id="<?php echo esc_attr( $icon_id ); ?>"
     422                                                                name="<?php echo esc_attr( $icon_id ); ?>"
     423                                                                value="<?php echo esc_attr( $icon_id_value ); ?>"
     424                                                        >
     425
     426                                                        <div id="<?php echo esc_attr( $icon_id ); ?>_preview">
     427                                                                <?php
     428                                                                if ( $icon_id_value ) {
     429                                                                        echo wp_get_attachment_image(
     430                                                                                $icon_id_value,
     431                                                                                'thumbnail',
     432                                                                                false,
     433                                                                                array( 'style' => 'max-width:80px;height:auto;' )
     434                                                                        );
     435                                                                }
     436                                                                ?>
     437                                                        </div>
     438
     439                                                        <button
     440                                                                type="button"
     441                                                                class="button delta-select-feature-icon"
     442                                                                data-input="<?php echo esc_attr( $icon_id ); ?>"
     443                                                                data-preview="<?php echo esc_attr( $icon_id ); ?>_preview"
     444                                                        >
     445                                                                <?php esc_html_e( 'Select Icon', 'nestora' ); ?>
     446                                                        </button>
     447
     448                                                        <button
     449                                                                type="button"
     450                                                                class="button delta-remove-feature-icon"
     451                                                                data-input="<?php echo esc_attr( $icon_id ); ?>"
     452                                                                data-preview="<?php echo esc_attr( $icon_id ); ?>_preview"
     453                                                        >
     454                                                                <?php esc_html_e( 'Remove Icon', 'nestora' ); ?>
     455                                                        </button>
     456                                                </td>
     457                                        </tr>
     458                                </table>
     459
     460                                <hr>
     461
     462                        <?php endforeach; ?>
     463
     464                        <?php submit_button( __( 'Save Why Choose Us Settings', 'nestora' ) ); ?>
     465
     466                </form>
     467        </div>
     468
     469        <?php
    469470}
    470471
    … …  
    473474function nestora_why_choose_admin_scripts( $hook ) {
    474475
    475     if ( 'pages_page_delta-why-choose-settings' !== $hook ) {
    476         return;
    477     }
    478 
    479     wp_enqueue_media();
    480     wp_enqueue_script( 'jquery' );
    481 
    482     $script = <<<'JS'
     476        if ( 'pages_page_delta-why-choose-settings' !== $hook ) {
     477                return;
     478        }
     479
     480        wp_enqueue_media();
     481        wp_enqueue_script( 'jquery' );
     482
     483        $script = <<<'JS'
    483484jQuery(function($) {
    484485
    … …  
    541542JS;
    542543
    543     wp_add_inline_script( 'jquery', $script );
     544        wp_add_inline_script( 'jquery', $script );
    544545}
    545546add_action( 'admin_enqueue_scripts', 'nestora_why_choose_admin_scripts' );
  • nestora/1.0.3/index.php

    r352928 r355713  
    1010<?php get_template_part( 'parts/blog' ); ?>
    1111
    12 <?php get_footer(); ?>
     12<?php
     13get_footer();
  • nestora/1.0.3/page.php

    r352928 r355713  
    1414
    1515<main id="primary" class="site-main">
    16     <?php
    17     while ( have_posts() ) :
    18         the_post();
    19         ?>
    20         <article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>>
     16        <?php
     17        while ( have_posts() ) :
     18                the_post();
     19                ?>
     20                <article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>>
    2121
    22             <header class="entry__header">
    23                 <?php the_title( '<h1 class="entry__title">', '</h1>' ); ?>
    24             </header>
     22                        <header class="entry__header">
     23                                <?php the_title( '<h1 class="entry__title">', '</h1>' ); ?>
     24                        </header>
    2525
    26             <div class="entry__content">
    27                 <?php the_content(); ?>
     26                        <div class="entry__content">
     27                                <?php the_content(); ?>
    2828
    29                 <?php
    30                 wp_link_pages(
    31                     array(
    32                         'before' => '<nav class="entry__pages">' . esc_html__( 'Pages:', 'nestora' ),
    33                         'after'  => '</nav>',
    34                     )
    35                 );
    36                 ?>
    37             </div>
     29                                <?php
     30                                wp_link_pages(
     31                                        array(
     32                                                'before' => '<nav class="entry__pages">' . esc_html__( 'Pages:', 'nestora' ),
     33                                                'after'  => '</nav>',
     34                                        )
     35                                );
     36                                ?>
     37                        </div>
    3838
    39         </article>
    40         <?php
     39                </article>
     40                <?php
    4141
    42         if ( comments_open() || get_comments_number() ) {
    43             comments_template();
    44         }
     42                if ( comments_open() || get_comments_number() ) {
     43                        comments_template();
     44                }
    4545
    46     endwhile;
    47     ?>
     46        endwhile;
     47        ?>
    4848</main>
    4949
  • nestora/1.0.3/parts/blog.php

    r352928 r355713  
    1 
    21<?php
    32/**
    … …  
    109// Find the Recent Blog category.
    1110$nestora_blog_category = get_term_by(
    12     'slug',
    13     'recent-blog',
    14     'category'
     11        'slug',
     12        'recent-blog',
     13        'category'
    1514);
    1615
    1716if ( ! $nestora_blog_category ) {
    18     $nestora_blog_category = get_term_by(
    19         'name',
    20         'Recent Blog',
    21         'category'
    22     );
     17        $nestora_blog_category = get_term_by(
     18                'name',
     19                'Recent Blog',
     20                'category'
     21        );
    2322}
    2423
    2524// Default archive URL.
    2625$nestora_blog_archive_url = get_permalink(
    27     get_option( 'page_for_posts' )
     26        get_option( 'page_for_posts' )
    2827);
    2928
    3029// Use the category archive URL when available.
    3130if (
    32     $nestora_blog_category &&
    33     ! is_wp_error( $nestora_blog_category )
     31        $nestora_blog_category &&
     32        ! is_wp_error( $nestora_blog_category )
    3433) {
    35     $nestora_blog_archive_url = get_category_link(
    36         $nestora_blog_category->term_id
    37     );
     34        $nestora_blog_archive_url = get_category_link(
     35                $nestora_blog_category->term_id
     36        );
    3837}
    3938
    … …  
    4645<!-- Start Blog Section -->
    4746<div class="blog-section">
    48     <div class="container">
     47        <div class="container">
    4948
    50         <div class="row mb-5">
     49                <div class="row mb-5">
    5150
    52             <div class="col-md-6">
    53                 <h2 class="section-title">
    54                     <?php
    55                     echo esc_html(
    56                         $nestora_blog_category
    57                             ? $nestora_blog_category->name
    58                             : 'Recent Blog'
    59                     );
    60                     ?>
    61                 </h2>
    62             </div>
     51                        <div class="col-md-6">
     52                                <h2 class="section-title">
     53                                        <?php
     54                                        echo esc_html(
     55                                                $nestora_blog_category
     56                                                        ? $nestora_blog_category->name
     57                                                        : 'Recent Blog'
     58                                        );
     59                                        ?>
     60                                </h2>
     61                        </div>
    6362
    64             <div class="col-md-6 text-start text-md-end">
    65                 <a
    66                     href="<?php echo esc_url( $nestora_blog_archive_url ); ?>"
    67                     class="more"
    68                 >
    69                     Alle Beiträge ansehen
    70                 </a>
    71             </div>
     63                        <div class="col-md-6 text-start text-md-end">
     64                                <a
     65                                        href="<?php echo esc_url( $nestora_blog_archive_url ); ?>"
     66                                        class="more"
     67                                >
     68                                        Alle Beiträge ansehen
     69                                </a>
     70                        </div>
    7271
    73         </div>
     72                </div>
    7473
    75         <div class="row">
     74                <div class="row">
    7675
    77             <?php if ( ! empty( $nestora_blog_posts ) ) : ?>
     76                        <?php if ( ! empty( $nestora_blog_posts ) ) : ?>
    7877
    79                 <?php foreach ( $nestora_blog_posts as $index => $blog_post ) : ?>
     78                                <?php foreach ( $nestora_blog_posts as $index => $blog_post ) : ?>
    8079
    81                     <?php
    82                     $post_id = $blog_post->ID;
     80                                        <?php
     81                                        $post_id = $blog_post->ID;
    8382
    84                     // Dynamic post information.
    85                     $post_title = get_the_title( $post_id );
    86                     $post_link  = get_permalink( $post_id );
     83                                        // Dynamic post information.
     84                                        $post_title = get_the_title( $post_id );
     85                                        $post_link  = get_permalink( $post_id );
    8786
    88                     // Featured image with fallback images.
    89                     // post-1.jpg, post-2.jpg, post-3.jpg.
    90                     $post_image = nestora_get_blog_post_image(
    91                         $post_id,
    92                         $index
    93                     );
     87                                        // Featured image with fallback images.
     88                                        // post-1.jpg, post-2.jpg, post-3.jpg.
     89                                        $post_image = nestora_get_blog_post_image(
     90                                                $post_id,
     91                                                $index
     92                                        );
    9493
    95                     $post_author_id = (int) $blog_post->post_author;
     94                                        $post_author_id = (int) $blog_post->post_author;
    9695
    97                     $post_author = get_the_author_meta(
    98                         'display_name',
    99                         $post_author_id
    100                     );
     96                                        $post_author = get_the_author_meta(
     97                                                'display_name',
     98                                                $post_author_id
     99                                        );
    101100
    102                     $post_author_url = get_author_posts_url(
    103                         $post_author_id
    104                     );
     101                                        $post_author_url = get_author_posts_url(
     102                                                $post_author_id
     103                                        );
    105104
    106                     $post_date = get_the_date(
    107                         'd. F Y',
    108                         $post_id
    109                     );
     105                                        $post_date = get_the_date(
     106                                                'd. F Y',
     107                                                $post_id
     108                                        );
    110109
    111                     $post_date_url = get_day_link(
    112                         (int) get_the_date( 'Y', $post_id ),
    113                         (int) get_the_date( 'm', $post_id ),
    114                         (int) get_the_date( 'd', $post_id )
    115                     );
    116                     ?>
     110                                        $post_date_url = get_day_link(
     111                                                (int) get_the_date( 'Y', $post_id ),
     112                                                (int) get_the_date( 'm', $post_id ),
     113                                                (int) get_the_date( 'd', $post_id )
     114                                        );
     115                                        ?>
    117116
    118                     <div class="col-12 col-sm-6 col-md-4 mb-4 mb-md-0">
     117                                        <div class="col-12 col-sm-6 col-md-4 mb-4 mb-md-0">
    119118
    120                         <div class="post-entry">
     119                                                <div class="post-entry">
    121120
    122                             <?php if ( ! empty( $post_image ) ) : ?>
    123                                 <a
    124                                     href="<?php echo esc_url( $post_link ); ?>"
    125                                     class="post-thumbnail"
    126                                 >
    127                                     <img
    128                                         src="<?php echo esc_url( $post_image ); ?>"
    129                                         alt="<?php echo esc_attr( $post_title ); ?>"
    130                                         class="img-fluid"
    131                                         loading="lazy"
    132                                     >
    133                                 </a>
    134                             <?php endif; ?>
     121                                                        <?php if ( ! empty( $post_image ) ) : ?>
     122                                                                <a
     123                                                                        href="<?php echo esc_url( $post_link ); ?>"
     124                                                                        class="post-thumbnail"
     125                                                                >
     126                                                                        <img
     127                                                                                src="<?php echo esc_url( $post_image ); ?>"
     128                                                                                alt="<?php echo esc_attr( $post_title ); ?>"
     129                                                                                class="img-fluid"
     130                                                                                loading="lazy"
     131                                                                        >
     132                                                                </a>
     133                                                        <?php endif; ?>
    135134
    136                             <div class="post-content-entry">
     135                                                        <div class="post-content-entry">
    137136
    138                                 <h3>
    139                                     <a href="<?php echo esc_url( $post_link ); ?>">
    140                                         <?php echo esc_html( $post_title ); ?>
    141                                     </a>
    142                                 </h3>
     137                                                                <h3>
     138                                                                        <a href="<?php echo esc_url( $post_link ); ?>">
     139                                                                                <?php echo esc_html( $post_title ); ?>
     140                                                                        </a>
     141                                                                </h3>
    143142
    144                                 <div class="meta">
     143                                                                <div class="meta">
    145144
    146                                     <span>
    147                                         von
    148                                         <a href="<?php echo esc_url( $post_author_url ); ?>">
    149                                             <?php echo esc_html( $post_author ); ?>
    150                                         </a>
    151                                     </span>
     145                                                                        <span>
     146                                                                                von
     147                                                                                <a href="<?php echo esc_url( $post_author_url ); ?>">
     148                                                                                        <?php echo esc_html( $post_author ); ?>
     149                                                                                </a>
     150                                                                        </span>
    152151
    153                                     <span>
    154                                         am
    155                                         <a href="<?php echo esc_url( $post_date_url ); ?>">
    156                                             <?php echo esc_html( $post_date ); ?>
    157                                         </a>
    158                                     </span>
     152                                                                        <span>
     153                                                                                am
     154                                                                                <a href="<?php echo esc_url( $post_date_url ); ?>">
     155                                                                                        <?php echo esc_html( $post_date ); ?>
     156                                                                                </a>
     157                                                                        </span>
    159158
    160                                 </div>
     159                                                                </div>
    161160
    162                             </div>
     161                                                        </div>
    163162
    164                         </div>
     163                                                </div>
    165164
    166                     </div>
     165                                        </div>
    167166
    168                 <?php endforeach; ?>
     167                                <?php endforeach; ?>
    169168
    170             <?php else : ?>
     169                        <?php else : ?>
    171170
    172                 <div class="col-12">
    173                     <p>
    174                         Zurzeit sind keine Blogbeiträge verfügbar.
    175                     </p>
    176                 </div>
     171                                <div class="col-12">
     172                                        <p>
     173                                                Zurzeit sind keine Blogbeiträge verfügbar.
     174                                        </p>
     175                                </div>
    177176
    178             <?php endif; ?>
     177                        <?php endif; ?>
    179178
    180         </div>
     179                </div>
    181180
    182     </div>
     181        </div>
    183182</div>
    184183<!-- End Blog Section -->
  • nestora/1.0.3/parts/hero-section.php

    r352928 r355713  
    1 
    21<?php
    32/**
    … …  
    65
    76if ( ! defined( 'ABSPATH' ) ) {
    8     exit;
     7        exit;
    98}
    109
    1110$defaults = array(
    12     'title'       => 'Modern Interior',
    13     'subtitle'    => 'Design Studio',
    14     'description' => 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.',
    15     'button1_text' => 'Shop Now',
    16     'button1_url'  => '#',
    17     'button2_text' => 'Explore',
    18     'button2_url'  => '#',
    19     'images'       => array(),
     11        'title'        => 'Modern Interior',
     12        'subtitle'     => 'Design Studio',
     13        'description' => 'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.',
     14        'button1_text' => 'Shop Now',
     15        'button1_url'  => '#',
     16        'button2_text' => 'Explore',
     17        'button2_url'  => '#',
     18        'images'       => array(),
    2019);
    2120
    … …  
    2322
    2423if ( ! is_array( $settings ) ) {
    25     $settings = array();
     24        $settings = array();
    2625}
    2726
    … …  
    3938
    4039if ( ! empty( $settings['images'] ) && is_array( $settings['images'] ) ) {
    41     foreach ( $settings['images'] as $image_id ) {
    42         $image_url = wp_get_attachment_image_url( absint( $image_id ), 'full' );
     40        foreach ( $settings['images'] as $image_id ) {
     41                $image_url = wp_get_attachment_image_url( absint( $image_id ), 'full' );
    4342
    44         if ( $image_url ) {
    45             $images[] = array(
    46                 'url' => $image_url,
    47                 'alt' => get_post_meta( absint( $image_id ), '_wp_attachment_image_alt', true ),
    48             );
    49         }
    50     }
     43                if ( $image_url ) {
     44                        $images[] = array(
     45                                'url' => $image_url,
     46                                'alt' => get_post_meta( absint( $image_id ), '_wp_attachment_image_alt', true ),
     47                        );
     48                }
     49        }
    5150}
    5251
    5352/* Fallback image */
    5453if ( empty( $images ) ) {
    55     $fallback_images = array(
    56         '1.png' => 'Interior design image 1',
    57         '2.png' => 'Interior design image 2',
    58         '3.png' => 'Interior design image 3',
    59     );
     54        $fallback_images = array(
     55                '1.png' => 'Interior design image 1',
     56                '2.png' => 'Interior design image 2',
     57                '3.png' => 'Interior design image 3',
     58        );
    6059
    61     foreach ( $fallback_images as $filename => $alt_text ) {
    62         $fallback_path = get_theme_file_path( 'assets/images/' . $filename );
     60        foreach ( $fallback_images as $filename => $alt_text ) {
     61                $fallback_path = get_theme_file_path( 'assets/images/' . $filename );
    6362
    64         if ( file_exists( $fallback_path ) ) {
    65             $images[] = array(
    66                 'url' => get_theme_file_uri( 'assets/images/' . $filename ),
    67                 'alt' => $alt_text,
    68             );
    69         }
    70     }
     63                if ( file_exists( $fallback_path ) ) {
     64                        $images[] = array(
     65                                'url' => get_theme_file_uri( 'assets/images/' . $filename ),
     66                                'alt' => $alt_text,
     67                        );
     68                }
     69        }
    7170}
    7271?>
    … …  
    7473<style>
    7574.nestora-hero-slider {
    76     position: relative;
    77     width: 100%;
    78     min-width: 0;
    79     min-height: 360px;
    80     overflow: hidden;
     75        position: relative;
     76        width: 100%;
     77        min-width: 0;
     78        min-height: 360px;
     79        overflow: hidden;
    8180}
    8281
    8382.nestora-hero-slide {
    84     position: absolute;
    85     inset: 0;
    86     width: 100%;
    87     height: 100%;
    88     object-fit: contain;
    89     opacity: 0;
    90     visibility: hidden;
    91     transition: opacity 0.6s ease;
     83        position: absolute;
     84        inset: 0;
     85        width: 100%;
     86        height: 100%;
     87        object-fit: contain;
     88        opacity: 0;
     89        visibility: hidden;
     90        transition: opacity 0.6s ease;
    9291}
    9392
    9493.nestora-hero-slide.is-active {
    95     opacity: 1;
    96     visibility: visible;
     94        opacity: 1;
     95        visibility: visible;
    9796}
    9897
    9998@media (max-width: 991px) {
    100     .nestora-hero-slider {
    101         min-height: 280px;
    102         margin-top: 25px;
    103     }
     99        .nestora-hero-slider {
     100                min-height: 280px;
     101                margin-top: 25px;
     102        }
    104103}
    105104</style>
    … …  
    107106<!-- Start Hero Section -->
    108107<div class="hero">
    109     <div class="container">
    110         <div class="row justify-content-between">
     108        <div class="container">
     109                <div class="row justify-content-between">
    111110
    112             <!-- Hero Text -->
    113             <div class="col-lg-5">
    114                 <div class="intro-excerpt">
     111                        <!-- Hero Text -->
     112                        <div class="col-lg-5">
     113                                <div class="intro-excerpt">
    115114
    116                     <h1>
    117                         <?php echo esc_html( $title ); ?>
    118                         <span class="d-block">
    119                             <?php echo esc_html( $subtitle ); ?>
    120                         </span>
    121                     </h1>
     115                                        <h1>
     116                                                <?php echo esc_html( $title ); ?>
     117                                                <span class="d-block">
     118                                                        <?php echo esc_html( $subtitle ); ?>
     119                                                </span>
     120                                        </h1>
    122121
    123                     <p class="mb-4">
    124                         <?php echo esc_html( $description ); ?>
    125                     </p>
     122                                        <p class="mb-4">
     123                                                <?php echo esc_html( $description ); ?>
     124                                        </p>
    126125
    127                     <p>
    128                         <a href="<?php echo esc_url( $button1_url ); ?>"
    129                            class="btn btn-secondary me-2">
    130                             <?php echo esc_html( $button1_text ); ?>
    131                         </a>
     126                                        <p>
     127                                                <a href="<?php echo esc_url( $button1_url ); ?>"
     128                                                        class="btn btn-secondary me-2">
     129                                                        <?php echo esc_html( $button1_text ); ?>
     130                                                </a>
    132131
    133                         <a href="<?php echo esc_url( $button2_url ); ?>"
    134                            class="btn btn-white-outline">
    135                             <?php echo esc_html( $button2_text ); ?>
    136                         </a>
    137                     </p>
     132                                                <a href="<?php echo esc_url( $button2_url ); ?>"
     133                                                        class="btn btn-white-outline">
     134                                                        <?php echo esc_html( $button2_text ); ?>
     135                                                </a>
     136                                        </p>
    138137
    139                 </div>
    140             </div>
     138                                </div>
     139                        </div>
    141140
    142             <!-- Hero Image Slider -->
    143             <div class="col-lg-7">
    144                 <div class="hero-img-wrap nestora-hero-slider">
     141                        <!-- Hero Image Slider -->
     142                        <div class="col-lg-7">
     143                                <div class="hero-img-wrap nestora-hero-slider">
    145144
    146                     <?php foreach ( $images as $index => $image ) : ?>
    147                         <img
    148                             src="<?php echo esc_url( $image['url'] ); ?>"
    149                             class="img-fluid nestora-hero-slide <?php echo 0 === $index ? 'is-active' : ''; ?>"
    150                             alt="<?php echo esc_attr( $image['alt'] ); ?>"
    151                             <?php echo 0 === $index ? 'fetchpriority="high"' : 'loading="lazy"'; ?>
    152                         >
    153                     <?php endforeach; ?>
     145                                        <?php foreach ( $images as $index => $image ) : ?>
     146                                                <img
     147                                                        src="<?php echo esc_url( $image['url'] ); ?>"
     148                                                        class="img-fluid nestora-hero-slide <?php echo 0 === $index ? 'is-active' : ''; ?>"
     149                                                        alt="<?php echo esc_attr( $image['alt'] ); ?>"
     150                                                        <?php echo 0 === $index ? 'fetchpriority="high"' : 'loading="lazy"'; ?>
     151                                                >
     152                                        <?php endforeach; ?>
    154153
    155                 </div>
    156             </div>
     154                                </div>
     155                        </div>
    157156
    158         </div>
    159     </div>
     157                </div>
     158        </div>
    160159</div>
    161160<!-- End Hero Section -->
    … …  
    163162<script>
    164163document.addEventListener('DOMContentLoaded', function () {
    165     document.querySelectorAll('.nestora-hero-slider').forEach(function (slider) {
    166         var slides = slider.querySelectorAll('.nestora-hero-slide');
     164        document.querySelectorAll('.nestora-hero-slider').forEach(function (slider) {
     165                var slides = slider.querySelectorAll('.nestora-hero-slide');
    167166
    168         if (slides.length < 2) {
    169             return;
    170         }
     167                if (slides.length < 2) {
     168                        return;
     169                }
    171170
    172         var current = 0;
     171                var current = 0;
    173172
    174         window.setInterval(function () {
    175             slides[current].classList.remove('is-active');
     173                window.setInterval(function () {
     174                        slides[current].classList.remove('is-active');
    176175
    177             current = (current + 1) % slides.length;
     176                        current = (current + 1) % slides.length;
    178177
    179             slides[current].classList.add('is-active');
    180         }, 2000);
    181     });
     178                        slides[current].classList.add('is-active');
     179                }, 2000);
     180        });
    182181});
    183182</script>
  • nestora/1.0.3/parts/popular-product.php

    r352928 r355713  
    88
    99if ( ! defined( 'ABSPATH' ) ) {
    10     exit;
     10        exit;
    1111}
    1212
    1313// Only run if WooCommerce is active
    1414if ( ! taxonomy_exists( 'product_cat' ) ) {
    15     return;
     15        return;
    1616}
    1717
    … …  
    2222// If nothing is selected, bail (or optionally fall back to 3 latest categories)
    2323if ( empty( $items ) ) {
    24     return;
     24        return;
    2525}
    2626
    … …  
    3030// Fallback images from the theme
    3131$fallback_images = array(
    32     get_template_directory_uri() . '/assets/images/product-1.png',
    33     get_template_directory_uri() . '/assets/images/product-2.png',
    34     get_template_directory_uri() . '/assets/images/product-3.png',
     32        get_template_directory_uri() . '/assets/images/product-1.png',
     33        get_template_directory_uri() . '/assets/images/product-2.png',
     34        get_template_directory_uri() . '/assets/images/product-3.png',
    3535);
    3636
    3737// German descriptions for the furniture industry
    3838$fallback_descriptions = array(
    39     __( 'Entdecken Sie unsere handverlesene Auswahl an hochwertigen Möbeln für Ihr Zuhause.', 'nestora' ),
    40     __( 'Zeitloses Design und erstklassige Verarbeitung – made in Germany.', 'nestora' ),
    41     __( 'Komfort und Stil vereint – für Wohnräume, die begeistern.', 'nestora' ),
     39        __( 'Entdecken Sie unsere handverlesene Auswahl an hochwertigen Möbeln für Ihr Zuhause.', 'nestora' ),
     40        __( 'Zeitloses Design und erstklassige Verarbeitung – made in Germany.', 'nestora' ),
     41        __( 'Komfort und Stil vereint – für Wohnräume, die begeistern.', 'nestora' ),
    4242);
    4343?>
    4444<!-- Start Category Highlights -->
    4545<div class="popular-product">
    46     <div class="container">
    47         <div class="row">
     46        <div class="container">
     47                <div class="row">
    4848
    49             <?php
    50             $i = 0;
    51             foreach ( $items as $term_id ) :
     49                        <?php
     50                        $i = 0;
     51                        foreach ( $items as $term_id ) :
    5252
    53                 $term = get_term( $term_id, 'product_cat' );
    54                 if ( ! $term || is_wp_error( $term ) ) {
    55                     continue;
    56                 }
     53                                $term = get_term( $term_id, 'product_cat' );
     54                                if ( ! $term || is_wp_error( $term ) ) {
     55                                        continue;
     56                                }
    5757
    58                 // Category image (WooCommerce stores it as term meta 'thumbnail_id')
    59                 $thumbnail_id = get_term_meta( $term_id, 'thumbnail_id', true );
    60                 if ( $thumbnail_id ) {
    61                     $image_url = wp_get_attachment_image_url( $thumbnail_id, 'medium' );
    62                 } else {
    63                     // Cycle through fallback images
    64                     $image_url = $fallback_images[ $i % count( $fallback_images ) ];
    65                 }
     58                                // Category image (WooCommerce stores it as term meta 'thumbnail_id')
     59                                $thumbnail_id = get_term_meta( $term_id, 'thumbnail_id', true );
     60                                if ( $thumbnail_id ) {
     61                                        $image_url = wp_get_attachment_image_url( $thumbnail_id, 'medium' );
     62                                } else {
     63                                        // Cycle through fallback images
     64                                        $image_url = $fallback_images[ $i % count( $fallback_images ) ];
     65                                }
    6666
    67                 // Category description (or German fallback)
    68                 $description = '';
    69                 if ( ! empty( $term->description ) ) {
    70                     $description = wp_trim_words( $term->description, 12, '…' );
    71                 } else {
    72                     $description = $fallback_descriptions[ $i % count( $fallback_descriptions ) ];
    73                 }
     67                                // Category description (or German fallback)
     68                                $description = '';
     69                                if ( ! empty( $term->description ) ) {
     70                                        $description = wp_trim_words( $term->description, 12, '…' );
     71                                } else {
     72                                        $description = $fallback_descriptions[ $i % count( $fallback_descriptions ) ];
     73                                }
    7474
    75                 $link = get_term_link( $term );
    76                 if ( is_wp_error( $link ) ) {
    77                     continue;
    78                 }
    79                 ?>
     75                                $link = get_term_link( $term );
     76                                if ( is_wp_error( $link ) ) {
     77                                        continue;
     78                                }
     79                                ?>
    8080
    81                 <div class="col-12 col-md-6 col-lg-4 mb-4 mb-lg-0">
    82                     <div class="product-item-sm d-flex">
    83                         <div class="thumbnail">
    84                             <img src="<?php echo esc_url( $image_url ); ?>"
    85                                  alt="<?php echo esc_attr( $term->name ); ?>"
    86                                  class="img-fluid">
    87                         </div>
    88                         <div class="pt-3">
    89                             <h3><?php echo esc_html( $term->name ); ?></h3>
    90                             <p><?php echo esc_html( $description ); ?></p>
    91                             <p>
    92                                 <a href="<?php echo esc_url( $link ); ?>">
    93                                     <?php esc_html_e( 'Mehr erfahren', 'nestora' ); ?>
    94                                 </a>
    95                             </p>
    96                         </div>
    97                     </div>
    98                 </div>
     81                                <div class="col-12 col-md-6 col-lg-4 mb-4 mb-lg-0">
     82                                        <div class="product-item-sm d-flex">
     83                                                <div class="thumbnail">
     84                                                        <img src="<?php echo esc_url( $image_url ); ?>"
     85                                                                alt="<?php echo esc_attr( $term->name ); ?>"
     86                                                                class="img-fluid">
     87                                                </div>
     88                                                <div class="pt-3">
     89                                                        <h3><?php echo esc_html( $term->name ); ?></h3>
     90                                                        <p><?php echo esc_html( $description ); ?></p>
     91                                                        <p>
     92                                                                <a href="<?php echo esc_url( $link ); ?>">
     93                                                                        <?php esc_html_e( 'Mehr erfahren', 'nestora' ); ?>
     94                                                                </a>
     95                                                        </p>
     96                                                </div>
     97                                        </div>
     98                                </div>
    9999
    100                 <?php
    101                 $i++;
    102             endforeach;
    103             ?>
     100                                <?php
     101                                ++$i;
     102                        endforeach;
     103                        ?>
    104104
    105         </div>
    106     </div>
     105                </div>
     106        </div>
    107107</div>
    108108<!-- End Category Highlights -->
  • nestora/1.0.3/parts/testimonials.php

    r352928 r355713  
    1818
    1919        if ( $testimonial_query->have_posts() ) :
    20 ?>
     20                ?>
    2121
    2222<!-- Start Testimonial Slider -->
    … …  
    8989                                                                $testimonial_name = get_the_title();
    9090                                                        }
    91                                                                                                
     91
    9292                                                        if ( ! $testimonial_image ) {
    9393                                                                $testimonial_image = get_template_directory_uri() . '/assets/images/person-' . $person_image_index . '.jpg';
    9494                                                        }
    95                                                        
    96                                                         $person_image_index++;                                                 
    97                                                 ?>
     95
     96                                                        ++$person_image_index;
     97                                                        ?>
    9898
    9999                                                        <div class="item">
    … …  
    166166<!-- End Testimonial Slider -->
    167167
    168 <?php
     168                <?php
    169169                wp_reset_postdata();
    170170
  • nestora/1.0.3/parts/we-help.php

    r352928 r355713  
    3131
    3232if ( ! empty( $category ) && class_exists( 'woocommerce' ) ) {
    33     $term = get_term_by( 'slug', $category, 'product_cat' );
    34     if ( $term && ! is_wp_error( $term ) ) {
    35         $term_link      = get_term_link( $term );
    36         $category_url   = ! is_wp_error( $term_link ) ? $term_link : '#';
    37         $category_label = $term->name;
    38     }
     33        $term = get_term_by( 'slug', $category, 'product_cat' );
     34        if ( $term && ! is_wp_error( $term ) ) {
     35                $term_link      = get_term_link( $term );
     36                $category_url   = ! is_wp_error( $term_link ) ? $term_link : '#';
     37                $category_label = $term->name;
     38        }
    3939}
    4040?>
    … …  
    4242<!-- Start We Help Section -->
    4343<div class="we-help-section">
    44     <div class="container">
    45         <div class="row justify-content-between">
    46             <div class="col-lg-7 mb-5 mb-lg-0">
    47                 <div class="imgs-grid">
    48                     <div class="grid grid-1">
    49                         <img src="<?php echo esc_url( $image_1 ); ?>" alt="<?php echo esc_attr( $heading ); ?>">
    50                     </div>
    51                     <div class="grid grid-2">
    52                         <img src="<?php echo esc_url( $image_2 ); ?>" alt="<?php echo esc_attr( $heading ); ?>">
    53                     </div>
    54                     <div class="grid grid-3">
    55                         <img src="<?php echo esc_url( $image_3 ); ?>" alt="<?php echo esc_attr( $heading ); ?>">
    56                     </div>
    57                 </div>
    58             </div>
    59             <div class="col-lg-5 ps-lg-5">
    60                 <h2 class="section-title mb-4"><?php echo esc_html( $heading ); ?></h2>
    61                 <p><?php echo esc_html( $description ); ?></p>
     44        <div class="container">
     45                <div class="row justify-content-between">
     46                        <div class="col-lg-7 mb-5 mb-lg-0">
     47                                <div class="imgs-grid">
     48                                        <div class="grid grid-1">
     49                                                <img src="<?php echo esc_url( $image_1 ); ?>" alt="<?php echo esc_attr( $heading ); ?>">
     50                                        </div>
     51                                        <div class="grid grid-2">
     52                                                <img src="<?php echo esc_url( $image_2 ); ?>" alt="<?php echo esc_attr( $heading ); ?>">
     53                                        </div>
     54                                        <div class="grid grid-3">
     55                                                <img src="<?php echo esc_url( $image_3 ); ?>" alt="<?php echo esc_attr( $heading ); ?>">
     56                                        </div>
     57                                </div>
     58                        </div>
     59                        <div class="col-lg-5 ps-lg-5">
     60                                <h2 class="section-title mb-4"><?php echo esc_html( $heading ); ?></h2>
     61                                <p><?php echo esc_html( $description ); ?></p>
    6262
    63                 <?php if ( ! empty( $features ) ) : ?>
    64                     <ul class="list-unstyled custom-list my-4">
    65                         <?php foreach ( $features as $feature ) : ?>
    66                             <li><?php echo esc_html( $feature ); ?></li>
    67                         <?php endforeach; ?>
    68                     </ul>
    69                 <?php endif; ?>
     63                                <?php if ( ! empty( $features ) ) : ?>
     64                                        <ul class="list-unstyled custom-list my-4">
     65                                                <?php foreach ( $features as $feature ) : ?>
     66                                                        <li><?php echo esc_html( $feature ); ?></li>
     67                                                <?php endforeach; ?>
     68                                        </ul>
     69                                <?php endif; ?>
    7070
    71                 <p>
    72                     <a href="<?php echo esc_url( $category_url ); ?>" class="btn">
    73                         <?php echo esc_html( $category_label ); ?>
    74                     </a>
    75                 </p>
    76             </div>
    77         </div>
    78     </div>
     71                                <p>
     72                                        <a href="<?php echo esc_url( $category_url ); ?>" class="btn">
     73                                                <?php echo esc_html( $category_label ); ?>
     74                                        </a>
     75                                </p>
     76                        </div>
     77                </div>
     78        </div>
    7979</div>
    8080<!-- End We Help Section -->
  • nestora/1.0.3/parts/why-choose.php

    r352928 r355713  
    1 
    21<?php
    32/**
    … …  
    98
    109if ( ! is_array( $why_choose_options ) ) {
    11     $why_choose_options = array();
     10        $why_choose_options = array();
    1211}
    1312
    1413/* Section title */
    1514$why_choose_title = isset( $why_choose_options['why_choose_title'] )
    16     ? $why_choose_options['why_choose_title']
    17     : get_option( 'nestora_why_choose_title', 'Why Choose Us' );
     15        ? $why_choose_options['why_choose_title']
     16        : get_option( 'nestora_why_choose_title', 'Why Choose Us' );
    1817
    1918/* Section description */
    2019$why_choose_description = isset( $why_choose_options['why_choose_description'] )
    21     ? $why_choose_options['why_choose_description']
    22     : get_option(
    23         'nestora_why_choose_description',
    24         'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.'
    25     );
     20        ? $why_choose_options['why_choose_description']
     21        : get_option(
     22                'nestora_why_choose_description',
     23                'Donec vitae odio quis nisl dapibus malesuada. Nullam ac aliquet velit. Aliquam vulputate velit imperdiet dolor tempor tristique.'
     24        );
    2625
    2726/* Main section image */
    2827$why_choose_image_id = absint(
    29     $why_choose_options['why_choose_image']
    30         ?? get_option( 'nestora_why_choose_image', 0 )
     28        $why_choose_options['why_choose_image']
     29                ?? get_option( 'nestora_why_choose_image', 0 )
    3130);
    3231
    3332$why_choose_image = $why_choose_image_id
    34     ? wp_get_attachment_image_url( $why_choose_image_id, 'large' )
    35     : '';
     33        ? wp_get_attachment_image_url( $why_choose_image_id, 'large' )
     34        : '';
    3635
    3736if ( ! $why_choose_image ) {
    38     $why_choose_image = get_theme_file_uri(
    39         'assets/images/why-choose-us-img.jpg'
    40     );
     37        $why_choose_image = get_theme_file_uri(
     38                'assets/images/why-choose-us-img.jpg'
     39        );
    4140}
    4241
    4342/* Default feature content and SVG files */
    4443$default_features = array(
    45     1 => array(
    46         'title'       => 'Fast & Free Shipping',
    47         'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
    48         'icon'        => 'truck.svg',
    49     ),
    50     2 => array(
    51         'title'       => 'Easy to Shop',
    52         'description' => 'Aliquam vulputate velit imperdiet dolor tempor tristique.',
    53         'icon'        => 'bag.svg',
    54     ),
    55     3 => array(
    56         'title'       => '24/7 Support',
    57         'description' => 'Nullam ac aliquet velit. Aliquam vulputate velit.',
    58         'icon'        => 'support.svg',
    59     ),
    60     4 => array(
    61         'title'       => 'Hassle Free Returns',
    62         'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
    63         'icon'        => 'return.svg',
    64     ),
     44        1 => array(
     45                'title'       => 'Fast & Free Shipping',
     46                'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
     47                'icon'        => 'truck.svg',
     48        ),
     49        2 => array(
     50                'title'       => 'Easy to Shop',
     51                'description' => 'Aliquam vulputate velit imperdiet dolor tempor tristique.',
     52                'icon'        => 'bag.svg',
     53        ),
     54        3 => array(
     55                'title'       => '24/7 Support',
     56                'description' => 'Nullam ac aliquet velit. Aliquam vulputate velit.',
     57                'icon'        => 'support.svg',
     58        ),
     59        4 => array(
     60                'title'       => 'Hassle Free Returns',
     61                'description' => 'Donec vitae odio quis nisl dapibus malesuada.',
     62                'icon'        => 'return.svg',
     63        ),
    6564);
    6665
    … …  
    6968foreach ( $default_features as $number => $default_feature ) {
    7069
    71     $saved_feature = isset( $why_choose_options['features'][ $number ] )
    72         && is_array( $why_choose_options['features'][ $number ] )
    73         ? $why_choose_options['features'][ $number ]
    74         : array();
     70        $saved_feature = isset( $why_choose_options['features'][ $number ] )
     71                && is_array( $why_choose_options['features'][ $number ] )
     72                ? $why_choose_options['features'][ $number ]
     73                : array();
    7574
    76     $feature_title = $saved_feature['title']
    77         ?? get_option(
    78             'nestora_why_choose_feature_' . $number . '_title',
    79             $default_feature['title']
    80         );
     75        $feature_title = $saved_feature['title']
     76                ?? get_option(
     77                        'nestora_why_choose_feature_' . $number . '_title',
     78                        $default_feature['title']
     79                );
    8180
    82     $feature_description = $saved_feature['description']
    83         ?? get_option(
    84             'nestora_why_choose_feature_' . $number . '_description',
    85             $default_feature['description']
    86         );
     81        $feature_description = $saved_feature['description']
     82                ?? get_option(
     83                        'nestora_why_choose_feature_' . $number . '_description',
     84                        $default_feature['description']
     85                );
    8786
    88     /*
    89     * First try an attachment ID from the settings array.
    90     * Then try a legacy standalone feature-icon option.
    91     * Otherwise use the theme's SVG file.
    92     */
    93     $feature_icon_id = absint(
    94         $saved_feature['icon']
    95             ?? get_option(
    96                 'nestora_why_choose_feature_' . $number . '_icon',
    97                 0
    98             )
    99     );
     87        /*
     88        * First try an attachment ID from the settings array.
     89        * Then try a legacy standalone feature-icon option.
     90        * Otherwise use the theme's SVG file.
     91        */
     92        $feature_icon_id = absint(
     93                $saved_feature['icon']
     94                        ?? get_option(
     95                                'nestora_why_choose_feature_' . $number . '_icon',
     96                                0
     97                        )
     98        );
    10099
    101     $feature_icon = '';
     100        $feature_icon = '';
    102101
    103     if ( $feature_icon_id ) {
    104         $feature_icon = wp_get_attachment_image_url(
    105             $feature_icon_id,
    106             'thumbnail'
    107         );
    108     }
     102        if ( $feature_icon_id ) {
     103                $feature_icon = wp_get_attachment_image_url(
     104                        $feature_icon_id,
     105                        'thumbnail'
     106                );
     107        }
    109108
    110     if ( ! $feature_icon ) {
    111         $feature_icon = get_theme_file_uri(
    112             'assets/images/' . $default_feature['icon']
    113         );
    114     }
     109        if ( ! $feature_icon ) {
     110                $feature_icon = get_theme_file_uri(
     111                        'assets/images/' . $default_feature['icon']
     112                );
     113        }
    115114
    116     $why_choose_features[] = array(
    117         'title'       => $feature_title,
    118         'description' => $feature_description,
    119         'icon'        => $feature_icon,
    120     );
     115        $why_choose_features[] = array(
     116                'title'       => $feature_title,
     117                'description' => $feature_description,
     118                'icon'        => $feature_icon,
     119        );
    121120}
    122121?>
    123122
    124123<div class="why-choose-section">
    125     <div class="container">
    126         <div class="row justify-content-between">
     124        <div class="container">
     125                <div class="row justify-content-between">
    127126
    128             <div class="col-lg-6">
     127                        <div class="col-lg-6">
    129128
    130                 <h2 class="section-title">
    131                     <?php echo esc_html( $why_choose_title ); ?>
    132                 </h2>
     129                                <h2 class="section-title">
     130                                        <?php echo esc_html( $why_choose_title ); ?>
     131                                </h2>
    133132
    134                 <p>
    135                     <?php echo esc_html( $why_choose_description ); ?>
    136                 </p>
     133                                <p>
     134                                        <?php echo esc_html( $why_choose_description ); ?>
     135                                </p>
    137136
    138                 <div class="row my-5">
     137                                <div class="row my-5">
    139138
    140                     <?php foreach ( $why_choose_features as $feature ) : ?>
     139                                        <?php foreach ( $why_choose_features as $feature ) : ?>
    141140
    142                         <div class="col-6 col-md-6">
    143                             <div class="feature">
     141                                                <div class="col-6 col-md-6">
     142                                                        <div class="feature">
    144143
    145                                 <?php if ( ! empty( $feature['icon'] ) ) : ?>
    146                                     <div class="icon">
    147                                         <img
    148                                             src="<?php echo esc_url( $feature['icon'] ); ?>"
    149                                             alt=""
    150                                             class="img-fluid"
    151                                             loading="lazy"
    152                                         >
    153                                     </div>
    154                                 <?php endif; ?>
     144                                                                <?php if ( ! empty( $feature['icon'] ) ) : ?>
     145                                                                        <div class="icon">
     146                                                                                <img
     147                                                                                        src="<?php echo esc_url( $feature['icon'] ); ?>"
     148                                                                                        alt=""
     149                                                                                        class="img-fluid"
     150                                                                                        loading="lazy"
     151                                                                                >
     152                                                                        </div>
     153                                                                <?php endif; ?>
    155154
    156                                 <h3>
    157                                     <?php echo esc_html( $feature['title'] ); ?>
    158                                 </h3>
     155                                                                <h3>
     156                                                                        <?php echo esc_html( $feature['title'] ); ?>
     157                                                                </h3>
    159158
    160                                 <p>
    161                                     <?php echo esc_html( $feature['description'] ); ?>
    162                                 </p>
     159                                                                <p>
     160                                                                        <?php echo esc_html( $feature['description'] ); ?>
     161                                                                </p>
    163162
    164                             </div>
    165                         </div>
     163                                                        </div>
     164                                                </div>
    166165
    167                     <?php endforeach; ?>
     166                                        <?php endforeach; ?>
    168167
    169                 </div>
    170             </div>
     168                                </div>
     169                        </div>
    171170
    172             <div class="col-lg-5">
    173                 <div class="img-wrap">
     171                        <div class="col-lg-5">
     172                                <div class="img-wrap">
    174173
    175                     <?php if ( $why_choose_image ) : ?>
    176                         <img
    177                             src="<?php echo esc_url( $why_choose_image ); ?>"
    178                             alt="<?php echo esc_attr( $why_choose_title ); ?>"
    179                             class="img-fluid"
    180                             loading="lazy"
    181                         >
    182                     <?php endif; ?>
     174                                        <?php if ( $why_choose_image ) : ?>
     175                                                <img
     176                                                        src="<?php echo esc_url( $why_choose_image ); ?>"
     177                                                        alt="<?php echo esc_attr( $why_choose_title ); ?>"
     178                                                        class="img-fluid"
     179                                                        loading="lazy"
     180                                                >
     181                                        <?php endif; ?>
    183182
    184                 </div>
    185             </div>
     183                                </div>
     184                        </div>
    186185
    187         </div>
    188     </div>
     186                </div>
     187        </div>
    189188</div>
  • nestora/1.0.3/readme.txt

    r352930 r355713  
    11=== Nestora ===
    2 Contributors: jani33176,zeeshandesign5588,fahadmahmood,faizanmahmood,fanitech
     2Contributors: codingchamp
    33Requires at least: 6.0
    44Tested up to: 7.1
    55Requires PHP: 7.4
    6 Stable tag: 1.0.2
     6Stable tag: 1.0.3
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    7676== Changelog ==
    7777
     78= 1.0.3 =
     79
     80* Tested up to WordPress 7.1.
     81* Normalised line endings and coding-standards formatting across all theme files.
     82* Theme assets now use the theme version for cache busting.
     83* Readme updated for WordPress.org Theme Review Team requirements.
     84
    7885= 1.0.0 =
    7986
    … …  
    8996* Added translation-ready theme structure.
    9097* Added WordPress Customizer support.
     98
     99== Upgrade Notice ==
     100
     101= 1.0.3 =
     102Compatibility update for WordPress 7.1 and Theme Review Team compliance fixes.
     103
     104== Copyright ==
     105
     106Nestora WordPress Theme, Copyright 2026 GP Themes.
     107Nestora is distributed under the terms of the GNU General Public License v2 or later.
     108
     109== Resources ==
     110
     111* Bootstrap 5.3.0 - MIT License - https://getbootstrap.com
     112* Font Awesome Free 6.0.0-beta3 - Icons CC BY 4.0, Fonts SIL OFL 1.1, Code MIT - https://fontawesome.com
     113* Tiny Slider 2.9.4 - MIT License - https://github.com/ganlanyuan/tiny-slider
     114* Swiper - MIT License - https://swiperjs.com
     115* Inter font (Google Fonts) - SIL Open Font License 1.1 - https://fonts.google.com/specimen/Inter
     116* Bundled images in assets/images - see the license notes for each image; all are GPL-compatible.
     117
     118== Privacy ==
     119
     120Nestora does not track visitors or collect personal data by default. The Google Fonts stylesheet is requested from fonts.googleapis.com.
  • nestora/1.0.3/style.css

    r352930 r355713  
    55Author URI: https://profiles.wordpress.org/codingchamp
    66Description: A modern WordPress theme for flooring, parquet, interior design, and renovation businesses.
    7 Version: 1.0.2
     7Version: 1.0.3
    88Requires at least: 6.0
    99Requires PHP: 7.4
    10 Tested up to: 6.9
     10Tested up to: 7.1
    1111License: GPL-2.0-or-later
    1212License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • nestora/1.0.3/templates/category-recent-blog.php

    r352928 r355713  
    1 
    21<?php get_header(); ?>
    32
    43<div class="blog-section">
    5     <div class="container">
    6         <div class="row">
     4        <div class="container">
     5                <div class="row">
    76
    8             <?php if ( have_posts() ) : ?>
     7                        <?php if ( have_posts() ) : ?>
    98
    10                 <?php while ( have_posts() ) : the_post(); ?>
     9                                <?php
     10                                while ( have_posts() ) :
     11                                        the_post();
     12                                        ?>
    1113
    12                     <div class="col-12 col-sm-6 col-md-4 mb-5">
    13                         <div class="post-entry">
     14                                        <div class="col-12 col-sm-6 col-md-4 mb-5">
     15                                                <div class="post-entry">
    1416
    15                             <a href="<?php the_permalink(); ?>" class="post-thumbnail">
    16                                 <?php if ( has_post_thumbnail() ) : ?>
    17                                     <?php the_post_thumbnail( 'large', array( 'class' => 'img-fluid' ) ); ?>
    18                                 <?php else : ?>
    19                                     <img src="<?php echo esc_url( get_template_directory_uri() . '/images/post-1.jpg' ); ?>"
    20                                          alt="<?php echo esc_attr( get_the_title() ); ?>"
    21                                          class="img-fluid">
    22                                 <?php endif; ?>
    23                             </a>
     17                                                        <a href="<?php the_permalink(); ?>" class="post-thumbnail">
     18                                                                <?php if ( has_post_thumbnail() ) : ?>
     19                                                                        <?php the_post_thumbnail( 'large', array( 'class' => 'img-fluid' ) ); ?>
     20                                                                <?php else : ?>
     21                                                                        <img src="<?php echo esc_url( get_template_directory_uri() . '/images/post-1.jpg' ); ?>"
     22                                                                                alt="<?php echo esc_attr( get_the_title() ); ?>"
     23                                                                                class="img-fluid">
     24                                                                <?php endif; ?>
     25                                                        </a>
    2426
    25                             <div class="post-content-entry">
    26                                 <h3>
    27                                     <a href="<?php the_permalink(); ?>">
    28                                         <?php the_title(); ?>
    29                                     </a>
    30                                 </h3>
     27                                                        <div class="post-content-entry">
     28                                                                <h3>
     29                                                                        <a href="<?php the_permalink(); ?>">
     30                                                                                <?php the_title(); ?>
     31                                                                        </a>
     32                                                                </h3>
    3133
    32                                 <div class="meta">
    33                                     <span>
    34                                         by <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>">
    35                                             <?php the_author(); ?>
    36                                         </a>
    37                                     </span>
     34                                                                <div class="meta">
     35                                                                        <span>
     36                                                                                by <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>">
     37                                                                                        <?php the_author(); ?>
     38                                                                                </a>
     39                                                                        </span>
    3840
    39                                     <span>
    40                                         on <a href="<?php the_permalink(); ?>">
    41                                             <?php echo esc_html( get_the_date( 'M j, Y' ) ); ?>
    42                                         </a>
    43                                     </span>
    44                                 </div>
    45                             </div>
     41                                                                        <span>
     42                                                                                on <a href="<?php the_permalink(); ?>">
     43                                                                                        <?php echo esc_html( get_the_date( 'M j, Y' ) ); ?>
     44                                                                                </a>
     45                                                                        </span>
     46                                                                </div>
     47                                                        </div>
    4648
    47                         </div>
    48                     </div>
     49                                                </div>
     50                                        </div>
    4951
    50                 <?php endwhile; ?>
     52                                <?php endwhile; ?>
    5153
    52                 <div class="col-12">
    53                     <?php
    54                     the_posts_pagination( array(
    55                         'prev_text' => '&laquo; Previous',
    56                         'next_text' => 'Next &raquo;',
    57                     ) );
    58                     ?>
    59                 </div>
     54                                <div class="col-12">
     55                                        <?php
     56                                        the_posts_pagination(
     57                                                array(
     58                                                        'prev_text' => '&laquo; Previous',
     59                                                        'next_text' => 'Next &raquo;',
     60                                                )
     61                                        );
     62                                        ?>
     63                                </div>
    6064
    61             <?php else : ?>
     65                        <?php else : ?>
    6266
    63                 <div class="col-12">
    64                     <p>No blog posts found in this category.</p>
    65                 </div>
     67                                <div class="col-12">
     68                                        <p>No blog posts found in this category.</p>
     69                                </div>
    6670
    67             <?php endif; ?>
     71                        <?php endif; ?>
    6872
    69         </div>
    70     </div>
     73                </div>
     74        </div>
    7175</div>
    7276
  • nestora/1.0.3/woocommerce-custom/page-cart-custom.php

    r352928 r355713  
    77
    88<div class="untree_co-section before-footer-section">
    9     <div class="container">
    10 
    11         <?php if ( WC()->cart && ! WC()->cart->is_empty() ) : ?>
    12 
    13 
    14                 <div class="row mb-5">
    15                     <form class="col-md-12" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
    16 
    17                
    18                         <div class="site-blocks-table">
    19                    <?php do_action( 'woocommerce_before_cart_table' ); ?>
     9        <div class="container">
     10
     11                <?php if ( WC()->cart && ! WC()->cart->is_empty() ) : ?>
     12
     13
     14                                <div class="row mb-5">
     15                                        <form class="col-md-12" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
     16
     17                               
     18                                                <div class="site-blocks-table">
     19                                        <?php do_action( 'woocommerce_before_cart_table' ); ?>
    2020<table class="table shop_table shop_table_responsive cart woocommerce-cart-form__contents">
    21     <thead>
    22         <tr>
    23             <th class="product-thumbnail">Image</th>
    24             <th class="product-name">Product</th>
    25             <th class="product-price">Price</th>
    26             <th class="product-quantity">Quantity</th>
    27             <th class="product-total">Total</th>
    28             <th class="product-remove">Remove</th>
    29         </tr>
    30     </thead>
    31 
    32     <tbody>
    33         <?php foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) :
    34             $_product = $cart_item['data'];
    35 
    36             if ( ! $_product || ! $_product->exists() || $cart_item['quantity'] <= 0 ) {
    37                 continue;
    38             }
    39 
    40             $product_permalink = $_product->is_visible()
    41                 ? $_product->get_permalink( $cart_item )
    42                 : '';
    43 
    44             $product_name = $_product->get_name();
    45         ?>
    46             <tr class="woocommerce-cart-form__cart-item cart_item">
    47 
    48                 <td class="product-thumbnail">
    49                     <?php
    50                     $thumbnail = $_product->get_image( 'woocommerce_thumbnail', array(
    51                         'class' => 'img-fluid',
    52                     ) );
    53 
    54                     if ( $product_permalink ) {
    55                         printf(
    56                             '<a href="%s">%s</a>',
    57                             esc_url( $product_permalink ),
    58                             $thumbnail
    59                         );
    60                     } else {
    61                         echo $thumbnail; // WooCommerce-generated product image.
    62                     }
    63                     ?>
    64                 </td>
    65 
    66                 <td class="product-name" data-title="Product">
    67                     <?php
    68                     if ( $product_permalink ) {
    69                         printf(
    70                             '<h2 class="h5 text-black"><a href="%s">%s</a></h2>',
    71                             esc_url( $product_permalink ),
    72                             esc_html( $product_name )
    73                         );
    74                     } else {
    75                         printf(
    76                             '<h2 class="h5 text-black">%s</h2>',
    77                             esc_html( $product_name )
    78                         );
    79                     }
    80 
    81                     echo wc_get_formatted_cart_item_data( $cart_item );
    82                     ?>
    83                 </td>
    84 
    85                 <td class="product-price" data-title="Price">
    86                     <?php
    87                     echo WC()->cart->get_product_price( $_product );
    88                     ?>
    89                 </td>
    90 
    91                 <td class="product-quantity" data-title="Quantity">
    92                     <div class="input-group mb-3 d-flex align-items-center quantity-container" style="max-width: 120px;">
    93 
    94                         <div class="input-group-prepend">
    95                             <button class="btn btn-outline-black decrease" type="button" aria-label="Decrease quantity">−</button>
    96                         </div>
    97 
    98                        <input
    99     type="number"
    100     class="form-control text-center quantity-amount"
    101     name="<?php echo esc_attr( "cart[{$cart_item_key}][qty]" ); ?>"
    102     value="<?php echo esc_attr( $cart_item['quantity'] ); ?>"
    103     min="<?php echo esc_attr( $_product->is_sold_individually() ? 1 : 0 ); ?>"
    104     max="<?php echo esc_attr( $_product->get_max_purchase_quantity() ); ?>"
    105     step="1"
    106     aria-label="<?php echo esc_attr( $_product->get_name() . ' quantity' ); ?>"
     21        <thead>
     22                <tr>
     23                        <th class="product-thumbnail">Image</th>
     24                        <th class="product-name">Product</th>
     25                        <th class="product-price">Price</th>
     26                        <th class="product-quantity">Quantity</th>
     27                        <th class="product-total">Total</th>
     28                        <th class="product-remove">Remove</th>
     29                </tr>
     30        </thead>
     31
     32        <tbody>
     33                        <?php
     34                        foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) :
     35                                $_product = $cart_item['data'];
     36
     37                                if ( ! $_product || ! $_product->exists() || $cart_item['quantity'] <= 0 ) {
     38                                        continue;
     39                                }
     40
     41                                $product_permalink = $_product->is_visible()
     42                                ? $_product->get_permalink( $cart_item )
     43                                : '';
     44
     45                                $product_name = $_product->get_name();
     46                                ?>
     47                        <tr class="woocommerce-cart-form__cart-item cart_item">
     48
     49                                <td class="product-thumbnail">
     50                                        <?php
     51                                        $thumbnail = $_product->get_image(
     52                                                'woocommerce_thumbnail',
     53                                                array(
     54                                                        'class' => 'img-fluid',
     55                                                )
     56                                        );
     57
     58                                        if ( $product_permalink ) {
     59                                                printf(
     60                                                        '<a href="%s">%s</a>',
     61                                                        esc_url( $product_permalink ),
     62                                                        wp_kses_post( $thumbnail )
     63                                                );
     64                                        } else {
     65                                                echo wp_kses_post( $thumbnail );
     66                                        }
     67                                        ?>
     68                                </td>
     69
     70                                <td class="product-name" data-title="Product">
     71                                                <?php
     72                                                if ( $product_permalink ) {
     73                                                        printf(
     74                                                                '<h2 class="h5 text-black"><a href="%s">%s</a></h2>',
     75                                                                esc_url( $product_permalink ),
     76                                                                esc_html( $product_name )
     77                                                        );
     78                                                } else {
     79                                                        printf(
     80                                                                '<h2 class="h5 text-black">%s</h2>',
     81                                                                esc_html( $product_name )
     82                                                        );
     83                                                }
     84
     85                                                echo wp_kses_post( wc_get_formatted_cart_item_data( $cart_item ) );
     86                                                ?>
     87                                </td>
     88
     89                                <td class="product-price" data-title="Price">
     90                                                <?php
     91                                                echo wp_kses_post( WC()->cart->get_product_price( $_product ) );
     92                                                ?>
     93                                </td>
     94
     95                                <td class="product-quantity" data-title="Quantity">
     96                                        <div class="input-group mb-3 d-flex align-items-center quantity-container" style="max-width: 120px;">
     97
     98                                                <div class="input-group-prepend">
     99                                                        <button class="btn btn-outline-black decrease" type="button" aria-label="Decrease quantity">−</button>
     100                                                </div>
     101
     102                                                <input
     103        type="number"
     104        class="form-control text-center quantity-amount"
     105        name="<?php echo esc_attr( "cart[{$cart_item_key}][qty]" ); ?>"
     106        value="<?php echo esc_attr( $cart_item['quantity'] ); ?>"
     107        min="<?php echo esc_attr( $_product->is_sold_individually() ? 1 : 0 ); ?>"
     108        max="<?php echo esc_attr( $_product->get_max_purchase_quantity() ); ?>"
     109        step="1"
     110        aria-label="<?php echo esc_attr( $_product->get_name() . ' quantity' ); ?>"
    107111>
    108112
    109                         <div class="input-group-append">
    110                             <button class="btn btn-outline-black increase" type="button" aria-label="Increase quantity">+</button>
    111                         </div>
    112 
    113                     </div>
    114                 </td>
    115 
    116                 <td class="product-subtotal" data-title="Total">
    117                     <?php
    118                     echo WC()->cart->get_product_subtotal(
    119                         $_product,
    120                         $cart_item['quantity']
    121                     );
    122                     ?>
    123                 </td>
    124 
    125                 <td class="product-remove">
    126                     <?php
    127                     echo sprintf(
    128                         '<a href="%s" class="btn btn-black btn-sm remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">X</a>',
    129                         esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
    130                         esc_attr( sprintf( 'Remove %s from cart', $product_name ) ),
    131                         esc_attr( $_product->get_id() ),
    132                         esc_attr( $_product->get_sku() )
    133                     );
    134                     ?>
    135                 </td>
    136 
    137             </tr>
    138         <?php endforeach; ?>
    139 
    140         <tr>
    141             <td colspan="6" class="actions">
    142 
    143                 <div class="row align-items-center mb-4">
    144                     <div class="col-md-12">
    145                         <label class="text-black h4" for="coupon_code">Coupon</label>
    146                         <p>Enter your coupon code if you have one.</p>
    147                     </div>
    148 
    149                     <div class="col-md-8 mb-3 mb-md-0">
    150                         <input type="text"
    151                                name="coupon_code"
    152                                class="form-control py-3"
    153                                id="coupon_code"
    154                                placeholder="Coupon Code">
    155                     </div>
    156 
    157                     <div class="col-md-4">
    158                         <button type="submit"
    159                                 class="btn btn-black"
    160                                 name="apply_coupon"
    161                                 value="Apply coupon">
    162                             Apply Coupon
    163                         </button>
    164                     </div>
    165                 </div>
    166 
    167                 <div class="row mb-5">
    168                     <div class="col-md-6 mb-3 mb-md-0">
    169                         <button type="submit"
    170                                 class="btn btn-black btn-sm btn-block"
    171                                 name="update_cart"
    172                                 value="Update cart">
    173                             Update Cart
    174                         </button>
    175                     </div>
    176 
    177                     <div class="col-md-6">
    178                         <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>"
    179                            class="btn btn-outline-black btn-sm btn-block">
    180                             Continue Shopping
    181                         </a>
    182                     </div>
    183                 </div>
    184 
    185                 <?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
    186 
    187             </td>
    188         </tr>
    189     </tbody>
     113                                                <div class="input-group-append">
     114                                                        <button class="btn btn-outline-black increase" type="button" aria-label="Increase quantity">+</button>
     115                                                </div>
     116
     117                                        </div>
     118                                </td>
     119
     120                                <td class="product-subtotal" data-title="Total">
     121                                        <?php
     122                                        echo wp_kses_post(
     123                                                WC()->cart->get_product_subtotal(
     124                                                        $_product,
     125                                                        $cart_item['quantity']
     126                                                )
     127                                        );
     128                                        ?>
     129                                </td>
     130
     131                                <td class="product-remove">
     132                                                <?php
     133                                                printf(
     134                                                        '<a href="%s" class="btn btn-black btn-sm remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">X</a>',
     135                                                        esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
     136                                                        esc_attr( sprintf( 'Remove %s from cart', $product_name ) ),
     137                                                        esc_attr( $_product->get_id() ),
     138                                                        esc_attr( $_product->get_sku() )
     139                                                );
     140                                                ?>
     141                                </td>
     142
     143                        </tr>
     144                        <?php endforeach; ?>
     145
     146                <tr>
     147                        <td colspan="6" class="actions">
     148
     149                                <div class="row align-items-center mb-4">
     150                                        <div class="col-md-12">
     151                                                <label class="text-black h4" for="coupon_code">Coupon</label>
     152                                                <p>Enter your coupon code if you have one.</p>
     153                                        </div>
     154
     155                                        <div class="col-md-8 mb-3 mb-md-0">
     156                                                <input type="text"
     157                                                                name="coupon_code"
     158                                                                class="form-control py-3"
     159                                                                id="coupon_code"
     160                                                                placeholder="Coupon Code">
     161                                        </div>
     162
     163                                        <div class="col-md-4">
     164                                                <button type="submit"
     165                                                                class="btn btn-black"
     166                                                                name="apply_coupon"
     167                                                                value="Apply coupon">
     168                                                        Apply Coupon
     169                                                </button>
     170                                        </div>
     171                                </div>
     172
     173                                <div class="row mb-5">
     174                                        <div class="col-md-6 mb-3 mb-md-0">
     175                                                <button type="submit"
     176                                                                class="btn btn-black btn-sm btn-block"
     177                                                                name="update_cart"
     178                                                                value="Update cart">
     179                                                        Update Cart
     180                                                </button>
     181                                        </div>
     182
     183                                        <div class="col-md-6">
     184                                                <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>"
     185                                                        class="btn btn-outline-black btn-sm btn-block">
     186                                                        Continue Shopping
     187                                                </a>
     188                                        </div>
     189                                </div>
     190
     191                                <?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
     192
     193                        </td>
     194                </tr>
     195        </tbody>
    190196</table>
    191            <?php do_action( 'woocommerce_after_cart_table' ); ?>
    192 
    193 
    194                         </div>
    195    
    196             </form>
    197                 </div>
    198 
    199    
    200 
    201             <div class="row">
    202                 <div class="col-md-6">
    203                     <?php do_action( 'woocommerce_cart_collaterals' ); ?>
    204                 </div>
    205 
    206                 <div class="col-md-6 pl-md-5">
    207                     <div class="row justify-content-end">
    208                         <div class="col-md-7">
    209 
    210                             <div class="row">
    211                                 <div class="col-md-12 text-right border-bottom mb-5">
    212                                     <h3 class="text-black h4 text-uppercase">Cart Totals</h3>
    213                                 </div>
    214                             </div>
    215 
    216                             <div class="row mb-3">
    217                                 <div class="col-md-6">
    218                                     <span class="text-black">Subtotal</span>
    219                                 </div>
    220                                 <div class="col-md-6 text-right">
    221                                     <strong class="text-black">
    222                                         <?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?>
    223                                     </strong>
    224                                 </div>
    225                             </div>
    226 
    227                             <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
    228                                 <div class="row mb-3">
    229                                     <div class="col-md-6">
    230                                         <span class="text-black">
    231                                             Coupon: <?php echo esc_html( wc_format_coupon_code( $code ) ); ?>
    232                                         </span>
    233                                     </div>
    234                                     <div class="col-md-6 text-right">
    235                                         <?php
    236                                         echo wp_kses_post(
    237                                             wc_cart_totals_coupon_html( $coupon )
    238                                         );
    239                                         ?>
    240                                     </div>
    241                                 </div>
    242                             <?php endforeach; ?>
    243 
    244                             <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
    245                                 <div class="row mb-3">
    246                                     <div class="col-md-12">
    247                                         <?php wc_cart_totals_shipping_html(); ?>
    248                                     </div>
    249                                 </div>
    250                             <?php endif; ?>
    251 
    252                             <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
    253                                 <div class="row mb-3">
    254                                     <div class="col-md-6">
    255                                         <span class="text-black"><?php echo esc_html( $fee->name ); ?></span>
    256                                     </div>
    257                                     <div class="col-md-6 text-right">
    258                                         <?php wc_cart_totals_fee_html( $fee ); ?>
    259                                     </div>
    260                                 </div>
    261                             <?php endforeach; ?>
    262 
    263                             <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
    264                                 <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
    265                                     <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
    266                                         <div class="row mb-3">
    267                                             <div class="col-md-6">
    268                                                 <span class="text-black"><?php echo esc_html( $tax->label ); ?></span>
    269                                             </div>
    270                                             <div class="col-md-6 text-right">
    271                                                 <?php echo wp_kses_post( $tax->formatted_amount ); ?>
    272                                             </div>
    273                                         </div>
    274                                     <?php endforeach; ?>
    275                                 <?php else : ?>
    276                                     <div class="row mb-3">
    277                                         <div class="col-md-6">
    278                                             <span class="text-black">Tax</span>
    279                                         </div>
    280                                         <div class="col-md-6 text-right">
    281                                             <?php wc_cart_totals_taxes_total_html(); ?>
    282                                         </div>
    283                                     </div>
    284                                 <?php endif; ?>
    285                             <?php endif; ?>
    286 
    287                             <div class="row mb-5">
    288                                 <div class="col-md-6">
    289                                     <span class="text-black">Total</span>
    290                                 </div>
    291                                 <div class="col-md-6 text-right">
    292                                     <strong class="text-black">
    293                                         <?php wc_cart_totals_order_total_html(); ?>
    294                                     </strong>
    295                                 </div>
    296                             </div>
    297 
    298                             <div class="row">
    299                                 <div class="col-md-12">
    300                                     <a href="<?php echo esc_url( wc_get_checkout_url() ); ?>"
    301                                        class="btn btn-black btn-lg py-3 btn-block">
    302                                         Proceed To Checkout
    303                                     </a>
    304                                 </div>
    305                             </div>
    306 
    307                         </div>
    308                     </div>
    309                 </div>
    310             </div>
    311 
    312         <?php else : ?>
    313 
    314             <div class="row">
    315                 <div class="col-12">
    316                     <p>Your cart is currently empty.</p>
    317                     <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>"
    318                        class="btn btn-black">
    319                         Return to Shop
    320                     </a>
    321                 </div>
    322             </div>
    323 
    324         <?php endif; ?>
    325 
    326     </div>
     197                        <?php do_action( 'woocommerce_after_cart_table' ); ?>
     198
     199
     200                                                </div>
     201       
     202                        </form>
     203                                </div>
     204
     205       
     206
     207                        <div class="row">
     208                                <div class="col-md-6">
     209                                        <?php do_action( 'woocommerce_cart_collaterals' ); ?>
     210                                </div>
     211
     212                                <div class="col-md-6 pl-md-5">
     213                                        <div class="row justify-content-end">
     214                                                <div class="col-md-7">
     215
     216                                                        <div class="row">
     217                                                                <div class="col-md-12 text-right border-bottom mb-5">
     218                                                                        <h3 class="text-black h4 text-uppercase">Cart Totals</h3>
     219                                                                </div>
     220                                                        </div>
     221
     222                                                        <div class="row mb-3">
     223                                                                <div class="col-md-6">
     224                                                                        <span class="text-black">Subtotal</span>
     225                                                                </div>
     226                                                                <div class="col-md-6 text-right">
     227                                                                        <strong class="text-black">
     228                                                                                <?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?>
     229                                                                        </strong>
     230                                                                </div>
     231                                                        </div>
     232
     233                                                        <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
     234                                                                <div class="row mb-3">
     235                                                                        <div class="col-md-6">
     236                                                                                <span class="text-black">
     237                                                                                        Coupon: <?php echo esc_html( wc_format_coupon_code( $code ) ); ?>
     238                                                                                </span>
     239                                                                        </div>
     240                                                                        <div class="col-md-6 text-right">
     241                                                                                <?php
     242                                                                                echo wp_kses_post(
     243                                                                                        wc_cart_totals_coupon_html( $coupon )
     244                                                                                );
     245                                                                                ?>
     246                                                                        </div>
     247                                                                </div>
     248                                                        <?php endforeach; ?>
     249
     250                                                        <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
     251                                                                <div class="row mb-3">
     252                                                                        <div class="col-md-12">
     253                                                                                <?php wc_cart_totals_shipping_html(); ?>
     254                                                                        </div>
     255                                                                </div>
     256                                                        <?php endif; ?>
     257
     258                                                        <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
     259                                                                <div class="row mb-3">
     260                                                                        <div class="col-md-6">
     261                                                                                <span class="text-black"><?php echo esc_html( $fee->name ); ?></span>
     262                                                                        </div>
     263                                                                        <div class="col-md-6 text-right">
     264                                                                                <?php wc_cart_totals_fee_html( $fee ); ?>
     265                                                                        </div>
     266                                                                </div>
     267                                                        <?php endforeach; ?>
     268
     269                                                        <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
     270                                                                <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
     271                                                                        <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
     272                                                                                <div class="row mb-3">
     273                                                                                        <div class="col-md-6">
     274                                                                                                <span class="text-black"><?php echo esc_html( $tax->label ); ?></span>
     275                                                                                        </div>
     276                                                                                        <div class="col-md-6 text-right">
     277                                                                                                <?php echo wp_kses_post( $tax->formatted_amount ); ?>
     278                                                                                        </div>
     279                                                                                </div>
     280                                                                        <?php endforeach; ?>
     281                                                                <?php else : ?>
     282                                                                        <div class="row mb-3">
     283                                                                                <div class="col-md-6">
     284                                                                                        <span class="text-black">Tax</span>
     285                                                                                </div>
     286                                                                                <div class="col-md-6 text-right">
     287                                                                                        <?php wc_cart_totals_taxes_total_html(); ?>
     288                                                                                </div>
     289                                                                        </div>
     290                                                                <?php endif; ?>
     291                                                        <?php endif; ?>
     292
     293                                                        <div class="row mb-5">
     294                                                                <div class="col-md-6">
     295                                                                        <span class="text-black">Total</span>
     296                                                                </div>
     297                                                                <div class="col-md-6 text-right">
     298                                                                        <strong class="text-black">
     299                                                                                <?php wc_cart_totals_order_total_html(); ?>
     300                                                                        </strong>
     301                                                                </div>
     302                                                        </div>
     303
     304                                                        <div class="row">
     305                                                                <div class="col-md-12">
     306                                                                        <a href="<?php echo esc_url( wc_get_checkout_url() ); ?>"
     307                                                                                class="btn btn-black btn-lg py-3 btn-block">
     308                                                                                Proceed To Checkout
     309                                                                        </a>
     310                                                                </div>
     311                                                        </div>
     312
     313                                                </div>
     314                                        </div>
     315                                </div>
     316                        </div>
     317
     318                <?php else : ?>
     319
     320                        <div class="row">
     321                                <div class="col-12">
     322                                        <p>Your cart is currently empty.</p>
     323                                        <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>"
     324                                                class="btn btn-black">
     325                                                Return to Shop
     326                                        </a>
     327                                </div>
     328                        </div>
     329
     330                <?php endif; ?>
     331
     332        </div>
    327333</div>
    328334
    329335<?php do_action( 'woocommerce_after_cart' ); ?>
    330 <?php get_footer();
     336<?php
     337get_footer();
  • nestora/1.0.3/woocommerce-custom/page-checkout-custom.php

    r352928 r355713  
    55
    66if ( ! function_exists( 'WC' ) || ! WC()->checkout() || ! WC()->cart ) {
    7     get_footer();
    8     return;
     7        get_footer();
     8        return;
    99}
    1010
    … …  
    1212
    1313if ( WC()->cart->is_empty() ) {
    14     wc_print_notice( 'Your cart is currently empty.', 'notice' );
    15     echo '<p><a class="button" href="' . esc_url( wc_get_page_permalink( 'shop' ) ) . '">Return to shop</a></p>';
    16     get_footer();
    17     return;
     14        wc_print_notice( 'Your cart is currently empty.', 'notice' );
     15        echo '<p><a class="button" href="' . esc_url( wc_get_page_permalink( 'shop' ) ) . '">Return to shop</a></p>';
     16        get_footer();
     17        return;
    1818}
    1919?>
    2020
    2121<div class="untree_co-section">
    22     <div class="container">
    23 
    24         <?php
    25         // WooCommerce login prompt.
    26         woocommerce_checkout_login_form();
    27 
    28         // Must be outside the checkout form.
    29         do_action( 'woocommerce_before_checkout_form', $checkout );
    30         ?>
    31 
    32         <form name="checkout"
    33               method="post"
    34               class="checkout woocommerce-checkout"
    35               action="<?php echo esc_url( wc_get_checkout_url() ); ?>"
    36               enctype="multipart/form-data"
    37               aria-label="<?php echo esc_attr__( 'Checkout', 'nestora' ); ?>">
    38 
    39             <div class="row">
    40 
    41                 <!-- Billing and shipping details -->
    42                 <div class="col-md-6 mb-5 mb-md-0" id="customer_details">
    43                     <h2 class="h3 mb-3 text-black">Billing Details</h2>
    44 
    45                     <div class="p-3 p-lg-5 border bg-white">
    46 
    47                         <?php
    48                         $billing_fields = $checkout->get_checkout_fields( 'billing' );
    49 
    50                         $render_field = function ( $key ) use ( $billing_fields, $checkout ) {
    51                             if ( ! isset( $billing_fields[ $key ] ) ) {
    52                                 return;
    53                             }
    54 
    55                             $field = $billing_fields[ $key ];
    56 
    57                             $field['input_class'] = array_merge(
    58                                 $field['input_class'] ?? array(),
    59                                 array( 'form-control' )
    60                             );
    61 
    62                             woocommerce_form_field(
    63                                 $key,
    64                                 $field,
    65                                 $checkout->get_value( $key )
    66                             );
    67                         };
    68                         ?>
    69 
    70                         <div class="form-group">
    71                             <?php $render_field( 'billing_country' ); ?>
    72                         </div>
    73 
    74                         <div class="form-group row">
    75                             <div class="col-md-6">
    76                                 <?php $render_field( 'billing_first_name' ); ?>
    77                             </div>
    78                             <div class="col-md-6">
    79                                 <?php $render_field( 'billing_last_name' ); ?>
    80                             </div>
    81                         </div>
    82 
    83                         <div class="form-group row">
    84                             <div class="col-md-12">
    85                                 <?php $render_field( 'billing_company' ); ?>
    86                             </div>
    87                         </div>
    88 
    89                         <div class="form-group row">
    90                             <div class="col-md-12">
    91                                 <?php $render_field( 'billing_address_1' ); ?>
    92                             </div>
    93                         </div>
    94 
    95                         <div class="form-group">
    96                             <?php $render_field( 'billing_address_2' ); ?>
    97                         </div>
    98 
    99                         <div class="form-group row">
    100                             <div class="col-md-6">
    101                                 <?php $render_field( 'billing_state' ); ?>
    102                             </div>
    103                             <div class="col-md-6">
    104                                 <?php $render_field( 'billing_postcode' ); ?>
    105                             </div>
    106                         </div>
    107 
    108                         <div class="form-group row">
    109                             <div class="col-md-12">
    110                                 <?php $render_field( 'billing_city' ); ?>
    111                             </div>
    112                         </div>
    113 
    114                         <div class="form-group row mb-4">
    115                             <div class="col-md-6">
    116                                 <?php $render_field( 'billing_email' ); ?>
    117                             </div>
    118                             <div class="col-md-6">
    119                                 <?php $render_field( 'billing_phone' ); ?>
    120                             </div>
    121                         </div>
    122 
    123                         <?php if ( ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
    124                             <div class="form-group">
    125                                 <?php
    126                                 woocommerce_form_field(
    127                                     'createaccount',
    128                                     array(
    129                                         'type'  => 'checkbox',
    130                                         'class' => array( 'form-row-wide' ),
    131                                         'label' => __( 'Create an account?', 'nestora' ),
    132                                     ),
    133                                     $checkout->get_value( 'createaccount' )
    134                                 );
    135                                 ?>
    136                             </div>
    137 
    138                             <div class="create-account">
    139                                 <?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
    140                                 <?php do_action( 'woocommerce_checkout_registration', $checkout ); ?>
    141                                 <?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
    142                             </div>
    143                         <?php endif; ?>
    144 
    145                         <?php if ( WC()->cart->needs_shipping() ) : ?>
    146                             <div class="form-group mt-4">
    147                                 <?php
    148                                 woocommerce_form_field(
    149                                     'ship_to_different_address',
    150                                     array(
    151                                         'type'  => 'checkbox',
    152                                         'class' => array( 'form-row-wide' ),
    153                                         'label' => __( 'Ship to a different address?', 'nestora' ),
    154                                     ),
    155                                     $checkout->get_value( 'ship_to_different_address' )
    156                                 );
    157                                 ?>
    158                             </div>
    159 
    160                             <div class="shipping_address">
    161                                 <h3 class="h4 mb-3">Shipping Address</h3>
    162 
    163                                 <?php
    164                                 $shipping_fields = $checkout->get_checkout_fields( 'shipping' );
    165 
    166                                 foreach ( $shipping_fields as $key => $field ) {
    167                                     $field['input_class'] = array_merge(
    168                                         $field['input_class'] ?? array(),
    169                                         array( 'form-control' )
    170                                     );
    171 
    172                                     woocommerce_form_field(
    173                                         $key,
    174                                         $field,
    175                                         $checkout->get_value( $key )
    176                                     );
    177                                 }
    178                                 ?>
    179                             </div>
    180                         <?php endif; ?>
    181 
    182                         <?php
    183                         $order_fields = $checkout->get_checkout_fields( 'order' );
    184 
    185                         if ( isset( $order_fields['order_comments'] ) ) :
    186                             $comments_field = $order_fields['order_comments'];
    187                             $comments_field['input_class'] = array( 'form-control' );
    188                         ?>
    189                             <div class="form-group mt-4">
    190                                 <?php
    191                                 woocommerce_form_field(
    192                                     'order_comments',
    193                                     $comments_field,
    194                                     $checkout->get_value( 'order_comments' )
    195                                 );
    196                                 ?>
    197                             </div>
    198                         <?php endif; ?>
    199 
    200                     </div>
    201                 </div>
    202 
    203                 <!-- Order summary, payment methods and Place Order -->
    204                 <div class="col-md-6">
    205                     <div class="row mb-5">
    206                         <div class="col-md-12">
    207                             <h2 class="h3 mb-3 text-black">Your Order</h2>
    208 
    209                             <div class="p-3 p-lg-5 border bg-white">
    210                                 <div id="order_review"
    211                                      class="woocommerce-checkout-review-order">
    212 
    213                                     <?php do_action( 'woocommerce_checkout_order_review' ); ?>
    214 
    215                                 </div>
    216                             </div>
    217                         </div>
    218                     </div>
    219                 </div>
    220 
    221             </div>
    222         </form>
    223 
    224         <?php
    225         // Must be outside the checkout form.
    226         do_action( 'woocommerce_after_checkout_form', $checkout );
    227         ?>
    228 
    229     </div>
     22        <div class="container">
     23
     24                <?php
     25                // WooCommerce login prompt.
     26                woocommerce_checkout_login_form();
     27
     28                // Must be outside the checkout form.
     29                do_action( 'woocommerce_before_checkout_form', $checkout );
     30                ?>
     31
     32                <form name="checkout"
     33                                method="post"
     34                                class="checkout woocommerce-checkout"
     35                                action="<?php echo esc_url( wc_get_checkout_url() ); ?>"
     36                                enctype="multipart/form-data"
     37                                aria-label="<?php echo esc_attr__( 'Checkout', 'nestora' ); ?>">
     38
     39                        <div class="row">
     40
     41                                <!-- Billing and shipping details -->
     42                                <div class="col-md-6 mb-5 mb-md-0" id="customer_details">
     43                                        <h2 class="h3 mb-3 text-black">Billing Details</h2>
     44
     45                                        <div class="p-3 p-lg-5 border bg-white">
     46
     47                                                <?php
     48                                                $billing_fields = $checkout->get_checkout_fields( 'billing' );
     49
     50                                                $render_field = function ( $key ) use ( $billing_fields, $checkout ) {
     51                                                        if ( ! isset( $billing_fields[ $key ] ) ) {
     52                                                                return;
     53                                                        }
     54
     55                                                        $field = $billing_fields[ $key ];
     56
     57                                                        $field['input_class'] = array_merge(
     58                                                                $field['input_class'] ?? array(),
     59                                                                array( 'form-control' )
     60                                                        );
     61
     62                                                        woocommerce_form_field(
     63                                                                $key,
     64                                                                $field,
     65                                                                $checkout->get_value( $key )
     66                                                        );
     67                                                };
     68                                                ?>
     69
     70                                                <div class="form-group">
     71                                                        <?php $render_field( 'billing_country' ); ?>
     72                                                </div>
     73
     74                                                <div class="form-group row">
     75                                                        <div class="col-md-6">
     76                                                                <?php $render_field( 'billing_first_name' ); ?>
     77                                                        </div>
     78                                                        <div class="col-md-6">
     79                                                                <?php $render_field( 'billing_last_name' ); ?>
     80                                                        </div>
     81                                                </div>
     82
     83                                                <div class="form-group row">
     84                                                        <div class="col-md-12">
     85                                                                <?php $render_field( 'billing_company' ); ?>
     86                                                        </div>
     87                                                </div>
     88
     89                                                <div class="form-group row">
     90                                                        <div class="col-md-12">
     91                                                                <?php $render_field( 'billing_address_1' ); ?>
     92                                                        </div>
     93                                                </div>
     94
     95                                                <div class="form-group">
     96                                                        <?php $render_field( 'billing_address_2' ); ?>
     97                                                </div>
     98
     99                                                <div class="form-group row">
     100                                                        <div class="col-md-6">
     101                                                                <?php $render_field( 'billing_state' ); ?>
     102                                                        </div>
     103                                                        <div class="col-md-6">
     104                                                                <?php $render_field( 'billing_postcode' ); ?>
     105                                                        </div>
     106                                                </div>
     107
     108                                                <div class="form-group row">
     109                                                        <div class="col-md-12">
     110                                                                <?php $render_field( 'billing_city' ); ?>
     111                                                        </div>
     112                                                </div>
     113
     114                                                <div class="form-group row mb-4">
     115                                                        <div class="col-md-6">
     116                                                                <?php $render_field( 'billing_email' ); ?>
     117                                                        </div>
     118                                                        <div class="col-md-6">
     119                                                                <?php $render_field( 'billing_phone' ); ?>
     120                                                        </div>
     121                                                </div>
     122
     123                                                <?php if ( ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
     124                                                        <div class="form-group">
     125                                                                <?php
     126                                                                woocommerce_form_field(
     127                                                                        'createaccount',
     128                                                                        array(
     129                                                                                'type'  => 'checkbox',
     130                                                                                'class' => array( 'form-row-wide' ),
     131                                                                                'label' => __( 'Create an account?', 'nestora' ),
     132                                                                        ),
     133                                                                        $checkout->get_value( 'createaccount' )
     134                                                                );
     135                                                                ?>
     136                                                        </div>
     137
     138                                                        <div class="create-account">
     139                                                                <?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
     140                                                                <?php do_action( 'woocommerce_checkout_registration', $checkout ); ?>
     141                                                                <?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
     142                                                        </div>
     143                                                <?php endif; ?>
     144
     145                                                <?php if ( WC()->cart->needs_shipping() ) : ?>
     146                                                        <div class="form-group mt-4">
     147                                                                <?php
     148                                                                woocommerce_form_field(
     149                                                                        'ship_to_different_address',
     150                                                                        array(
     151                                                                                'type'  => 'checkbox',
     152                                                                                'class' => array( 'form-row-wide' ),
     153                                                                                'label' => __( 'Ship to a different address?', 'nestora' ),
     154                                                                        ),
     155                                                                        $checkout->get_value( 'ship_to_different_address' )
     156                                                                );
     157                                                                ?>
     158                                                        </div>
     159
     160                                                        <div class="shipping_address">
     161                                                                <h3 class="h4 mb-3">Shipping Address</h3>
     162
     163                                                                <?php
     164                                                                $shipping_fields = $checkout->get_checkout_fields( 'shipping' );
     165
     166                                                                foreach ( $shipping_fields as $key => $field ) {
     167                                                                        $field['input_class'] = array_merge(
     168                                                                                $field['input_class'] ?? array(),
     169                                                                                array( 'form-control' )
     170                                                                        );
     171
     172                                                                        woocommerce_form_field(
     173                                                                                $key,
     174                                                                                $field,
     175                                                                                $checkout->get_value( $key )
     176                                                                        );
     177                                                                }
     178                                                                ?>
     179                                                        </div>
     180                                                <?php endif; ?>
     181
     182                                                <?php
     183                                                $order_fields = $checkout->get_checkout_fields( 'order' );
     184
     185                                                if ( isset( $order_fields['order_comments'] ) ) :
     186                                                        $comments_field                = $order_fields['order_comments'];
     187                                                        $comments_field['input_class'] = array( 'form-control' );
     188                                                        ?>
     189                                                        <div class="form-group mt-4">
     190                                                                <?php
     191                                                                woocommerce_form_field(
     192                                                                        'order_comments',
     193                                                                        $comments_field,
     194                                                                        $checkout->get_value( 'order_comments' )
     195                                                                );
     196                                                                ?>
     197                                                        </div>
     198                                                <?php endif; ?>
     199
     200                                        </div>
     201                                </div>
     202
     203                                <!-- Order summary, payment methods and Place Order -->
     204                                <div class="col-md-6">
     205                                        <div class="row mb-5">
     206                                                <div class="col-md-12">
     207                                                        <h2 class="h3 mb-3 text-black">Your Order</h2>
     208
     209                                                        <div class="p-3 p-lg-5 border bg-white">
     210                                                                <div id="order_review"
     211                                                                        class="woocommerce-checkout-review-order">
     212
     213                                                                        <?php do_action( 'woocommerce_checkout_order_review' ); ?>
     214
     215                                                                </div>
     216                                                        </div>
     217                                                </div>
     218                                        </div>
     219                                </div>
     220
     221                        </div>
     222                </form>
     223
     224                <?php
     225                // Must be outside the checkout form.
     226                do_action( 'woocommerce_after_checkout_form', $checkout );
     227                ?>
     228
     229        </div>
    230230</div>
    231231
  • nestora/1.0.3/woocommerce-custom/page-order-received-custom.php

    r352928 r355713  
    1 
    21<?php
    32defined( 'ABSPATH' ) || exit;
    … …  
    54get_header();
    65
    7 $order_id = absint( get_query_var( 'order-received' ) );
     6// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Order key validates access.
     7$order_id  = absint( get_query_var( 'order-received' ) );
    88$order_key = isset( $_GET['key'] )
    9     ? wc_clean( wp_unslash( $_GET['key'] ) )
    10     : '';
     9        ? wc_clean( wp_unslash( $_GET['key'] ) )
     10        : '';
    1111
     12// phpcs:enable WordPress.Security.NonceVerification.Recommended
    1213$order = $order_id ? wc_get_order( $order_id ) : false;
    1314
    … …  
    1516
    1617<div class="untree_co-section">
    17     <div class="container">
    18    
    19        
     18        <div class="container">
     19       
     20               
    2021
    21         <?php if ( $order && $order->get_order_key() === $order_key && $order->is_paid() || $order && $order->get_order_key() === $order_key && $order->has_status( array( 'processing', 'completed', 'on-hold', 'pending' ) ) ) : ?>
     22                <?php if ( $order && $order->get_order_key() === $order_key && ( $order->is_paid() || $order->has_status( array( 'processing', 'completed', 'on-hold', 'pending' ) ) ) ) : ?>
    2223
    23             <div class="row justify-content-center">
    24            
    25                 <div class="col-md-12 text-center pt-5">
    26                   <span class="display-3 thankyou-icon text-primary">
    27                     <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cart-check mb-5" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
    28                       <path fill-rule="evenodd" d="M11.354 5.646a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L8 8.293l2.646-2.647a.5.5 0 0 1 .708 0z"></path>
    29                       <path fill-rule="evenodd" d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .491.592l-1.5 8A.5.5 0 0 1 13 12H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5zM3.102 4l1.313 7h8.17l1.313-7H3.102zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-7 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm7 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path>
    30                     </svg>
    31                   </span>
    32                   <h2 class="display-3 text-black">Thank you!</h2>
    33                   <p class="lead mb-5">You order was successfuly completed.</p>
    34                   <p>
    35     <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>" class="btn btn-sm btn-outline-black">
    36         Back to shop
    37     </a>
     24                        <div class="row justify-content-center">
     25                       
     26                                <div class="col-md-12 text-center pt-5">
     27                                        <span class="display-3 thankyou-icon text-primary">
     28                                        <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cart-check mb-5" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
     29                                                <path fill-rule="evenodd" d="M11.354 5.646a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L8 8.293l2.646-2.647a.5.5 0 0 1 .708 0z"></path>
     30                                                <path fill-rule="evenodd" d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .491.592l-1.5 8A.5.5 0 0 1 13 12H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5zM3.102 4l1.313 7h8.17l1.313-7H3.102zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-7 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm7 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path>
     31                                        </svg>
     32                                        </span>
     33                                        <h2 class="display-3 text-black">Thank you!</h2>
     34                                        <p class="lead mb-5">You order was successfuly completed.</p>
     35                                        <p>
     36        <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>" class="btn btn-sm btn-outline-black">
     37                Back to shop
     38        </a>
    3839</p>
    39                 </div>
    40                 <div class="col-md-8">
     40                                </div>
     41                                <div class="col-md-8">
    4142
    42                     <div class="p-4 p-lg-5 border bg-white rounded text-center mb-5">
    43                         <h1 class="h2 text-black mb-3">Thank You for Your Order!</h1>
     43                                        <div class="p-4 p-lg-5 border bg-white rounded text-center mb-5">
     44                                                <h1 class="h2 text-black mb-3">Thank You for Your Order!</h1>
    4445
    45                         <p class="mb-4">
    46                             Your order has been received. Thank you for shopping with us.
    47                         </p>
     46                                                <p class="mb-4">
     47                                                        Your order has been received. Thank you for shopping with us.
     48                                                </p>
    4849
    49                         <p class="mb-1">
    50                             <strong>Order Number:</strong>
    51                             <?php echo esc_html( $order->get_order_number() ); ?>
    52                         </p>
     50                                                <p class="mb-1">
     51                                                        <strong>Order Number:</strong>
     52                                                        <?php echo esc_html( $order->get_order_number() ); ?>
     53                                                </p>
    5354
    54                         <p class="mb-1">
    55                             <strong>Date:</strong>
    56                             <?php echo esc_html( wc_format_datetime( $order->get_date_created() ) ); ?>
    57                         </p>
     55                                                <p class="mb-1">
     56                                                        <strong>Date:</strong>
     57                                                        <?php echo esc_html( wc_format_datetime( $order->get_date_created() ) ); ?>
     58                                                </p>
    5859
    59                         <p class="mb-1">
    60                             <strong>Email:</strong>
    61                             <?php echo esc_html( $order->get_billing_email() ); ?>
    62                         </p>
     60                                                <p class="mb-1">
     61                                                        <strong>Email:</strong>
     62                                                        <?php echo esc_html( $order->get_billing_email() ); ?>
     63                                                </p>
    6364
    64                         <p class="mb-0">
    65                             <strong>Total:</strong>
    66                             <?php echo wp_kses_post( $order->get_formatted_order_total() ); ?>
    67                         </p>
    68                     </div>
     65                                                <p class="mb-0">
     66                                                        <strong>Total:</strong>
     67                                                        <?php echo wp_kses_post( $order->get_formatted_order_total() ); ?>
     68                                                </p>
     69                                        </div>
    6970
    70                     <div class="p-3 p-lg-5 border bg-white">
    71                         <h2 class="h3 mb-4 text-black">Order Details</h2>
     71                                        <div class="p-3 p-lg-5 border bg-white">
     72                                                <h2 class="h3 mb-4 text-black">Order Details</h2>
    7273
    73                         <table class="table site-block-order-table mb-4">
    74                             <thead>
    75                                 <tr>
    76                                     <th>Product</th>
    77                                     <th>Total</th>
    78                                 </tr>
    79                             </thead>
     74                                                <table class="table site-block-order-table mb-4">
     75                                                        <thead>
     76                                                                <tr>
     77                                                                        <th>Product</th>
     78                                                                        <th>Total</th>
     79                                                                </tr>
     80                                                        </thead>
    8081
    81                             <tbody>
    82                                 <?php foreach ( $order->get_items() as $item ) : ?>
    83                                     <tr>
    84                                         <td>
    85                                             <?php echo esc_html( $item->get_name() ); ?>
    86                                             <strong class="mx-2">×</strong>
    87                                             <?php echo esc_html( $item->get_quantity() ); ?>
    88                                         </td>
    89                                         <td>
    90                                             <?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>
    91                                         </td>
    92                                     </tr>
    93                                 <?php endforeach; ?>
     82                                                        <tbody>
     83                                                                <?php foreach ( $order->get_items() as $item ) : ?>
     84                                                                        <tr>
     85                                                                                <td>
     86                                                                                        <?php echo esc_html( $item->get_name() ); ?>
     87                                                                                        <strong class="mx-2">×</strong>
     88                                                                                        <?php echo esc_html( $item->get_quantity() ); ?>
     89                                                                                </td>
     90                                                                                <td>
     91                                                                                        <?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>
     92                                                                                </td>
     93                                                                        </tr>
     94                                                                <?php endforeach; ?>
    9495
    95                                 <tr>
    96                                     <td><strong>Subtotal</strong></td>
    97                                     <td><?php echo wp_kses_post( wc_price( $order->get_subtotal(), array( 'currency' => $order->get_currency() ) ) ); ?></td>
    98                                 </tr>
     96                                                                <tr>
     97                                                                        <td><strong>Subtotal</strong></td>
     98                                                                        <td><?php echo wp_kses_post( wc_price( $order->get_subtotal(), array( 'currency' => $order->get_currency() ) ) ); ?></td>
     99                                                                </tr>
    99100
    100                                 <?php if ( $order->get_shipping_total() > 0 ) : ?>
    101                                     <tr>
    102                                         <td><strong>Shipping</strong></td>
    103                                         <td><?php echo wp_kses_post( $order->get_shipping_to_display() ); ?></td>
    104                                     </tr>
    105                                 <?php endif; ?>
     101                                                                <?php if ( $order->get_shipping_total() > 0 ) : ?>
     102                                                                        <tr>
     103                                                                                <td><strong>Shipping</strong></td>
     104                                                                                <td><?php echo wp_kses_post( $order->get_shipping_to_display() ); ?></td>
     105                                                                        </tr>
     106                                                                <?php endif; ?>
    106107
    107                                 <?php if ( $order->get_total_tax() > 0 ) : ?>
    108                                     <tr>
    109                                         <td><strong>Tax</strong></td>
    110                                         <td><?php echo wp_kses_post( wc_price( $order->get_total_tax(), array( 'currency' => $order->get_currency() ) ) ); ?></td>
    111                                     </tr>
    112                                 <?php endif; ?>
     108                                                                <?php if ( $order->get_total_tax() > 0 ) : ?>
     109                                                                        <tr>
     110                                                                                <td><strong>Tax</strong></td>
     111                                                                                <td><?php echo wp_kses_post( wc_price( $order->get_total_tax(), array( 'currency' => $order->get_currency() ) ) ); ?></td>
     112                                                                        </tr>
     113                                                                <?php endif; ?>
    113114
    114                                 <tr>
    115                                     <td><strong>Payment Method</strong></td>
    116                                     <td><?php echo esc_html( $order->get_payment_method_title() ); ?></td>
    117                                 </tr>
     115                                                                <tr>
     116                                                                        <td><strong>Payment Method</strong></td>
     117                                                                        <td><?php echo esc_html( $order->get_payment_method_title() ); ?></td>
     118                                                                </tr>
    118119
    119                                 <tr>
    120                                     <td><strong>Order Total</strong></td>
    121                                     <td>
    122                                         <strong><?php echo wp_kses_post( $order->get_formatted_order_total() ); ?></strong>
    123                                     </td>
    124                                 </tr>
    125                             </tbody>
    126                         </table>
     120                                                                <tr>
     121                                                                        <td><strong>Order Total</strong></td>
     122                                                                        <td>
     123                                                                                <strong><?php echo wp_kses_post( $order->get_formatted_order_total() ); ?></strong>
     124                                                                        </td>
     125                                                                </tr>
     126                                                        </tbody>
     127                                                </table>
    127128
    128                         <h3 class="h4 mb-3 text-black">Billing Address</h3>
    129                         <address>
    130                             <?php echo wp_kses_post( $order->get_formatted_billing_address() ); ?>
    131                             <?php if ( $order->get_billing_email() ) : ?>
    132                                 <br><?php echo esc_html( $order->get_billing_email() ); ?>
    133                             <?php endif; ?>
    134                             <?php if ( $order->get_billing_phone() ) : ?>
    135                                 <br><?php echo esc_html( $order->get_billing_phone() ); ?>
    136                             <?php endif; ?>
    137                         </address>
     129                                                <h3 class="h4 mb-3 text-black">Billing Address</h3>
     130                                                <address>
     131                                                        <?php echo wp_kses_post( $order->get_formatted_billing_address() ); ?>
     132                                                        <?php if ( $order->get_billing_email() ) : ?>
     133                                                                <br><?php echo esc_html( $order->get_billing_email() ); ?>
     134                                                        <?php endif; ?>
     135                                                        <?php if ( $order->get_billing_phone() ) : ?>
     136                                                                <br><?php echo esc_html( $order->get_billing_phone() ); ?>
     137                                                        <?php endif; ?>
     138                                                </address>
    138139
    139                         <?php if ( $order->needs_shipping_address() ) : ?>
    140                             <h3 class="h4 mb-3 text-black">Shipping Address</h3>
    141                             <address>
    142                                 <?php echo wp_kses_post( $order->get_formatted_shipping_address() ); ?>
    143                             </address>
    144                         <?php endif; ?>
     140                                                <?php if ( $order->needs_shipping_address() ) : ?>
     141                                                        <h3 class="h4 mb-3 text-black">Shipping Address</h3>
     142                                                        <address>
     143                                                                <?php echo wp_kses_post( $order->get_formatted_shipping_address() ); ?>
     144                                                        </address>
     145                                                <?php endif; ?>
    145146
    146                         <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>"
    147                            class="btn btn-black btn-lg py-3 btn-block">
    148                             Continue Shopping
    149                         </a>
    150                     </div>
     147                                                <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>"
     148                                                        class="btn btn-black btn-lg py-3 btn-block">
     149                                                        Continue Shopping
     150                                                </a>
     151                                        </div>
    151152
    152                 </div>
    153             </div>
     153                                </div>
     154                        </div>
    154155
    155         <?php else : ?>
     156                <?php else : ?>
    156157
    157             <div class="p-4 border bg-white rounded">
    158                 <h1 class="h3 text-black">Order Confirmation Unavailable</h1>
    159                 <p>We couldn't verify this order confirmation. Please check your order confirmation email or contact us for assistance.</p>
    160                 <a class="btn btn-black" href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>">
    161                     Return to Shop
    162                 </a>
    163             </div>
     158                        <div class="p-4 border bg-white rounded">
     159                                <h1 class="h3 text-black">Order Confirmation Unavailable</h1>
     160                                <p>We couldn't verify this order confirmation. Please check your order confirmation email or contact us for assistance.</p>
     161                                <a class="btn btn-black" href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>">
     162                                        Return to Shop
     163                                </a>
     164                        </div>
    164165
    165         <?php endif; ?>
     166                <?php endif; ?>
    166167
    167     </div>
     168        </div>
    168169</div>
    169170
    170 <?php get_footer();
     171<?php
     172get_footer();
  • nestora/1.0.3/woocommerce-custom/page-shop-custom.php

    r352928 r355713  
    1 
    21<?php
    32/**
    … …  
    1110// WooCommerce must be active.
    1211if ( ! class_exists( 'woocommerce' ) ) {
    13     echo '<div class="container"><p>WooCommerce is required to display products.</p></div>';
    14     get_footer();
    15     return;
     12        echo '<div class="container"><p>WooCommerce is required to display products.</p></div>';
     13        get_footer();
     14        return;
    1615}
    1716
    1817// Current pagination page.
    1918$current_page = max(
    20     1,
    21     absint( get_query_var( 'paged' ) ),
    22     absint( get_query_var( 'page' ) )
     19        1,
     20        absint( get_query_var( 'paged' ) ),
     21        absint( get_query_var( 'page' ) )
    2322);
    2423
    … …  
    2827// Get WooCommerce products.
    2928$shop_query = new WP_Query(
    30     array(
    31         'post_type'      => 'product',
    32         'post_status'    => 'publish',
    33         'posts_per_page' => $products_per_page,
    34         'paged'          => $current_page,
    35         'orderby'        => 'date',
    36         'order'          => 'DESC',
    37     )
     29        array(
     30                'post_type'      => 'product',
     31                'post_status'    => 'publish',
     32                'posts_per_page' => $products_per_page,
     33                'paged'          => $current_page,
     34                'orderby'        => 'date',
     35                'order'          => 'DESC',
     36        )
    3837);
    3938?>
    4039
    4140<div class="untree_co-section product-section before-footer-section">
    42     <div class="container">
    43         <div class="row">
     41        <div class="container">
     42                <div class="row">
    4443
    45             <?php if ( $shop_query->have_posts() ) : ?>
     44                        <?php if ( $shop_query->have_posts() ) : ?>
    4645
    47                 <?php while ( $shop_query->have_posts() ) : ?>
    48                     <?php
    49                     $shop_query->the_post();
     46                                <?php while ( $shop_query->have_posts() ) : ?>
     47                                        <?php
     48                                        $shop_query->the_post();
    5049
    51                     $product_id = get_the_ID();
    52                     $product    = wc_get_product( $product_id );
     50                                        $product_id = get_the_ID();
     51                                        $product    = wc_get_product( $product_id );
    5352
    54                     if ( ! $product || ! $product->is_visible() ) {
    55                         continue;
    56                     }
     53                                        if ( ! $product || ! $product->is_visible() ) {
     54                                                continue;
     55                                        }
    5756
    58                     // Product image.
    59                     $product_image = get_the_post_thumbnail_url(
    60                         $product_id,
    61                         'woocommerce_thumbnail'
    62                     );
     57                                        // Product image.
     58                                        $product_image = get_the_post_thumbnail_url(
     59                                                $product_id,
     60                                                'woocommerce_thumbnail'
     61                                        );
    6362
    64                     if ( ! $product_image ) {
    65                         $product_image = wc_placeholder_img_src();
    66                     }
     63                                        if ( ! $product_image ) {
     64                                                $product_image = wc_placeholder_img_src();
     65                                        }
    6766
    68                     // Product URL.
    69                     $product_url = get_permalink( $product_id );
     67                                        // Product URL.
     68                                        $product_url = get_permalink( $product_id );
    7069
    71                     // Product title.
    72                     $product_title = get_the_title( $product_id );
    73                     ?>
     70                                        // Product title.
     71                                        $product_title = get_the_title( $product_id );
     72                                        ?>
    7473
    75                     <!-- Start Product Column -->
    76                     <div class="col-12 col-md-4 col-lg-3 mb-5">
    77                         <a
    78                             class="product-item"
    79                             href="<?php echo esc_url( $product_url ); ?>"
    80                             aria-label="<?php echo esc_attr( $product_title ); ?>"
    81                         >
    82                             <img
    83                                 src="<?php echo esc_url( $product_image ); ?>"
    84                                 class="img-fluid product-thumbnail"
    85                                 alt="<?php echo esc_attr( $product_title ); ?>"
    86                                 loading="lazy"
    87                             >
     74                                        <!-- Start Product Column -->
     75                                        <div class="col-12 col-md-4 col-lg-3 mb-5">
     76                                                <a
     77                                                        class="product-item"
     78                                                        href="<?php echo esc_url( $product_url ); ?>"
     79                                                        aria-label="<?php echo esc_attr( $product_title ); ?>"
     80                                                >
     81                                                        <img
     82                                                                src="<?php echo esc_url( $product_image ); ?>"
     83                                                                class="img-fluid product-thumbnail"
     84                                                                alt="<?php echo esc_attr( $product_title ); ?>"
     85                                                                loading="lazy"
     86                                                        >
    8887
    89                             <h3 class="product-title">
    90                                 <?php echo esc_html( $product_title ); ?>
    91                             </h3>
     88                                                        <h3 class="product-title">
     89                                                                <?php echo esc_html( $product_title ); ?>
     90                                                        </h3>
    9291
    93                             <strong class="product-price">
    94                                 <?php echo wp_kses_post( $product->get_price_html() ); ?>
    95                             </strong>
     92                                                        <strong class="product-price">
     93                                                                <?php echo wp_kses_post( $product->get_price_html() ); ?>
     94                                                        </strong>
    9695
    97                             <span class="icon-cross">
    98                                 <img
    99                                     src="<?php echo esc_url( get_template_directory_uri() . '/assets/images/cross.svg' ); ?>"
    100                                     class="img-fluid"
    101                                     alt=""
    102                                 >
    103                             </span>
    104                         </a>
    105                     </div>
    106                     <!-- End Product Column -->
     96                                                        <span class="icon-cross">
     97                                                                <img
     98                                                                        src="<?php echo esc_url( get_template_directory_uri() . '/assets/images/cross.svg' ); ?>"
     99                                                                        class="img-fluid"
     100                                                                        alt=""
     101                                                                >
     102                                                        </span>
     103                                                </a>
     104                                        </div>
     105                                        <!-- End Product Column -->
    107106
    108                 <?php endwhile; ?>
     107                                <?php endwhile; ?>
    109108
    110             <?php else : ?>
     109                        <?php else : ?>
    111110
    112                 <div class="col-12">
    113                     <p class="woocommerce-info">
    114                         No products were found.
    115                     </p>
    116                 </div>
     111                                <div class="col-12">
     112                                        <p class="woocommerce-info">
     113                                                No products were found.
     114                                        </p>
     115                                </div>
    117116
    118             <?php endif; ?>
     117                        <?php endif; ?>
    119118
    120         </div>
     119                </div>
    121120
    122         <?php
    123         // Pagination.
    124         if ( $shop_query->max_num_pages > 1 ) :
     121                <?php
     122                // Pagination.
     123                if ( $shop_query->max_num_pages > 1 ) :
    125124
    126             $pagination = paginate_links(
    127                 array(
    128                     'base'      => str_replace(
    129                         999999999,
    130                         '%#%',
    131                         esc_url( get_pagenum_link( 999999999 ) )
    132                     ),
    133                     'format'    => '?paged=%#%',
    134                     'current'   => $current_page,
    135                     'total'     => $shop_query->max_num_pages,
    136                     'type'      => 'list',
    137                     'prev_text' => '&larr; Previous',
    138                     'next_text' => 'Next &rarr;',
    139                 )
    140             );
     125                        $pagination = paginate_links(
     126                                array(
     127                                        'base'      => str_replace(
     128                                                999999999,
     129                                                '%#%',
     130                                                esc_url( get_pagenum_link( 999999999 ) )
     131                                        ),
     132                                        'format'    => '?paged=%#%',
     133                                        'current'   => $current_page,
     134                                        'total'     => $shop_query->max_num_pages,
     135                                        'type'      => 'list',
     136                                        'prev_text' => '&larr; Previous',
     137                                        'next_text' => 'Next &rarr;',
     138                                )
     139                        );
    141140
    142             if ( $pagination ) :
    143                 ?>
    144                 <nav class="delta-shop-pagination" aria-label="Shop pagination">
    145                     <?php echo wp_kses_post( $pagination ); ?>
    146                 </nav>
    147                 <?php
    148             endif;
     141                        if ( $pagination ) :
     142                                ?>
     143                                <nav class="delta-shop-pagination" aria-label="Shop pagination">
     144                                        <?php echo wp_kses_post( $pagination ); ?>
     145                                </nav>
     146                                <?php
     147                        endif;
    149148
    150         endif;
    151         ?>
     149                endif;
     150                ?>
    152151
    153     </div>
     152        </div>
    154153</div>
    155154
Note: See TracChangeset for help on using the changeset viewer.