Skip to content

Instantly share code, notes, and snippets.

@franhaselden
franhaselden / dabblet.css
Last active November 3, 2020 12:12
Untitled
.SideModal__modal {
max-width: 375px;
width: 100%;
height: 100%;
background-color: #ffffff;
position: fixed;
top: 0;
right: 0;
z-index: 10001;
transform: translateX(100%);
.ModalOverlay__container {
top: 0px;
position: fixed;
height: 100%;
width: 100%;
z-index: 10002;
}
.ReviewPhotoGallery__container {
height: 100%;
button {
background-color: white;
}
div {
background-color: #ddd;
}
div:hover {
background-color: #000;
@franhaselden
franhaselden / functions.php
Created November 24, 2015 12:44
Localize scripts - Wordpress function to enqueue scripts along with data passed from serverside (great way to access Wordpress functions like *stylesheet_directory_uri in scripts
wp_register_script( 'home', get_template_directory_uri().'/js/home.js', array( 'site' ) ); // resgister the script and what you want it to load after
$home_data = array(
'theme_url' => get_stylesheet_directory_uri() // create an array with any data you want to pass
);
wp_localize_script( 'home', 'home_data', $home_data ); // localise that data and pass it through
wp_enqueue_script( 'home' ); // enqueue the script ready for loading
@franhaselden
franhaselden / onclick.js
Created November 23, 2015 15:07
On Click - click event on an item that has been created after the DOM has loaded
$('body').on('click', '.overlay-box .button', function(){
console.log( $( this ).text() );
closeOverlay();
});
@franhaselden
franhaselden / functions.php
Created October 8, 2015 12:53
Bootstrap Menu for Wordpress
require_once('external/bootstrap_nav_walker.php');
register_nav_menus( array(
'primary' => __( 'Primary Menu'),
) );
@franhaselden
franhaselden / ajax-post.js
Created August 28, 2015 10:56
Post form with AJAX
// this is the id of the form
$("#idForm").submit(function() {
var url = "path/to/your/script.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#idForm").serialize(), // serializes the form's elements.
success: function(data)
@franhaselden
franhaselden / insert-into.php
Last active May 11, 2016 14:40
Basic insert into
if (!mysqli_query($con,"INSERT INTO live_lounge_DB_1 (account_no_type, account_no, first_name, last_name, email, company, game_choice, already_tickets, guests, terms) VALUES ('$numberType','$accountNumber','$firstName','$lastName','$email','$companyName','$gameSelection','$alreadyTickets','$guests','$terms') ")){
echo("Error description: " . mysqli_error($con));
return false;
}
@franhaselden
franhaselden / cycle2output.html
Created August 19, 2015 12:46
Wordpress div output designed to work with Cycle2.js - wraps a div around every 3 items (accounts for number of items being not divisible by 3 by using the modulo operator). This div can then be used within Cycle2 instead of the individual items
<!-- Cycle output beginning using the div .job-wrapper as the wrapper for every 3 items -->
<div class="grid full job-slider cycle-slideshow-jobs" data-cycle-slides=".job-wrapper" data-cycle-pager=".cycle-pager-jobs" data-cycle-timeout=5000 data-cycle-fx=scrollHorz>
@franhaselden
franhaselden / dynamic-sidebar-creation.php
Created August 6, 2015 11:08
Dynamically create sidebars for all pages/posts that match the criteria given. In the example below they must match 'pages', 'published' and be of template 'template-generic-sidebar'.
/* ========================================================================================================================
Create sidebars for pages
======================================================================================================================== */
$get_pages_args = array(
'post_type' => 'page',
'post_status' => 'publish'
);