Skip to content

Instantly share code, notes, and snippets.

<x-layout>
<x-slot name="head">
<x-social-media-meta
title="Blade Component Examples"
description="Learn about all sorts of Blade component tips and tricks."
image="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg"
card="summary"
/>
</x-slot>
@huubl
huubl / clinup
Created March 23, 2021 20:52 — forked from petskratt/clinup
Use wp-cli to clean up WordPress installs (force core & plugins reinstall, track changes in git allowing easy reverts etc)
#!/usr/bin/env bash
# for debug output, uncomment:
#set -x
function help {
echo "WordPress cleanup -v 0.5 2018-06-26 / peeter@zone.ee
Usage:
@huubl
huubl / wp-video-thumbnail-attachments.php
Created March 17, 2021 19:16 — forked from RadGH/wp-video-thumbnail-attachments.php
WP Utility functions to get youtube/vimeo images and store their thumbnails as attachments
<?php
function video_get_service( $video_url ) {
if ( stristr( $video_url, 'vimeo.com') ) {
return 'vimeo';
}
if ( stristr( $video_url, 'youtube.com' ) || stristr( $video_url, 'youtu.be' ) ) {
return 'youtube';
}
@huubl
huubl / ACF Gutenberg get block fields
Created December 13, 2020 16:08 — forked from jenssogaard/ACF Gutenberg get block fields
Helper class for ACF and Gutenberg. Get blocks fields by passing block_id and post_id.
<?php
namespace JensSogaard;
class BlockHelper
{
/**
* Gets ACF fields for a specific block on a given post
* @author Jens Soegaard <jens@jenssogaard.com>
*/
public function getBlockFromPage(string $block_id, int $post_id)
@huubl
huubl / Rating.php
Created December 1, 2020 13:08 — forked from Log1x/Rating.php
Rating component
<?php
namespace App\View\Components;
use Roots\Acorn\View\Component;
class Rating extends Component
{
/**
* The rating value.
<?php
/*
Plugin Name: Programmatically add Gravity Forms
Plugin URI: https://daan.kortenba.ch/programmatically-add-gravity-forms/
Description: Programmatically add persistent Gravity Forms forms.
Author: Daan Kortenbach
Version: 0.1
Author URI: https://daan.kortenba.ch/
License: GPLv2 or later
*/
@huubl
huubl / pause-gifs.css
Created September 24, 2020 10:28 — forked from mrcoles/pause-gifs.css
A lightweight approach to pausing gifs on a webpage.
/** .pause-gif */
.wrap-pause-gif {
position: relative;
text-align: center;
}
.pause-gif {
visibility: hidden;
}
@huubl
huubl / Vimexx.php
Created August 31, 2020 16:38 — forked from Achterstraat/Vimexx.php
Heb je het óók he-le-maal gehad met Vimexx? Gebruik dan dit script om makkelijk én snel de overstap te realiseren, alle data binnen enkele seconden over naar je nieuwe hostingpartij!
<?php
/*
First, create API Projects at https://www.vimexx.nl/api
Second, replace all vars between [] with credentials from previous step!
Third, see below;
$vimexx = (new \Vimexx([account], 'wefact'));
var_export($vimexx->post('/domains'));
var_dump($vimexx->client('whmcs')->post('/domain/dns', ['sld' => 'achterstraat', 'tld' => 'com']));
var_export($vimexx->client('wefact')->post('/domains'));
*/
@huubl
huubl / setup.php
Last active August 30, 2020 13:39 — forked from Xilonz/setup.php
Sage Wordpress Query Loop for Blade templates
/**
* Add this to your setup.php
* Usage @loop( $wp_query ) or $loop and end with @endloop
* the new $loop variable is available
*
* Create @loop Blade directive
*/
\Roots\app('blade.compiler')->directive('loop', function ($query = null) {
global $wp_query;
if (!$query) $query = $wp_query;
@huubl
huubl / Gravity_Boots.php
Created July 30, 2020 15:48 — forked from craigiswayne/Gravity_Boots.php
Bootstrap 3 styles for Gravity Forms
if( !is_admin() && class_exists('\DOMDocument' ) ){
/**
* Checks if a gravity form has been submitted
* @return bool
*/
function form_submitted(){
return isset( $_POST['gform_submit'] ) && '1' === $_POST['gform_submit'];
}