<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }

define( 'TRIPTIP_PARENT_DIR', get_template_directory() );
define( 'TRIPTIP_CHILD_DIR', get_stylesheet_directory() );
define( 'TRIPTIP_INCLUDES_DIR', TRIPTIP_PARENT_DIR . '/framework' );
define( 'TRIPTIP_CSS_DIR', TRIPTIP_PARENT_DIR . '/css' );
define( 'TRIPTIP_JS_DIR', TRIPTIP_PARENT_DIR . '/js' );
define( 'TRIPTIP_LANGUAGES_DIR', TRIPTIP_PARENT_DIR . '/languages' );
define( 'TRIPTIP_WIDGETS_DIR', TRIPTIP_INCLUDES_DIR . '/widgets' );
define( 'TRIPTIP_ELEMENTOR_DIR', TRIPTIP_INCLUDES_DIR . '/elementor' );
define( 'TRIPTIP_ELEMENTOR_WIDGETS_DIR', TRIPTIP_ELEMENTOR_DIR . '/widgets' );

/**
 * Define URL Location Constants
 */
define( 'TRIPTIP_PARENT_URL', get_template_directory_uri() );
define( 'TRIPTIP_CHILD_URL', get_stylesheet_directory_uri() );
define( 'TRIPTIP_INCLUDES_URL', TRIPTIP_PARENT_URL . '/framework' );
define( 'TRIPTIP_CSS_URL', TRIPTIP_PARENT_URL . '/css' );
define( 'TRIPTIP_JS_URL', TRIPTIP_PARENT_URL . '/js' );
define( 'TRIPTIP_LANGUAGES_URL', TRIPTIP_PARENT_URL . '/languages' );
define( 'TRIPTIP_WIDGETS_URL', TRIPTIP_INCLUDES_URL . '/widgets' );
define( 'TRIPTIP_ELEMENTOR_URL', TRIPTIP_INCLUDES_URL . '/elementor' );
define( 'TRIPTIP_ELEMENTOR_WIDGETS_URL', TRIPTIP_ELEMENTOR_URL . '/widgets' );


if(class_exists( 'Menu_Item_Custom_Fields' )){

  require_once TRIPTIP_INCLUDES_DIR  . '/menu-item-custom-fields.php';

}

require_once TRIPTIP_INCLUDES_DIR . '/meta-box.php';
require_once TRIPTIP_INCLUDES_DIR . '/triptip_bootstrap_navwalker.php';
require_once TRIPTIP_INCLUDES_DIR . '/import.php';
require_once TRIPTIP_INCLUDES_DIR . '/customize.php';

/**
 * Set the content width based on the theme's design and stylesheet.
 */
if ( ! isset( $content_width ) ) {

  $content_width = 900;

}

// Set up theme support
function triptip_setup() {

	add_theme_support( 'post-thumbnails' );
  add_image_size( 'triptip-thumb', 500, 360, true );
	add_theme_support( 'automatic-feed-links' );
	add_theme_support( 'title-tag' );
  add_theme_support( 'custom-header');
  add_theme_support( 'custom-background');
	add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
	add_theme_support( 'custom-logo' );
	
  // This theme uses wp_nav_menu() in two locations.
  register_nav_menus( array(
    'primary'    => esc_html__( 'Primary Menu', 'triptip' ),
    'right-menu' => esc_html__( 'Top Right Menu', 'triptip' ),
  ) );
  add_theme_support( 'editor-styles' );
  add_editor_style( 'css/style-editor.css' );
	load_theme_textdomain( 'triptip', get_template_directory() . '/languages' );

}

add_action( 'after_setup_theme', 'triptip_setup' );


// Theme Scripts & Styles
function triptip_scripts_styles() {

  wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/bootstrap.min.css');
  wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/css/font-awesome.min.css');
  wp_enqueue_style( 'line-awesome', get_template_directory_uri().'/css/line-awesome.min.css');
  wp_enqueue_style( 'owl-carousel', get_template_directory_uri().'/css/owl.carousel.css');
  wp_enqueue_style( 'owl-theme', get_template_directory_uri().'/css/owl.theme.css');
  wp_enqueue_style( 'jquery-ui', get_template_directory_uri().'/css/jquery-ui.min.css');
  wp_enqueue_style( 'flexslider', get_template_directory_uri().'/css/flexslider.css');
  wp_enqueue_style( 'select2', get_template_directory_uri().'/css/select2.min.css');
  wp_enqueue_style( 'magnific-popup', get_template_directory_uri().'/css/magnific-popup.css');
	wp_enqueue_style( 'triptip-default', get_template_directory_uri().'/css/style.css');
  wp_enqueue_style( 'triptip', get_stylesheet_uri() );

  if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 
    // enqueue the javascript that performs in-link comment reply fanciness
    wp_enqueue_script( 'comment-reply' ); 
  }
  
	wp_enqueue_script('jquery-ui-core');
 	wp_enqueue_script('masonry');
  $key = get_theme_mod('map_api');
  if(isset($key) and $key !=''){
    wp_enqueue_script("googleapis", "https://maps.googleapis.com/maps/api/js?key=".get_theme_mod('map_api'),array('jquery'),false,true);
  }else{
    wp_enqueue_script("googleapis", "https://maps.googleapis.com/maps/api/js",array('jquery'),false,true);
  }
  wp_enqueue_script("select2", get_template_directory_uri()."/js/select2.min.js",array('jquery'),false,true);
  wp_enqueue_script("owl-carousel", get_template_directory_uri()."/js/owl.carousel.min.js",array('jquery'),false,true);
  wp_enqueue_script("isotope", get_template_directory_uri()."/js/jquery.isotope.min.js",array('jquery'),false,true);
  wp_enqueue_script("appear", get_template_directory_uri()."/js/jquery.waypoints.min.js",array('jquery'),false,true);
  wp_enqueue_script("waypoints", get_template_directory_uri()."/js/jquery.appear.js",array('jquery'),false,true);
  if(isset($key) and $key !=''){
    wp_enqueue_script("infobox", get_template_directory_uri()."/js/infobox.min.js",array('jquery'),false,true);
  }
  wp_enqueue_script("magnific-popup", get_template_directory_uri()."/js/jquery.magnific-popup.min.js",array('jquery'),false,true);
  wp_enqueue_script("markerclusterer", get_template_directory_uri()."/js/markerclusterer.js",array('jquery'),false,true);
  wp_enqueue_script("bootstrap", get_template_directory_uri()."/js/bootstrap.min.js",array('jquery'),false,true);
  wp_enqueue_script("popper", get_template_directory_uri()."/js/popper.js",array('jquery'),false,true);
  wp_enqueue_script("countto", get_template_directory_uri()."/js/jquery.countTo.js",array('jquery'),false,true);
  wp_enqueue_script("ajax-form", get_template_directory_uri()."/js/jquery.form.min.js",array('jquery'),false,true);
  wp_enqueue_script("triptip-script", get_template_directory_uri()."/js/script.js",array('jquery'),false,true);

}

add_action( 'wp_enqueue_scripts', 'triptip_scripts_styles' );

function triptip_load_custom_wp_admin_style() {

  wp_register_style( 'line-awesome', get_template_directory_uri().'/css/line-awesome.min.css', false, '1.0.0' );
  wp_enqueue_style( 'line-awesome' );
  
}

add_action( 'admin_enqueue_scripts', 'triptip_load_custom_wp_admin_style' );

/* Function which displays your post date in time ago format */
function triptip_time_ago() {

  return human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ).' '.esc_html__( 'ago','triptip' );

}

//Location Map
function triptip_locations_script() {
  $locations = array();
  if(is_post_type_archive() or is_tax()){
    while(have_posts()) : the_post();
      if(get_post_type()=='listing'){
        $address = get_post_meta(get_the_ID(), '_triptip_address', true);
        $locations[] = array('locations',
        'pin' => array(get_the_permalink(), get_the_post_thumbnail_url(get_the_id(),'thumbnail'),get_the_title(), 'Coffee', 'Closed', $address, '2', '7.9'),
          'lat' => get_post_meta(get_the_ID(), '_triptip_latitude', true),
          'lon' => get_post_meta(get_the_ID(), '_triptip_longitude', true),
          'icon' => get_post_meta(get_the_ID(), '_triptip_mapicon', true)
        );
      }
    endwhile;
  }elseif(is_search()){
    $q = sanitize_text_field( $_GET['s'] );// get the searched query
    $cat = !empty($_GET['in_cat']) ? sanitize_text_field($_GET['in_cat']) : 'all';
    $loc = !empty($_GET['in_loc']) ? sanitize_text_field($_GET['in_loc']) : 'all';
    $args = array(
      'post_type'     => 'listing',
      'post_status'   => 'publish',
      's'             => $q,
    );
    $tax_queries=array();

    if( $cat!='all') {
      /*@todo; add option to the settings panel to let user choose whether to include result from children or not*/
      $tax_queries[] = array(
          'taxonomy'         => 'listing-category',
          'field'            => 'slug',
          'terms'            => $cat,
          'include_children' => true, /*@todo; Add option to include children or exclude it*/
      );

    }

    if( $loc!='all' ) {
      /*@todo; add option to the settings panel to let user choose whether to include result from children or not*/
      $tax_queries[] = array(
        'taxonomy'         => 'listing-region',
        'field'            => 'slug',
        'terms'            => $loc,
        'include_children' => true, /*@todo; Add option to include children or exclude it*/
      );

    }

    if (function_exists('is_empty_v') and !is_empty_v($tax_queries)){
      $args['tax_query'] = $tax_queries;
    }
      
    $listing = new WP_Query($args);
    while($listing->have_posts()) : $listing->the_post();
      if(get_post_type()=='listing'){
        $address = get_post_meta(get_the_ID(), '_triptip_address', true);
        $locations[] = array('locations',
        'pin' => array(get_the_permalink(), get_the_post_thumbnail_url(get_the_id(),'thumbnail'),get_the_title(), 'Coffee', 'Closed', $address, '2', '7.9'),
          'lat' => get_post_meta(get_the_ID(), '_triptip_latitude', true),
          'lon' => get_post_meta(get_the_ID(), '_triptip_longitude', true),
          'icon' => get_post_meta(get_the_ID(), '_triptip_mapicon', true)
        );
      }
    endwhile;
  }else{
    $args = array(
              'post_type'     => 'listing',
              'post_status'   => 'publish',
            );
    $listing = new WP_Query($args);
    $locations = array();

    while($listing->have_posts()) : $listing->the_post();

      $address = get_post_meta(get_the_ID(), '_triptip_address', true);
      $locations[] = array('locations',
        'pin' => array(get_the_permalink(), get_the_post_thumbnail_url(get_the_id(),'thumbnail'),get_the_title(), 'Coffee', 'Closed', $address, '2', '7.9'),
        'lat' => get_post_meta(get_the_ID(), '_triptip_latitude', true),
        'lon' => get_post_meta(get_the_ID(), '_triptip_longitude', true),
        'icon' => get_post_meta(get_the_ID(), '_triptip_mapicon', true)
      );

    endwhile;
  }
  
  $locations_str = json_encode($locations);
  $params = array(
    'locations' => $locations_str,
  );
  wp_enqueue_script('triptip-main-map', get_template_directory_uri()."/js/main-map.js",array('jquery'),false,true);
  wp_localize_script('triptip-main-map', 'locations_str', $params);

}

add_action( 'wp_enqueue_scripts', 'triptip_locations_script' );


/* add admin-ajax */
function triptip_custom_head(){
  echo '<script type="text/javascript">var ajaxurl = \'' . admin_url('admin-ajax.php') . '\';</script>';
}
add_action('wp_head', 'triptip_custom_head');



function triptip_masonry_load(){
  global $triptip_options;
  $response = '';
  $cat = $_POST['cat'];
  $loc = $_POST['loc'];
  $order = $_POST['order'];
  $offset = $_POST['offset'];
  $layout = $_POST['layout'];
  $args = array(
    'post_type' => 'listing',
    'posts_per_page' =>$order,
    'post_status' => 'publish',
    'no_found_rows' => true,
    'offset' =>$offset,
    
  );
  
  $tax_queries=array();

  if( $cat!='all') {
      /*@todo; add option to the settings panel to let user choose whether to include result from children or not*/
      $tax_queries[] = array(
          'taxonomy'         => 'listing-category',
          'field'            => 'slug',
          'terms'            => $cat,
          'include_children' => true, /*@todo; Add option to include children or exclude it*/
      );

  }

  if( $loc!='all' ) {
      /*@todo; add option to the settings panel to let user choose whether to include result from children or not*/
      $tax_queries[] = array(
          'taxonomy'         => 'listing-region',
          'field'            => 'slug',
          'terms'            => $loc,
          'include_children' => true, /*@todo; Add option to include children or exclude it*/
      );

  }

  if (!is_empty_v($tax_queries)){
    $args['tax_query'] = $tax_queries;
  }
  $portfolio = new WP_Query($args);
?>  

<?php 
    $locations = array();
    if($portfolio->have_posts()) :
             $i=1; while($portfolio->have_posts()) : $portfolio->the_post(); 
    ?>
    <?php
      $address = get_post_meta(get_the_ID(), '_triptip_address', true);
      $locations[] = array('locations',
        'pin' => array(get_the_permalink(), get_the_post_thumbnail_url(get_the_id(),'thumbnail'),get_the_title(), 'Coffee', 'Closed', $address, '2', '7.9'),
        'lat' => get_post_meta(get_the_ID(), '_triptip_latitude', true),
        'lon' => get_post_meta(get_the_ID(), '_triptip_longitude', true),
        'icon' => get_post_meta(get_the_ID(), '_triptip_mapicon', true)
      );
    ?>
    <div class="item">
      <?php if($layout=='list'){ ?>

        <!-- place-post module -->
        <div class="place-post list-style">
          <div class="place-post__gal-box">
            <?php the_post_thumbnail('', ['class' => 'place-post__image']); ?>
            <?php triptip_post__ratings_get_average(get_the_ID()); ?>
            <?php if( function_exists('get_simple_likes_button') ) echo get_simple_likes_button(get_the_ID());?>
          </div>
          <div class="place-post__content">
            <?php if( function_exists('qkl_working_status') ){ qkl_working_status(); } ?>
            <h2 class="heading2 place-post__title">
              <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            </h2>
            <p class="place-post__description">
              <?php 
                if( function_exists('qkl_listing_category') ){ qkl_listing_category(get_the_ID()); }
              ?>
              <?php if( function_exists('triptip_price_range') ){  triptip_price_range(); }  ?>

              <span class="place-post__description-review">
                <i class="fa fa-comment-o" aria-hidden="true"></i>
                <?php comments_number( esc_html__('0 Reviews','triptip'), esc_html__('1 Review','triptip'), esc_html__('% Reviews','triptip') ); ?>
              </span>
            </p>
            <p class="place-post__text">
              <?php echo triptip_excerpt($limit = 20); ?>
            </p>
            <?php if(get_post_meta(get_the_ID(), '_triptip_address',true)!=''){ ?>
              <p class="place-post__address">
                <i class="fa fa-map-marker" aria-hidden="true"></i>
                <?php echo esc_html(get_post_meta(get_the_ID(), '_triptip_address',true)) ?>
              </p>
            <?php } ?>
          </div>
        </div>
        <!-- end place-post module -->

      <?php }else{ ?>

      <!-- place-post module -->
      <div class="place-post">
        <div class="place-post__gal-box">
          <?php the_post_thumbnail('', ['class' => 'place-post__image']); ?>
          <?php triptip_post__ratings_get_average(get_the_ID()); ?>
          
          <?php if( function_exists('get_simple_likes_button') ) echo get_simple_likes_button(get_the_ID());?>
        </div>
        <div class="place-post__content">
          <?php if( function_exists('qkl_working_status') ){ qkl_working_status(); } ?>
          <h2 class="heading2 place-post__title">
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
          </h2>
          <p class="place-post__description">
            <?php 
              if( function_exists('qkl_listing_category') ){ qkl_listing_category(get_the_ID()); }
              
            ?>
            
            <?php if( function_exists('triptip_price_range') ){  triptip_price_range(); }  ?>
            
            <span class="place-post__description-review">
              <i class="fa fa-comment-o" aria-hidden="true"></i>
              <?php comments_number( esc_html__('0 Reviews','triptip'), esc_html__('1 Review','triptip'), esc_html__('% Reviews','triptip') ); ?>
            </span>
          </p>
    		 <?php if(get_post_meta(get_the_ID(), '_triptip_address',true)){ ?>
            <p class="place-post__address">
              <i class="fa fa-map-marker" aria-hidden="true"></i>
              <?php echo get_post_meta(get_the_ID(), '_triptip_address',true); ?>
            </p>
    		 <?php } ?>
        </div>
      </div>
      <!-- end place-post module -->

      <?php } ?>
    </div>

  <?php $i++; endwhile; ?>
  <?php endif; ?>
  <?php wp_reset_postdata(); ?>
  <?php  $locations_str = json_encode($locations); ?>
  <?php  $locations_str = str_replace('&quot;', '"',$locations_str); ?>
  <div class="loaction-<?php esc_html_e($offset); ?>" id="load-location" data-locs="<?php echo esc_attr($locations_str); ?>"><div>
<?php
  echo do_shortcode($response);
  die();
}

add_action('wp_ajax_triptip_masonry_load', 'triptip_masonry_load');

add_action('wp_ajax_nopriv_triptip_masonry_load', 'triptip_masonry_load');


function triptip_search_load(){
  global $triptip_options;
  $response = '';
  $cat = $_POST['cat'];
  $loc = $_POST['loc'];
  $q = $_POST['q'];
  
  $args = array(
    'post_type'     => 'listing',
    'post_status'   => 'publish',
    's'             => $q,
  );
  
  $tax_queries=array();

  if( $cat!='all') {
      /*@todo; add option to the settings panel to let user choose whether to include result from children or not*/
      $tax_queries[] = array(
          'taxonomy'         => 'listing-category',
          'field'            => 'slug',
          'terms'            => $cat,
          'include_children' => true, /*@todo; Add option to include children or exclude it*/
      );

  }

  if( $loc!='all' ) {
      /*@todo; add option to the settings panel to let user choose whether to include result from children or not*/
      $tax_queries[] = array(
          'taxonomy'         => 'listing-region',
          'field'            => 'slug',
          'terms'            => $loc,
          'include_children' => true, /*@todo; Add option to include children or exclude it*/
      );

  }

  if (!is_empty_v($tax_queries)){
    $args['tax_query'] = $tax_queries;
  }
  
  $portfolio = new WP_Query($args);
  
?>  
<h2 class="heading2 explore__filter-title">
  <?php
  if ( is_post_type_archive() ) {
      ?>
      <span><?php esc_html_e('Results For','triptip'); ?>:</span> <?php post_type_archive_title(); ?>
      <?php
  }else{
  ?>
    <span><?php esc_html_e('Results For','triptip'); ?>:</span> '<?php echo esc_html($q); ?>'
  <?php } ?>
  <a href="<?php echo get_post_type_archive_link('event'); ?>?layout=fullmaplist">
    <i class="fa fa-list-ul" aria-hidden="true"></i>
  </a>
  <a href="<?php echo get_post_type_archive_link('event'); ?>" class="active">
    <i class="fa fa-th" aria-hidden="true"></i>
  </a>
</h2>

<div class="explore__wrap iso-call">
<?php 
      if($portfolio->have_posts()) :
             $i=1; while($portfolio->have_posts()) : $portfolio->the_post(); 
    ?>
    <div class="item">

      <!-- place-post module -->
      <div class="place-post">
        <div class="place-post__gal-box">
          <?php the_post_thumbnail('', ['class' => 'place-post__image']); ?>
          <?php if( function_exists('triptip_post__ratings_get_average') ) triptip_post__ratings_get_average(get_the_ID()); ?>
          <?php if( function_exists('get_simple_likes_button') ) echo get_simple_likes_button(get_the_ID());?>
        </div>
        <div class="place-post__content">
          <?php if( function_exists('qkl_working_status') ){ qkl_working_status(); } ?>
          <h2 class="heading2 place-post__title">
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
          </h2>
          <p class="place-post__description">

            <?php  if( function_exists('qkl_listing_category') ){ qkl_listing_category(get_the_ID()); } ?>
            <?php if( function_exists('triptip_price_range') ){  triptip_price_range(); }  ?>
            
            <span class="place-post__description-review">
              <i class="fa fa-comment-o" aria-hidden="true"></i>
              <?php comments_number( esc_html__('0 Reviews','triptip'), esc_html__('1 Review','triptip'), esc_html__('% Reviews','triptip') ); ?>
            </span>
          </p>
		 <?php if(get_post_meta(get_the_ID(), '_triptip_address',true)!=''){ ?>
          <p class="place-post__address">
            <i class="fa fa-map-marker" aria-hidden="true"></i>
            <?php echo get_post_meta(get_the_ID(), '_triptip_address',true); ?>
          </p>
	      <?php } ?>
        </div>
      </div>
      <!-- end place-post module -->
        
    </div>
  <?php $i++; endwhile; ?>
  <?php else : ?>
    <div class="blog-post not-found">
      <div class="alert alert-danger" role="alert">
        <strong><?php esc_html_e('Nothing Found Here!','triptip'); ?></strong> <?php esc_html_e('Search with other keyword:', 'triptip') ?>
      </div>
    </div>
  <?php endif; ?>
 
</div>
<?php if($portfolio->found_posts>0){ ?>
<div class="center-button">
  <a class="btn-default btn-default-red load-more" 
    data-cat="<?php echo esc_attr($cat); ?>" 
    data-loc="<?php echo esc_attr($loc); ?>" 
    data-load="<?php echo get_option( 'posts_per_page' ); ?>" 
    data-found="<?php echo esc_attr($portfolio->found_posts); ?>"
    href="#">
    <i class="fa fa-refresh"></i>
    <?php esc_html_e('Load More Listing', 'triptip'); ?>
  </a>
</div>
<?php } ?>
 <?php wp_reset_postdata(); ?>
<?php 
  echo do_shortcode($response);
  die();
}

add_action('wp_ajax_triptip_search_load', 'triptip_search_load');

add_action('wp_ajax_nopriv_triptip_search_load', 'triptip_search_load');

// Register Elementor Locations
function triptip_register_elementor_locations( $elementor_theme_manager ) {

	$elementor_theme_manager->register_all_core_location();

};

add_action( 'elementor/theme/register_locations', 'triptip_register_elementor_locations' );

function triptip_excerpt($limit = 30) {
 
  $excerpt = explode(' ', get_the_excerpt(), $limit);
  if (count($excerpt)>=$limit) {
    array_pop($excerpt);
    $excerpt = implode(" ",$excerpt).' [...]';
  } else {
    $excerpt = implode(" ",$excerpt);
  }
  $excerpt = preg_replace('`[[^]]*]`','',$excerpt);
  return $excerpt;
}

function triptip_elementor_categories() {

  $output     = array();
  $categories = get_categories();
  $output[  ] = 'Select';

  foreach ( $categories as $category ) {

    $output[ $category->term_id ] = $category->name;

  }

  return $output;
}


/**
 * Display custom color CSS.
 */
function triptip_colors_css_wrap() {
    global  $wp_query;
    $main_color = get_theme_mod( 'main_color','#fb646f'); 
    $header_img = get_header_image();
    $logo_dimensions = get_theme_mod('logo_dimensions');
?>
    <style type="text/css" id="custom-theme-colors">
        <?php 
            $css="
              .btn-default:hover,.btn-default-red,.text-btn:hover,.text-btn-grey:hover,.top-experience .owl-theme .owl-controls .owl-buttons div:hover,.banner a.btn-default,.testimonial .owl-theme .owl-controls .owl-buttons div:hover,.testimonial-background-img .owl-theme .owl-controls .owl-buttons div:hover,.dark-section .statistic-post__icon,.testimonial-background-map .owl-theme .owl-controls .owl-buttons div:hover,.tabs-block__list-item a.active-list,header.white-header-style a.btn-default,.search-form__submit,.dropdown > li > a:hover, .megadropdown ul > li > a:hover,.discover__form-updated button:hover,.place-gal__title a:hover,.services-post:hover .services-post__content i,.services-post:hover .services-post__title,.services-post2 i,.services-post3:hover .services-post3__title,.services-post3:hover i,.place-post__like.active, .place-post__like:hover,.place-post__title a:hover,.place-post__description span i.red-col,.event-post__like:hover,.event-post__title a:hover,.testimonial-post__quote,.statistic-post__icon-primary,.news-post__title a:hover,.news-post__tags li a:hover,.news-post .text-btn,.article-post__excerpt,.category-post__list-num:hover,.explore__filter-title a.active,.explore__form-desc a:hover,.listing-detail__buttons-icons a,.listing-detail__dollar-rate i.red-col,.listing-detail__gallery-inner .owl-theme .owl-controls .owl-buttons div:hover,.listing-detail__content-title a,.listing-detail__galleria > a:hover,.listing-detail__photos a.load-others,.reviews-list__item-reply:hover,.author-wrapper__title a:hover,.user-detail__profile-title a:hover,.user-detail__review .owl-theme .owl-controls .owl-buttons div:hover, .user-detail__follow .owl-theme .owl-controls .owl-buttons div:hover,.user-detail a.text-btn span,.review-item__post-title a:hover, .review-item__reply:hover,.cities-post__title a:hover,.add-listing__submit,.blog-post__list-item a:hover,.tagcloud a:hover,.sidebar__category-list li a:hover,.sidebar__tags-list li a:hover,.sidebar__popular-list-title a:hover,.sidebar__listing-list li span.color-close,.single-post__list-item a:hover,.single-post__quote:before,.author-post-box__title a:hover,.other-posts__prev:hover i, .other-posts__next:hover i,.comments__list-item-reply:hover,.contact-form__submit,.contact-form__rate-bx i.active,
  .contact-form__rate-bx i.selected,.contact-form__input-file:hover + span,.contact-post i,.sign-form__submit,.error__title,.footer__subscribe-button,.footer__subscribe-button-primary,.footer__subscribe-button:hover,.footer__social-list li a:hover,a:hover.post-password-form input[type='submit'],.wpcf7-form input[type='submit'], #wp-submit, .wpuf-submit-button,.btn-default-grey,.listing-detail__gal .sl-button.liked,.listing-detail__title-box .sl-button,.sidebar .category-widget ul li a:hover, .widget_recent_entries ul li a:hover, .widget_recent_comments ul li a:hover, .widget_archive ul li a:hover, .widget_categories ul li a:hover, .widget_meta ul li a:hover, .widget_pages ul li a:hover, .widget_rss ul li a:hover, .widget_nav_menu ul li a:hover, .product-categories li a:hover, .widget_featured_posts ul li a:hover,.sidebar .search-widget button i,.comment-reply-link:hover,#respond input[type='submit'],.read-more,.place-post__gal-box .sl-button.liked i,.search-widget button i,.pagination-list li .current, .pagination-list li a:hover,.listing-detail__buttons-icons > a, .listing-detail__buttons-icons div > a{
                color: $main_color;
              }
              .testimonial-post__quote{
                line-height: 1.4;
              }
              .btn-default-red,.cluster-visible:before,.circle-icon-item,header.white-header-style .navbar-nav > li > a.active,
header.white-header-style .navbar-nav > li > a:hover,header.white-header-style a.btn-default,.discover__form-input-favourite:focus,.services-post:hover .services-post__content,.services-post2:hover,.services-post3:hover,.explore__filter-title a.active,.explore__form-input:hover,.listing-detail__buttons a.btn-default-red:hover,.reviews-list__item-reply:hover,.user-detail__profile-btn:hover, .user-detail__profile-btn.following, .review-item__reply:hover,.add-listing__input:focus, .add-listing__textarea:focus,.add-listing__submit:hover,.contact-form__input-text:hover, .contact-form__textarea:hover,.contact-form__submit:hover,.contact-form__input-file:hover + span,.sign-form__input-text:hover,.sign-form__submit:hover,.btn-default-grey:hover,.post-password-form input[type='submit']:hover,.listing-detail__title-box .sl-button.liked,.wpcf7-form input[type='submit']:hover, #wp-submit:hover, .wpuf-submit-button:hover,.input:focus,.wpcf7-form input[type='text']:focus,.wpcf7-form input[type='password']:focus,.wpcf7-form input[type='email']:focus,.wpcf7-form input[type='search']:focus,.wpcf7-form textarea:focus,.sidebar input[type='text']:focus,.sidebar  input[type='email']:focus,.sidebar input[type='password']:focus,.sidebar input[type='search']:focus,.sidebar input[type='number']:focus,.sidebar input[type='url']:focus,.sidebar  textarea:focus,#respond input[type='text']:focus,#respond  input[type='email']:focus,#respond input[type='password']:focus,#respond input[type='search']:focus,#respond input[type='number']:focus,#respond input[type='url']:focus,#respond textarea:focus,#respond input[type='submit']:hover.search-widget input[type='search']:focus,#respond input[type='submit']:hover{
                border-color: $main_color;
              }
              .btn-default-red:hover{
                color: #fff;
              }
              .top-experience-white .owl-theme .owl-controls .owl-page.active span,.banner,.about .owl-theme .owl-controls .owl-page.active span,.infoBox-close:hover,.marker-holder:hover .circle-icon-item,
              .marker-box.clicked .circle-icon-item,.custom-zoom-in:hover,
              .custom-zoom-out:hover,#geoLocation:hover,
              #streetView:hover,
              #scrollEnabling:hover,
              #scrollEnabling.enabled,
              #mapnav-buttons a:hover,header.white-header-style a.btn-default:hover,.section-header__title:after,.discover__form-updated button,.discover-best .owl-theme .owl-controls .owl-page.active span,.select2-container--default .select2-results__option--highlighted[aria-selected],.services-post,.event-post__date,.how-work-post__icon,.how-work-post2__icon i,.explore__form-price-list li a.active,
    .explore__form-price-list li a:hover,.listing-detail__buttons-icons a:hover,.user-detail__profile-btn:hover, .user-detail__profile-btn.following,.add-listing__submit:hover,.contact-form__submit:hover,.sign-form__submit:hover,table td#today,.post-password-form input[type='submit']:hover,.wpcf7-form input[type='submit']:hover, #wp-submit:hover, .wpuf-submit-button:hover,#respond input[type='submit']:hover,.sl-button.liked,.btn-default-red:hover,.listing-detail__title-box .default-listing.listing-detail__buttons .sl-button:hover,.listing-detail__title-box .default-listing.listing-detail__buttons .sl-button.liked,.listing-detail__buttons-icons > a:hover, .listing-detail__buttons-icons div > a:hover{
                background-color: $main_color;
              }
              .border-arrow-btm,.dropdown,.megadropdown,.listing-detail__menu-top-border li a.active,
    .listing-detail__menu-top-border li a:hover,.user-detail__scroll-menu li a.active,
      .user-detail__scroll-menu li a:hover{
                border-top-color: $main_color;
              }
              .infoBox-close:hover{
                -webkit-text-stroke: 1px #fb646f;
              }
              .nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active,.news-post .text-btn:hover,.explore__checkbox-style:after,.listing-detail__scroll-menu li a.active,
      .listing-detail__scroll-menu li a:hover,.sign-form__checkbox-style:after{
                border-bottom-color: $main_color;
              }
              .explore__checkbox-style:after,.sign-form__checkbox-style:after{
                border-left-color: $main_color;
              }
              
            ";
            $term_id = get_queried_object()->term_id;
            $term_bg = get_term_meta($term_id, 'qkl_region_banner', true);
            if($term_id!=''){
              $css .="
                .term-$term_id #map{

                  background-image: url($term_bg);
                  
                }
                .term-$term_id #map{
                  background-size: cover;
                }
              ";
            }
            if($logo_dimensions){
              $css .="
                .navbar-brand img{
                  max-width: ".$logo_dimensions['max-width'].";
                }
              ";
            }
            echo do_shortcode($css);
        ?>
    </style>
<?php }
add_action( 'wp_head', 'triptip_colors_css_wrap' );


//pagination
function triptip_pagination($prev = '', $next = '', $pages='') {

    global $wp_query, $wp_rewrite;
    $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
    if($pages==''){
        global $wp_query;
         $pages = $wp_query->max_num_pages;
         if(!$pages)
         {
             $pages = 1;
         }
    }if(is_front_page() and !is_home()) {
    $curent = (get_query_var('page')) ? get_query_var('page') : 1;
  } else {
    $curent = (get_query_var('paged')) ? get_query_var('paged') : 1;
  }
    $pagination = array(
      'base'      => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
      'format'    => '',
      'current'     => max( 1, $curent),
      'total'     => $pages,
      'prev_text' => $prev,
      'next_text' => $next,
      'type'      => 'list',
      'end_size'    => 2,
      'mid_size'    => 1
  );
    $return =  paginate_links( $pagination );
  echo str_replace( "<ul class='page-numbers'>", '<ul class="pagination-list">', $return );
  
}

add_filter('wp_list_categories', 'triptip__span_cat_count');

function triptip__span_cat_count($links) {

  $links = str_replace('</a> (', '</a> <span>(', $links);
  $links = str_replace(')', ')</span>', $links);
  return $links;

}


/* Header */
function triptip_header() {

  global $wp_query;
  $header_layout = get_post_meta($wp_query->get_queried_object_id(), '_triptip_header_layout', true);

  if($header_layout!='' and $header_layout!='1'){

      $header_layout = $header_layout;

  }else{ 

    $header_layout = get_theme_mod( 'header_layout', '1' );

  }

  if($header_layout!='' and $header_layout!='1'){

    $header_layout = $header_layout;

  }else{
    
    $header_layout = '1';
    
  }
   
   get_template_part('template-parts/header', $header_layout);

}

/* Header */
function triptip_listing_archive() {

  global $wp_query;
  $listing_layout = '';

  if(isset( $_GET['layout'])){

    $listing_layout = sanitize_text_field( $_GET['layout'] );

  }else{
    $listing_layout = get_theme_mod( 'listing_layout', 'fullmap' );
  }

  if($listing_layout!='' and $listing_layout!='fullmap'){

    $listing_layout = $listing_layout;

  }else{
      
      $listing_layout = 'fullmap';

  }
   
  get_template_part('explode', $listing_layout);

}


/* Single Listing */
function triptip_single_listing() {

  global $wp_query;
  $listing_layout = '';
  $single_layout = get_post_meta($wp_query->get_queried_object_id(), '_triptip_single_layout', true);
  if($single_layout!=''){

    $listing_layout = $single_layout;

  }

  if($listing_layout!='' and $listing_layout!='default'){

    $listing_layout = $listing_layout;

  }else{

    $listing_layout = get_theme_mod( 'single_layout', 'default' );

  }

  if($listing_layout!='' and $listing_layout!='default'){

    $listing_layout = $listing_layout;

  }else{
      
      $listing_layout = 'default';

  }

  get_template_part('template-parts/listing', $listing_layout);

}

function triptip_footer() {

    global $wp_query;
    $footer_layout = get_post_meta($wp_query->get_queried_object_id(), '_triptip_footer_layout', true);

    if($footer_layout!='' and $footer_layout!='1'){

      $footer_layout = $footer_layout;

    }else{ 

      $footer_layout = get_theme_mod( 'footer_layout', '1' );

    }

    if($footer_layout!='' and $footer_layout!='1'){

      $footer_layout = $footer_layout;

    }else{
      
      $footer_layout = '1';
      
    }
    
   get_template_part('template-parts/footer', $footer_layout);

}

/*
Register Fonts
*/
function triptip_fonts_url() {
    $font_url = '';
    
    /*
    Translators: If there are characters in your language that are not supported
    by chosen font(s), translate this to 'off'. Do not translate into your own language.
     */
    if ( 'off' !== _x( 'on', 'Google font: on or off', 'triptip' ) ) {
        $font_url = add_query_arg( 'family', urlencode( 'Permanent Marker:400,700' ), "//fonts.googleapis.com/css" );
    }
    return $font_url;
}


/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function triptip_widgets_init() {

  register_sidebar( array(
    'name'          => esc_html__( 'Blog sidebar', 'triptip' ),
    'id'            => 'sidebar-1',
    'description'   => esc_html__( 'Add widgets here to appear in your blog sidebar.', 'triptip' ),
    'before_widget' => '<section id="%1$s" class="sidebar__widget %2$s">',
    'after_widget'  => '</section>',
    'before_title'  => '<h2 class="heading2 sidebar__widget-title">',
    'after_title'   => '</h2>',
  ) );

  register_sidebar( array(
    'name'          => esc_html__( 'Listing sidebar', 'triptip' ),
    'id'            => 'sidebar-list',
    'description'   => esc_html__( 'Add widgets here to appear in your blog sidebar.', 'triptip' ),
    'before_widget' => '<section id="%1$s" class="sidebar__widget %2$s">',
    'after_widget'  => '</section>',
    'before_title'  => '<h2 class="heading2 sidebar__widget-title">',
    'after_title'   => '</h2>',
  ) );

  register_sidebar( array(
    'name'          => esc_html__( 'Footer 1', 'triptip' ),
    'id'            => 'footer-1',
    'description'   => esc_html__( 'Add widgets here to appear in your Footer column 1.', 'triptip' ),
    'before_widget' => '<section id="%1$s" class="footer__widget %2$s">',
    'after_widget'  => '</section>',
    'before_title'  => '<h2 class="heading2 footer__widget-title">',
    'after_title'   => '</h2>',
  ) );

  register_sidebar( array(
    'name'          => esc_html__( 'Footer 2', 'triptip' ),
    'id'            => 'footer-2',
    'description'   => esc_html__( 'Add widgets here to appear in your Footer column 2.', 'triptip' ),
    'before_widget' => '<section id="%1$s" class="footer__widget %2$s">',
    'after_widget'  => '</section>',
    'before_title'  => '<h2 class="heading2 footer__widget-title">',
    'after_title'   => '</h2>',
  ) );

  register_sidebar( array(
    'name'          => esc_html__( 'Footer 3', 'triptip' ),
    'id'            => 'footer-3',
    'description'   => esc_html__( 'Add widgets here to appear in your Footer column 3.', 'triptip' ),
    'before_widget' => '<section id="%1$s" class="footer__widget %2$s">',
    'after_widget'  => '</section>',
    'before_title'  => '<h2 class="heading2 footer__widget-title">',
    'after_title'   => '</h2>',
  ) );

}

add_action( 'widgets_init', 'triptip_widgets_init' );

/*
Enqueue scripts and styles.
*/
function triptip_font_scripts() {
  
  wp_enqueue_style( 'triptip-fonts', triptip_fonts_url(), array(), '1.0.0' );
  
}

add_action( 'wp_enqueue_scripts', 'triptip_font_scripts' );

function triptip_price_range(){
  if(qkl_get_setting('price_range')=='off'){
    return;
  }
  $range = get_post_meta(get_the_ID(), '_triptip_price_range', true);
  $max = 4;
  $off = $max - $range;
  $x =1;
  echo '<span class="listing-detail__dollar-rate">';

  do {
      
    echo '<i class="fa fa-usd red-col" aria-hidden="true"></i>';
    $x++;

  } while ($x <= $range);

  $y = 1;

  do {

    echo '<i class="fa fa-usd" aria-hidden="true"></i>';
    $y++;

  } while ($y <= $off and $off > 0);

  echo '</span>';
}

//Custom comment List:
function triptip_theme_comment($comment, $args, $depth) {
    
  $GLOBALS['comment'] = $comment; ?>
  <!--=======  COMMENTS =========-->
     
  <li <?php comment_class('reviews-list__item'); ?> id="comment-<?php comment_ID() ?>" >
    <div class="reviews-list__item-box">
      <?php if($comment->user_id!='0' and get_user_meta($comment->user_id, '_triptip_avatar' ,true)!=''){ ?>
          <?php $image = get_user_meta($comment->user_id, '_triptip_avatar' ,true); ?>
          <img class="reviews-list__item-image" src="<?php echo esc_url($image); ?>" />
      <?php }else{ ?>
        <?php echo get_avatar($comment); ?>
      <?php } ?>

      <div class="reviews-list__item-content">
        <h3 class="heading3 comments__list-item-title">
          <?php comment_author(); ?>
        </h3>
        <?php if(get_user_meta(get_the_author_meta('ID'), '_triptip_user_address' ,true)!=''){ ?>
          <span class="reviews-list__item-location">
            <?php echo get_user_meta($comment->user_id, '_triptip_user_address' ,true); ?>
          </span>
        <?php } ?>
        <span class="reviews-list__item-date">
          <?php esc_html_e('Posted', 'triptip');?> <?php printf(esc_html__('%1$s','triptip'), get_comment_date()) ?>
          <?php if( function_exists('triptip_comment_rating_number') ){ triptip_comment_rating_number(); }  ?>
        </span>
        <?php comment_text() ?>
         <?php if ($comment->comment_approved == '0') : ?>
           <em><?php esc_html_e('Your comment is awaiting moderation.','triptip') ?></em>
           <br />
        <?php endif; ?>
        <?php comment_reply_link( array_merge($args, array(
            'reply_text' => '<i class="la la-mail-forward"></i>'.esc_html__('Reply', 'triptip'),
            'depth'      => $depth,
            'max_depth'  => $args['max_depth']
            )
        )); ?>
        
      </div>
    </div>
       
<?php
}



function triptip_excerpt_more( $more ) {
  return ' [...]';
}
add_filter( 'excerpt_more', 'triptip_excerpt_more' );

/**
 * This file represents an example of the code that themes would use to register
 * the required plugins.
 *
 * It is expected that theme authors would copy and paste this code into their
 * functions.php file, and amend to suit.
 *
 * @see http://tgmpluginactivation.com/configuration/ for detailed documentation.
 *
 * @package    TGM-Plugin-Activation
 * @subpackage Example
 * @version    2.6.1 for parent theme construct for publication on ThemeForest
 * @author     Thomas Griffin, Gary Jones, Juliette Reinders Folmer
 * @copyright  Copyright (c) 2011, Thomas Griffin
 * @license    http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
 * @link       https://github.com/TGMPA/TGM-Plugin-Activation
 */

require_once get_template_directory() . '/framework/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'triptip_register_required_plugins' );
/**
 * Register the required plugins for this theme.
 *
 * In this example, we register two plugins - one included with the TGMPA library
 * and one from the .org repo.
 *
 * The variable passed to tgmpa_register_plugins() should be an array of plugin
 * arrays.
 *
 * This function is hooked into tgmpa_init, which is fired within the
 * TGM_Plugin_Activation class constructor.
 */
function triptip_register_required_plugins() {
    /**
     * Array of plugin arrays. Required keys are name and slug.
     * If the source is NOT from the .org repo, then source is also required.
     */
    $plugins = array(
             // This is an example of how to include a plugin from a private repo in your theme.

        array(            
            'name'               => esc_html__('QK Listing Tools', 'triptip' ), // The plugin name.
            'slug'               => 'qkl', // The plugin slug (typically the folder name).
            'source'             => get_template_directory() . '/framework/plugins/qkl.zip', // The plugin source.
            'required'           => true, // If false, the plugin is only 'recommended' instead of required.
        ),array(            
            'name'               => esc_html__('WordPress Post Like System','triptip'), // The plugin name.
            'slug'               => 'WordPress-Post-Like-System', // The plugin slug (typically the folder name).
            'source'             => get_template_directory() . '/framework/plugins/WordPress-Post-Like-System.zip', // The plugin source.
            'required'           => true, // If false, the plugin is only 'recommended' instead of required.
        ),array(            
            'name'               => esc_html__('Menu Item Custom Fields','triptip'), // The plugin name.
            'slug'               => 'wp-menu-item-custom-fields', // The plugin slug (typically the folder name).
            'source'             => get_template_directory() . '/framework/plugins/wp-menu-item-custom-fields.zip', // The plugin source.
            'required'           => true, // If false, the plugin is only 'recommended' instead of required.
        ),
        
        // This is an example of how to include a plugin from the WordPress Plugin Repository.
    
       array(
            'name'      => esc_html__( 'Kirki', 'triptip' ),
            'slug'      => 'kirki',
            'required'  => true,
        ), array(
            'name'      => esc_html__( 'Elementor Page Builder', 'triptip' ),
            'slug'      => 'elementor',
            'required'  => true,
        ), array(
            'name'      => esc_html__( 'WP User Frontend', 'triptip' ),
            'slug'      => 'wp-user-frontend',
            'required'  => true,
        ),array(
            'name'      => esc_html__( 'CMB2', 'triptip' ),
            'slug'      => 'cmb2',
            'required'  => true,
        ),array(
            'name'      => esc_html__( 'Easy Google Fonts', 'triptip' ),
            'slug'      => 'easy-google-fonts',
            'required'  => false,
        ),array(
            'name'      => esc_html__( 'Contact Form 7', 'triptip' ),
            'slug'      => 'contact-form-7',
            'required'  => true,
        ),array(
            'name'      => esc_html__( 'One Click Demo Import', 'triptip' ),
            'slug'      => 'one-click-demo-import',
            'required'  => true,
        )
    );

    /**
     * Array of configuration settings. Amend each line as needed.
     * If you want the default strings to be available under your own theme domain,
     * leave the strings uncommented.
     * Some of the strings are added into a sprintf, so see the comments at the
     * end of each line for what each argument will be.
     */
    $config = array(
        'default_path' => '',                      // Default absolute path to pre-packaged plugins.
        'menu'         => 'tgmpa-install-plugins', // Menu slug.
        'has_notices'  => true,                    // Show admin notices or not.
        'dismissable'  => true,                    // If false, a user cannot dismiss the nag message.
        'dismiss_msg'  => '',                      // If 'dismissable' is false, this message will be output at top of nag.
        'is_automatic' => false,                   // Automatically activate plugins after installation or not.
        'message'      => '',                      // Message to output right before the plugins table.
        'strings'      => array(
            'page_title'                      => esc_html__( 'Install Required Plugins', 'triptip' ),
            'menu_title'                      => esc_html__( 'Install Plugins', 'triptip' ),
            'installing'                      => esc_html__( 'Installing Plugin: %s', 'triptip' ), // %s = plugin name.
            'oops'                            => esc_html__( 'Something went wrong with the plugin API.', 'triptip' ),
            'notice_can_install_required'     => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'triptip' ), // %1$s = plugin name(s).
            'notice_can_install_recommended'  => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'triptip' ), // %1$s = plugin name(s).
            'notice_cannot_install'           => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'triptip' ), // %1$s = plugin name(s).
            'notice_can_activate_required'    => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'triptip' ), // %1$s = plugin name(s).
            'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'triptip' ), // %1$s = plugin name(s).
            'notice_cannot_activate'          => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'triptip' ), // %1$s = plugin name(s).
            'notice_ask_to_update'            => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'triptip' ), // %1$s = plugin name(s).
            'notice_cannot_update'            => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'triptip' ), // %1$s = plugin name(s).
            'install_link'                    => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'triptip' ),
            'activate_link'                   => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'triptip' ),
            'return'                          => esc_html__( 'Return to Required Plugins Installer', 'triptip' ),
            'plugin_activated'                => esc_html__( 'Plugin activated successfully.', 'triptip' ),
            'complete'                        => esc_html__( 'All plugins installed and activated successfully. %s', 'triptip' ), // %s = dashboard link.
            'nag_type'                        => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
        )
    );
    tgmpa( $plugins, $config );
}
