Okay
  Public Ticket #2035988
Standard date instead of standard icon
Closed

Comments

  •  2
    gehess started the conversation

    Hi together,

    is it somehow possible to set date as standard for a calendar instead of standard icon? so far, I have to choose it for every single event.

    Thanks

  •  877
    Zhivko replied

    In your theme functions.php file add following action:

    add_action('stec_admin_addedit_event_tab_content', function($event) {
        if (false === $event) {         // Default start date and end date
            // YYYY-MM-DD;
            $default_start_date = "2019-12-31";
            
            ?>
            <script type="text/javascript">
                (function ($) {
                    $(function () {
                        $('input[name="start_date"], input[name="end_date"]').datepicker('setDate', '<?php echo $default_start_date; ?>');
                    });
                })(jQuery);
            </script>
            <?php
        }
    });

    Edit 

    $default_start_date = "2019-12-31";

    to desired default start date.


    Stachethemes Developer

  •  2
    gehess replied

    Thanks for your answer, but it looks like a misunderstanding. I don´t want to have the same date for each event. What I´d like to achieve is following: when you go to dashbord -> "calendar" you have the possibility to choose a standard icon. Now if you create an event you can choose "date" instead of "icon" but you have to chosse it every single time you create a new event. Question is, if this could be set somewhere globally so that you don´t have to always choose it?

    Thanks

  •  877
    Zhivko replied

    This makes more sense now.

    The code is following:

    add_action('stec_admin_addedit_event_tab_content', function($event) {
        if (false === $event) {
            ?>
            <script type="text/javascript">
                (function ($) {
                    $(function () {
                        $('select[name="icon_type"]').val('date').trigger('change');
                    });
                })(jQuery);
            </script>
            <?php
        }
    });

    Stachethemes Developer

  •  2
    gehess replied

    Perfect! Thank you very much!