Pages

Tuesday, November 20, 2018

owl Carousel Settings

<div class="owl-carousel slider-section" id="owlslide">

<?php while(the_repeater_field('banner_slider')): ?>

<div class="item bestcenter vidHide" id="myVideo" <?php if (get_sub_field('banner_backgound_video') ){?> data-videosrc="<?php the_sub_field('banner_backgound_video'); ?>" <?php } ?> >

<?php if (get_sub_field('banner_backgound_video')) { /* ?><img class="loadingImg" src="<?php echo get_template_directory_uri(); ?>/assets/img/loading.gif"> <?php */ } ?>

<div class="preloader preloader-out" style="background-color: #FFFFFF"><div class="loader"></div></div>

<?php if(get_sub_field('banner_background_mobile_image')) { ?>
<img class="showinMobile" src='<?php the_sub_field('banner_background_mobile_image'); ?>'/>
<?php } ?>

<?php if(get_sub_field('banner_background_imag')) { ?>
<img class="hideinMobile" src='<?php the_sub_field('banner_background_imag'); ?>'/>
<?php } ?>

<div class='promo-container'>

<div class="container">

<div class="row align-items-center justify-content-center">

<div class="col-lg-6">

<div class="slider-left-content">

<h4><?php the_sub_field('banner_main_heading'); ?> <span><?php the_sub_field('banner_sub_heading'); ?></span></h4>

</div>

</div>

<div class="col-lg-3">

<div class="slider-right-btn">

<a href="<?php the_sub_field(' banner_button_link'); ?>" class="custom-btn"><?php the_sub_field('banner_button_text'); ?></a>

</div>

</div>

</div>

</div>

</div>

</div>

<?php endwhile; ?>

</div>



<script>
if ($('.slider-section').length > 0) {

var owl = $('.slider-section');

owl.owlCarousel({

loop: true,

margin: 10,

nav: true,

navText: ["<img src='/wp-content/themes/parasailsiesta/assets/img/slider-arrow-left.png'>", "<img src='/wp-content/themes/parasailsiesta/assets/img/slider-arrow-right.png'>"],

dots: true,

items: 1

})

// owl.on('initialize.owl.carousel initialized.owl.carousel ' +
// 'initialize.owl.carousel initialize.owl.carousel ' +
// 'resize.owl.carousel resized.owl.carousel ' +
// 'refresh.owl.carousel refreshed.owl.carousel ' +
// 'update.owl.carousel updated.owl.carousel ' +
// 'drag.owl.carousel dragged.owl.carousel ' +
// 'translate.owl.carousel translated.owl.carousel ' +
// 'to.owl.carousel changed.owl.carousel', function( event ){
// console.log( event.type +' TESTING ');
// $('.preloader').hide();

// });

owl.on('refreshed.owl.carousel ', function( event ){
console.log( event.type +' TESTING ');
setTimeout(() => {
$('.preloader').hide();
}, 2000);

});
// Trigger function on owl.carousel Refreshed/Loaded
owl.trigger('refreshed.owl.carousel');

if (!isMobile(1367)) {

$('.owl-item .item').each(function () {

var attr = $(this).attr('data-videosrc');
if (typeof attr !== typeof undefined && attr !== false) {

console.log('hit');

var videosrc = $(this).attr('data-videosrc');

$(this).prepend('<video muted><source src="' + videosrc + '" type="video/mp4"></video>');
$('.owl-item video').attr('autoplay', true).attr('loop', true).attr('poster','https://www.parasailsiesta.com/wp-content/uploads/2018/11/slider-1-min.jpg');

}

});


}







function isMobile(width) {

if (width == undefined) {

width = 719;

}

if (window.innerWidth <= width) {

return true;

} else {

return false;

}

}



$('.lazy').Lazy({

// your configuration goes here

scrollDirection: 'vertical',

effect: 'fadeIn',

visibleOnly: true,

onError: function(element) {

console.log('error loading ' + element.data('src'));

}

});


(function($) {

$.Lazy('.vidHide', ['audio', 'video'], function(element, response) {

// this plugin will automatically handle '<audio>' and '<video> elements,

// even when no 'data-loader' attribute was set on the elements

});

})(window.jQuery || window.Zepto);

}
</script>

Friday, September 7, 2018

Laravel Server.php File Solution


$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);

$uri = urldecode($uri);

// $paths = require __DIR__.'/bootstrap/paths.php';

$requested = __DIR__.'/public'.$uri;

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' and file_exists($requested))
{
return false;
}

require_once __DIR__.'/public/index.php';

Thursday, January 4, 2018

get all users by first character in IONIC custom Wordpress API Function

PHP FILE


/**
* Users Listing
* Users Custom Fields, Pagination, Searching User by its first Character
*/

add_action('rest_api_init', 'wpc_register_wp_api_endpoints');
function wpc_register_wp_api_endpoints()
{
register_rest_route('userlisting', '/search', array(
'methods' => 'GET',
'callback' => 'wpc_somename_search_callback',
));
}

function wpc_somename_search_callback($request_data)
{

$parameters = $request_data->get_params();
$usersdata = array();

if (!isset($parameters['per_page']) || empty($parameters['per_page']))
return array('error' => 'Page No empty ');
$number = $parameters['per_page'];
if (isset($parameters['page']) || !empty($parameters['page'])) {
$paged = $parameters['page'];
} else {
$paged = 1;
}
if (isset($parameters['s']) || !empty($parameters['s'])) {
$search = esc_attr($parameters['s']);
} else {
$search = '';
}

$args = array(
'role' => 'author',
'exclude' => array('administrator'),
'orderby' => 'login',
'order' => 'ASC',
'search' => '',
'meta_query' => ($search!='') ? array(array('key' => 'nickname', 'value' => '^'.$search.'.*', 'compare' => 'REGEXP')) : '',
'offset' => $paged ? ($paged - 1) * $number : 1,
'number' => $number,
'fields' => array('ID','user_nicename','display_name'),
'who' => '',
);
$users = get_users($args);

foreach ($users as $user) {

$usersdata['users'][]['authormeta'] = array('ID' => $user->ID, 'display_name' => $user->display_name,
'authormetadata' => array(
'cupp_upload_meta' => get_user_meta($user->ID, 'cupp_upload_meta', true),
'description' => get_user_meta($user->ID, 'description', true),
'nickname' => get_user_meta($user->ID, 'nickname', true)
), 'arguments'=> $args,
);

}
return $usersdata;
}





/***************************************************************
*Ionic 3 Function Call
**/

// CALL the API

this.http.get('http://yourwebsite.com/wp-json/userlisting/search?per_page=15&s=Z')
.map(res => res.json())
.subscribe(data => {
// we've got back the raw data, now generate the core schedule data
console.log(data);
this.authors = data.users;
});

Wednesday, September 13, 2017

Update table column from any other column from any table mysql query

UPDATE table1 T1
INNER JOIN editorial B ON B.editorial_id = T1.editorial_id
SET T1.to_design = B.`coversentto`

WHERE T1.`to_design` ='' || T1.`to_design` IS NULL

Wednesday, July 26, 2017

Send EMAIL with PHPMailer using SMTP in bluehost

<?php
set_time_limit(0);
error_reporting(E_ALL);
ini_set('display_errors', 'On');
require_once "Phpmailer/PHPMailerAutoload.php";


$mail = new PHPMailer(true);
$mail-> IsSMTP();
$mail->Host = "box605.bluehost.com";
$mail->SMTPAuth = true;
$mail->Username = "email@domain.com";
$mail->Password = 'password';
//$mail->SMTPSecure = 'tls'; //TLS
$mail->Port = 26;

//$mail->From = "";//$mail->Username; //mandatory and identical to Username property
$mail->setFrom($mail->Username, 'Mailer Test');
$mail->addReplyTo('email@domain.com');

$mail->Subject = "Hello message";
$mail->Body = "Body goes here...";
$mail->addAddress('zakeerio25@gmail.com');



if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}

?>

Sunday, April 2, 2017

How to get Distinct Years using DATE_FORMAT() In the mysql database table

$rs =  mysql_query("SELECT DISTINCT(DATE_FORMAT(date_paid,'%Y') ) as mindate FROM purchase ORDER BY mindate ASC");
     
        ?>
       
        <select name="dy">
       <?php

       while( $minDate = mysql_fetch_array($rs) ) {
        $seldm = $_GET['dy'] == $minDate['mindate'] ? 'selected="selected"' : '';
        echo '<option value='.$minDate['mindate'].' '.$seldm. '>'.$minDate['mindate'].'</option>';
       }
       ?>
        </select>

Wednesday, February 22, 2017

Showing the calendar in jquery with month and year

Practice with Showing the calendar in jquery and showing the month select and year select.

 

$( "#datepicker" ).datepicker({
dateFormat: 'dd-mm-yy',
yearRange: "1990:2050",
            changeMonth: true,
            changeYear: true
        });