• Resolved Guido

    (@guido07111975)


    Hi,

    Very nice plugin! Really helpful.

    I have a comment/question about the widget title in all 3 widget files:

    <?php
        if (!empty($instance['title']))
        {
            if (isset($args['before_title']))
            {
                echo $args['before_title'];
                echo $instance['title'];
                echo $args['after_title'];
            } else
            {
                ?>
                <h3 class="widget-title"><?php echo $instance['title'] ?></h3>
                <?php
            }
        }
        ?>

    My theme does support the before and after title but still the h3 widget-title is displayed.

    So I removed the whole h3 widget-title part and noticed the before and after title isn’t loaded at all.

    So there must be something wrong somewhere in your widget code. Or am I missing something?

    Guido

    https://wordpress.org/plugins/woocommerce-currency-switcher/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author RealMag777

    (@realmag777)

    Hello Guido

    Of course – leave it as is, in your case showing code: <h3 class="widget-title"><?php echo $instance['title'] ?></h3> – as it should be id before_title is not supported. Really I not understood where is the trouble – title is showing – so it is ok …

    Guido

    (@guido07111975)

    I mean, the before and after title isn’t loaded.

    Have done a new test with Twenty Sixteen, with the same result.

    Before title should be:

    'before_title'  => '<h2 class="widget-title">',

    After title should be:

    'after_title'   => '</h2>',

    Guido

    Plugin Author RealMag777

    (@realmag777)

    Hello Guido

    Understood:
    Here wp-content\plugins\woocommerce-currency-switcher\classes\widgets\widget-woocs-selector.php change code of public function widget to:

    public function widget($args, $instance)
        {
            $data = array();
            $data['args'] = $args;
            $data['instance'] = $instance;
            wp_enqueue_script('jquery');
            global $WOOCS;
            echo $WOOCS->render_html(WOOCS_PATH . 'views/widgets/selector.php', $data);
        }

    Guido

    (@guido07111975)

    Works, great.

    Guess you will update plugin asap too?

    Guido

    Plugin Author RealMag777

    (@realmag777)

    Welcome! With the next update will …

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘The widget title in your widget files’ is closed to new replies.