Skip to content

Instantly share code, notes, and snippets.

View whynotadv's full-sized avatar

Kenny Berwager whynotadv

View GitHub Profile
<?php
add_filter(
'forminator_cform_render_fields',
function( $wrappers, $model_id ) {
if( $model_id != 847 ){
return $wrappers;
}
$select_fields_data = array(
<?php
add_filter(
'forminator_cform_render_fields',
function( $wrappers, $model_id ) {
if( $model_id != 1441 ){
return $wrappers;
}
$select_fields_data = array(
<?php
/**
* Plugin Name: [Forminator Pro] - Google Analytics
* Plugin URI: https://premium.wpmudev.org/
* Description: Send custom events to Google Analytics Only (as of 1.12.1.1)
* Author: Alessandro Kaounas @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* Task: 0/11289012348292/1175295834728851
* License: GPLv2 or later
*/
@helgatheviking
helgatheviking / wordpress-add-custom-menu-meta-fields.php
Created February 26, 2020 02:06
Add an example custom meta field to WordPress menu and display text on front-end (Requires WP5.4)
<?php
/**
* Add custom fields to menu item
*
* This will allow us to play nicely with any other plugin that is adding the same hook
*
* @param int $item_id
* @params obj $item - the menu item
* @params array $args
@mishterk
mishterk / filter-acf-relationship-field-post-titles.php
Last active September 18, 2022 23:16
How to show the age of each post in an ACF relationship field. For more info see https://philkurth.com.au/tips/customise-the-post-titles-in-acf-relationship-field/
<?php
add_filter( 'acf/fields/relationship/result/name=related_posts', function ( $title, WP_Post $post, $field_arr ) {
$posted_at = get_post_time( 'U', false, $post->ID );
$now = current_time( 'timestamp' );
$diff = human_time_diff( $posted_at, $now );
return $title . sprintf( ' (%s ago)', $diff );
}, 10, 3 );
@neilgee
neilgee / functions.php
Last active August 26, 2019 22:22
LIghtSlider - Image Carousel Thumbnail Slider with ACF in WordPress
<?php // <~ don't add me in
add_action( 'wp_enqueue_scripts', 'ls_scripts_styles', 20 );
/**
* LightSlider Scripts
*/
function ls_scripts_styles() {
wp_enqueue_style( 'lightslidercss', get_stylesheet_directory_uri(). '/css/lightslider.min.css' , array(), '1.0.0', 'all' );
wp_enqueue_script( 'lightsliderjs', get_stylesheet_directory_uri() . '/js/lightslider.min.js', array( 'jquery' ), '1.0.0', true );
wp_enqueue_script( 'lightsliderinit', get_stylesheet_directory_uri() . '/js/lightslider-init.js', array( 'lightsliderjs' ), '1.0.0', true );
@neilgee
neilgee / acf-js.js
Last active September 5, 2022 13:52
ACF Google Map - Get Directions Link
(function($) {
/*
* new_map
*
* This function will render a Google Map onto the selected jQuery element
*
* @type function
* @date 8/11/2013
* @since 4.3.0