This file contains 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_action( 'pre_get_posts', 'query_offset', 1 ); | |
function query_offset( &$query ) { | |
// Before anything else, make sure this is the right query... | |
if ( ! ( $query->is_home() || is_main_query() ) || is_admin() ) { | |
return; | |
} | |
// First, define your desired offset... | |
$offset = -1; |
This file contains 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 | |
/** | |
* Add WP API endpoint for form submission, then create new | |
* Gravity Forms entry and send notifications. | |
*/ | |
// rest api endpoint for forms submission | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'ahr/v1', '/forms', array( | |
'methods' => 'POST', |
This file contains 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( !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']; | |
} | |
This file contains 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 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; |
This file contains 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 | |
/* | |
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')); | |
*/ |
This file contains 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
/** .pause-gif */ | |
.wrap-pause-gif { | |
position: relative; | |
text-align: center; | |
} | |
.pause-gif { | |
visibility: hidden; | |
} |
This file contains 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 | |
/* | |
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 | |
*/ |
This file contains 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 | |
namespace App\View\Components; | |
use Roots\Acorn\View\Component; | |
class Rating extends Component | |
{ | |
/** | |
* The rating value. |
This file contains 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 | |
namespace JensSogaard; | |
class BlockHelper | |
{ | |
/** | |
* Gets ACF fields for a specific block on a given post | |
* @author Jens Soegaard <[email protected]> | |
*/ | |
public function getBlockFromPage(string $block_id, int $post_id) |
This file contains 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 | |
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'; | |
} |
OlderNewer