Skip to content

Instantly share code, notes, and snippets.

View celticwebdesign's full-sized avatar

Darren Stevens celticwebdesign

View GitHub Profile
@celticwebdesign
celticwebdesign / Page-scroll-on-page-load.php
Created February 13, 2016 22:35
Page scroll on page load
CSS ----
// Competition Valentines 2016
// if( $('body.valentines-day-win-a-bottle-of-bubby-and-a-50-voucher').length > 0 ) {
// var type = window.location.hash.substr(1);
// if( type == "competition" ) {
// $('html, body').animate({
// scrollTop: $("#mc_embed_signup").offset().top
// }, 2000);
// }
// }
@celticwebdesign
celticwebdesign / Fancybox-open-on-page-load.php
Created February 13, 2016 22:34
Fancybox open on page load
JS ----
(function ($, root, undefined) {
$(function () {
if ($('body.home').length > 0 ) {
$.fancybox({
'width': '100%',
'height': '100%',
@celticwebdesign
celticwebdesign / click_telephone.php
Last active July 20, 2016 14:29
Read options telephone number and make it international for mobile devices.
<?php
function click_telephone($telephone, $string = null, $prepend = null, $prepend_zero = null) {
/*
Parameters:
$telephone - string, the actual number
$string - string, if you want to dispay a clickable strong rather than telephone number,
$prepend - string, prepend the telephone number.
$countrycode - string, country code or default UK 0044
@celticwebdesign
celticwebdesign / removeattr.js
Created February 1, 2016 08:45
Remove img alt and title after full page download.
$(window).load(function() {
$('.class_name_here img').removeAttr( "title" ).removeAttr( "alt" );
});
HTML
<?php
$rows_sr = get_field('staff_repeater');
if($rows_sr) {
echo "
@celticwebdesign
celticwebdesign / Slide-Down Panel
Created January 23, 2016 14:59
Slide-Down Panel
HTML
<div class="treatments-view-all">
<a href='#'>View all ></a>
</div>
CSS
@celticwebdesign
celticwebdesign / WordPress Posts Widget
Created January 9, 2016 19:40
WordPress Posts Widget
-- Functions.php
// http://www.wpbeginner.com/wp-tutorials/how-to-create-a-custom-wordpress-widget/
// Creating the widget
class meor_widget_posts extends WP_Widget {
function __construct() {
parent::__construct(
// Base ID of your widget
'meor_widget_posts',
@celticwebdesign
celticwebdesign / WordPress Facebook Widget
Created January 9, 2016 19:38
WordPress Facebook Widget
-- Functions.php
// http://www.wpbeginner.com/wp-tutorials/how-to-create-a-custom-wordpress-widget/
// Creating the widget
class meor_widget_facebook extends WP_Widget {
function __construct() {
parent::__construct(
// Base ID of your widget
'meor_widget_facebook',
@celticwebdesign
celticwebdesign / Pinterest share pop-up
Created December 21, 2015 11:21
Pinterest share pop-up
JS ----
$('a.share_pinterest').click(function(e) {
e.preventDefault();
var url = $('a.share_pinterest').data('url');
var title = $('a.share_pinterest').data('title');
var descr = $('a.share_pinterest').data('descr');
var image = $('#slideshow_thumbnails li.thumbnail1 img').attr('src');
var winWidth = 750;
var winHeight = 540;
var winTop = (screen.height / 2) - (winHeight / 2);
@celticwebdesign
celticwebdesign / Twitter share pop-up
Created December 21, 2015 10:37
Twitter share pop-up
JS ----
$('a.share_twitter').click(function(e) {
e.preventDefault();
var width = 520,
height = 350,
left = ($(window).width() - width) / 2,
top = ($(window).height() - height) / 2,
url = this.href,
opts = 'status=1' +