Skip to content

Instantly share code, notes, and snippets.

View Danushka181's full-sized avatar

W D Madushanka Danushka181

View GitHub Profile
@Danushka181
Danushka181 / scrolling-function.js
Created October 9, 2019 10:44
Class adding to elements when scrolling site
$(window).scroll(function() {
//get current sroll position
var scrollPosition = $(window).scrollTop();
var headerInner = $('.header-bar-inner');
var headerHeight = $('.header-slider').outerHeight();
//get the position of the containers
var sliderPos = ($("#eme-slider-wrap-full-screen").offset().top+20);
//if the scroll position is the same as the position of the container specified, add the "active" class to the corresponding nav element
if ( scrollPosition >= sliderPos ) {
@Danushka181
Danushka181 / functions.php
Created October 22, 2019 11:57
wordpress ajax function
add_action( 'wp_ajax_load_promo_by_dates', 'load_promo_by_dates' );
add_action( 'wp_ajax_nopriv_load_promo_by_dates', 'load_promo_by_dates' );
@Danushka181
Danushka181 / update-post-meta.php
Created December 4, 2019 05:18
Update post meta wordpress
<?php
// Update templates by dynamicaly to sub pages
update_post_meta( $pg_id, 'eme_page_template', 'mod-ht6-excursion-inner');
?>
@Danushka181
Danushka181 / Gruntfile.js
Created December 13, 2019 09:48
Grunt file with compressed and customized
module.exports = function(grunt) {
// Load automatically all tasks without using grunt.loadNpmTasks()
// for each module
require('load-grunt-tasks')(grunt);
/* ---------------------------------------
* Tasks configuration
* --------------------------------------- */
grunt.initConfig({
@Danushka181
Danushka181 / gulpfile.js
Created December 18, 2019 04:17
Gulp v4 gulpfile js
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cssnano = require("cssnano");
const gulp = require("gulp");
const postcss = require("gulp-postcss");
const rename = require("gulp-rename");
const sass = require("gulp-sass");
@Danushka181
Danushka181 / gulp-package.json
Created December 18, 2019 04:17
Gulp Package json file
{
"name": "gulps",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@Danushka181
Danushka181 / make-pages.php
Created June 22, 2020 12:20
Make pages dynamicaly as loop
function makePages(){
$pages_list = array(
'Hotels',
'Offers',
'Gallery',
'Social Wall',
@Danushka181
Danushka181 / locations.php
Created July 14, 2020 07:29
Google map multiple markers
<script>
var pointerArray = <?php echo json_encode( $locaArr ); ?>;
function initialize(){
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer({
polylineOptions: {
strokeColor: "#542626"
},
@Danushka181
Danushka181 / loadmore.txt
Created August 25, 2020 04:42
load more items
-------------------------------------------------------------------------------------
Load more items html button
-------------------------------------------------------------------------------------
<?php
if ( $items_count < count($all_post) ):
?>
<div id="loadMore" class="loadmore clearfix" data-start="<?php echo $items_count; ?>" data-items="<?php echo $load_more_items; ?>"></div>
<?php
endif;
@Danushka181
Danushka181 / gdpr-compliance.php
Last active September 16, 2020 12:11
Gdpr data delete
<?php
/**
* Template Name: GDPR Compliance
* Template Post Type: post, page, arise_arena, arise_atlas, arise_brisbaneone, arise_harmony, arise_skytower, arise_onhopestreet, arise_ivyandeve, arise_princessregent, arise_soda, arise_spice, arise_australia108, arise_theeminence, arise_collinshouse, arise_skyone, arise_rubygoldcoast, arise_ftvalley, arise_kawanawaters, arise_adelaide
*
* @package WordPress
* @subpackage Arise_Hotels
* @since Arise_Hotels 1.0
*/