Instantly share code, notes, and snippets.

View bcSwipe.min.js
/*! Bootstrap Carousel Swipe jQuery plugin v1.1 | https://github.com/maaaaark/bcSwipe | MIT License */
!function(t){t.fn.bcSwipe=function(e){var n={threshold:50};return e&&t.extend(n,e),this.each(function(){function e(t){1==t.touches.length&&(u=t.touches[0].pageX,c=!0,this.addEventListener("touchmove",o,!1))}function o(e){if(c){var o=e.touches[0].pageX,i=u-o;Math.abs(i)>=n.threshold&&(h(),t(this).carousel(i>0?"next":"prev"))}}function h(){this.removeEventListener("touchmove",o),u=null,c=!1}var u,c=!1;"ontouchstart"in document.documentElement&&this.addEventListener("touchstart",e,!1)}),this}}(jQuery);
View events.blade.php
{{--
Template Name: Events Template
--}}
@extends('layouts.app')
@section('content')
<div id="tribe-events-pg-template">
<?php tribe_events_before_html(); ?>
<?php tribe_get_view(); ?>
View setup.php
wp_enqueue_style('slick/css', get_template_directory_uri() . '/slick/slick.css', false, null);
wp_enqueue_style('slick-theme/css', get_template_directory_uri() . '/slick/slick-theme.css', false, null);
wp_enqueue_script('slick/js', get_template_directory_uri() . '/slick/slick.js', ['jquery'], null, true);
View main.js
// Slide up/down scroll to top button
$(document).scroll(function() {
var value=$(document).scrollTop();
if ( value >= 180 ) {
$('.scroll-top').addClass('bottom-reset');
return;
} else {
$('.scroll-top').removeClass('bottom-reset');
}
View main.js
$(document).mouseup(function(e){
var menu = $('.mobile-menu');
if (!menu.is(e.target) // The target of the click isn't the container.
&& menu.has(e.target).length === 0) // Nor a child element of the container
{
menu.hide();
}
});
View app.php
<?php
namespace App;
use Sober\Controller\Controller;
class App extends Controller
{
public function siteName()
{
View custom-post-types.php
<?php
namespace App;
// clients
add_action( 'init', function () {
$labels = array(
"name" => __( 'Clients', '' ),
"all_items" => __( 'Clients', '' ),
"singular_name" => __( 'Client', '' ),
View functions.php
/**
* Sage required files
*
* The mapped array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
*/
array_map(function ($file) use ($sage_error) {
$file = "../app/{$file}.php";
if (!locate_template($file, true, true)) {
$sage_error(sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file), 'File not found');
View App.php
class App extends Controller
{
// other code
// Add your own custom fields as a function
public function site_logo() {
return get_field('site_logo', 'options');
}
View template.php
<?php if( have_rows('slides') ): ?>
<?php while( have_rows('slides') ): the_row(); ?>
<div class="accordion" id="accordion-<?php echo get_row_index(); ?>">
<h3><?php the_sub_field('title'); ?></h3>
<?php the_sub_field('text'); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>