This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_youtube_oembed_lite($html, $url, $args) { | |
// Check if the URL is a YouTube link | |
if (strpos($url, 'youtube.com') !== false || strpos($url, 'youtu.be') !== false) { | |
// Extract the YouTube ID from the URL | |
preg_match('/(youtube\.com\/watch\?v=|youtu\.be\/)([^\&\?\/]+)/', $url, $idMatch); | |
$youtubeId = $idMatch[2]; | |
// Return the Lite YouTube Embed HTML | |
return '<lite-youtube videoid="' . esc_attr($youtubeId) . '"></lite-youtube>'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ## Globals | |
var argv = require('minimist')(process.argv.slice(2)); | |
var autoprefixer = require('gulp-autoprefixer'); | |
var browserSync = require('browser-sync').create(); | |
var changed = require('gulp-changed'); | |
var concat = require('gulp-concat'); | |
var flatten = require('gulp-flatten'); | |
var gulp = require('gulp'); | |
var gulpif = require('gulp-if'); | |
var imagemin = require('gulp-imagemin'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if($content['section_checkmarks']) | |
@php | |
// Transform array into collection | |
$checkmarks = collect($content['section_checkmarks']); | |
@endphp | |
{{-- Split elements into chunks of 5 --}} | |
@foreach($checkmarks->chunk(5) as $chunk) | |
<ul class="check list-smaller"> | |
@foreach($chunk as $checkmark) | |
<li>{!! $checkmark['checkmark_text'] !!}</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get 4 news item query | |
* @return array | |
*/ | |
public static function blogPostsLoop($post_ids = array(), $post_type = 'post', $showposts = '4', $exclude_posts = array()) { | |
$blogposts_query = array( | |
'post_type' => $post_type, | |
'post_status' => 'publish', | |
'posts_per_page' => $showposts, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add custom attributes to oEmbed iframe src | |
* | |
* @param string $iframe | |
* @return string | |
*/ | |
public static function oEmbedIframe($iframe) { | |
// Use preg_match to find iframe src. | |
preg_match('/src="(.+?)"/', $iframe, $matches); | |
$src = $matches[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Estimated Reading Time | |
* | |
* Use by adding {{ App::estimated_reading_time(get_the_ID()) }} to the Blade view where you want to use it. | |
* | |
* @return void | |
*/ | |
public static function estimated_reading_time($post_id) { | |
$the_content = apply_filters( 'the_content', get_the_content(null, false, $post_id)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filter the excerpt length to 39 words. | |
* | |
* @param int $length Excerpt length. | |
* @return int (Maybe) modified excerpt length. | |
*/ | |
add_filter( 'excerpt_length', function( $length ) { | |
return 39; | |
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add wrapper to oEmbed | |
*/ | |
add_filter('embed_oembed_html', function($html, $url, $attr) { | |
return $html!=='' ? '<div class="embed-container">'.$html.'</div>' : ''; | |
}, 10, 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Init Segment | |
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0"; | |
analytics.load("YOUR_WRITE_KEY"); | |
ana |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{-- inEU() needs to be added with yarn add @segment/in-eu --save --}} | |
{{-- needs to be imported in common.js -> import inEU from '@segment/in-eu'; --}} | |
{{-- and needs to be declared as a global in common.js -> window.inEU = inEU(); --}} | |
<div id="consent-manager"></div> | |
<script type="text/javascript"> | |
window.consentManagerConfig = function(exports) { | |
exports.preferences.onPreferencesSaved(function(prefs) { | |
// could be used to store consent server side, or send it into an API | |
}) |
NewerOlder