Skip to content

Instantly share code, notes, and snippets.

@kjtolsma
kjtolsma / widget-pronamic-events.php
Created May 8, 2013 14:01
Standard output for the Pronamic Events widget
<?php if ( have_posts() ) : ?>
<?php
if ( ! empty( $title ) ) {
echo $before_title . $title . $after_title;
}
?>
@kjtolsma
kjtolsma / pronamic-events-widget.php
Created September 10, 2013 14:08
Pronamic Events Widget
<?php if ( have_posts() ) : ?>
<?php
if ( ! empty( $title ) ) {
echo $before_title . $title . $after_title;
}
?>
<?php
if ( function_exists( 'is_pronamic_cookies_section_accepted' ) ) {
if ( is_pronamic_cookies_section_accepted( 'social-share' ) ) {
get_template_part( 'templates/share' );
} else {
$( '.load-random-post' ).on( 'click', function( e ) {
$.ajax( {
url: themePostData.postsEndpointURL,
data: {
filter: {
'posts_per_page': 1,
'orderby': 'rand'
},
},
dataType: 'json',
$( '.event-countdown' ).each( function() {
var $element = $( this );
var date = $element.data( 'date' );
$element.countdown( date, function( event ) {
$( this ).text( event.strftime( '%D days %H:%M:%S' ) );
} );
} );
<h1 class"page-title">
<?php esc_html_e( 'Events', 'textdomain' ); ?>
</h1>
<?php if ( have_posts() ) : ?>
<ul class="events">
<?php while ( have_posts() ) : the_post(); ?>
<li class="event">
wp_localize_script(
'theme-posts',
'themePostData',
array(
'postsEndpointURL' => get_site_url() . '/wp-json/wp/v2/post',
)
);
$( '.pt-page-slider' ).flexslider( {
animation: 'fade',
controlNav: true,
directionNav: true,
touch: false,
slideshow: false,
manualControls: '.page-slider-flex-control a',
start: function( slider ) {
var activeVideo = $( '.flex-active-slide video' );
@kjtolsma
kjtolsma / video.js
Last active February 8, 2017 15:53
$( '.person' ).hover( function() {
$( this ).find( 'video' ).get(0).play();
}, function() {
//$( this ).find( 'video' ).get(0).load();
//$( this ).find( 'video' ).get(0).pause();
} );
$( '.video' ).on( 'play', function() {
$( '.video-overlay-wrapper' ).fadeOut( 400 );
} );
@kjtolsma
kjtolsma / _gf_toggle.scss
Last active September 25, 2023 14:58
CSS3 toggle switch for Gravity Forms
// Gravity Forms checkbox toggle
// @use .pt-toggle
$pt-toggle-height: 32px;
$pt-toggle-border: 4px;
$pt-toggle-radius: 60px;
$pt-color-grey: #ddd;
$pt-color-white: #fff;
$pt-color-primary: #5cb85c;