Plugin Directory

Changeset 2596167


Ignore:
Timestamp:
09/09/2021 12:02:22 PM (4 years ago)
Author:
sergmoro1
Message:

Fix Sum widget to display for all posts and pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lisette-cost-calculator/trunk/Sum.php

    r1749731 r2596167  
    3737     */
    3838    public function widget( $args, $instance ) {
    39         // show widget only on page cost-calculator
    40         $pagename = get_query_var('pagename');
    41         if ( is_page() && $pagename == 'cost-calculator' ) {
    42             $title = apply_filters( 'widget_title', $instance['title'] );
     39        $title = apply_filters( 'widget_title', $instance['title'] );
    4340
    44             echo $args['before_widget'];
     41        echo $args['before_widget'];
    4542
    46             if ( ! empty( $title ) )
    47                 echo $args['before_title'] . $title . $args['after_title'];
    48            
    49             $view = dirname( __FILE__ ) . '/views/cost_calculator_sum.php';
    50             if( file_exists( $view ) )
    51                 include_once( $view );
    52             else
    53                 echo __('No view file found!', 'lcc');
    54            
    55             echo $args['after_widget'];
    56         }
     43        if (!empty($title)) {
     44            echo $args['before_title'] . $title . $args['after_title'];
     45        }
     46        $view = __DIR__ . '/views/cost_calculator_sum.php';
     47        if (file_exists($view)) {
     48            include_once($view);
     49        } else {
     50            echo __('No view file found!', 'lcc');
     51        }
     52        echo $args['after_widget'];
    5753    }
    5854
Note: See TracChangeset for help on using the changeset viewer.