Skip to content

Instantly share code, notes, and snippets.

function google_fonts() {
$query_args = array(
'family' => 'Open+Sans:400,700|Oswald:700'
'subset' => 'latin,latin-ext',
);
wp_register_style( 'google_fonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null );
}
add_action('wp_enqueue_scripts', 'google_fonts');
@yratof
yratof / functions.php
Created March 10, 2015 14:37
ACF OEmbed with thumbnails
<?php
/* Pull apart OEmbed video link to get thumbnails out*/
function get_video_thumbnail_uri( $video_uri ) {
$thumbnail_uri = '';
// determine the type of video and the video id
$video = parse_video_uri( $video_uri );
// get youtube thumbnail
@mohsinrasool
mohsinrasool / bbpress-badgeos-user-achievements-under-avatar
Created August 21, 2015 14:27
This gists adds User's badges earned with badgeos plugin under his avatar in topics and replies of bbpress.
<?php
add_filter( 'bbp_get_reply_author_link', 'my_append_badges_via_filter', 10, 2 );
function my_append_badges_via_filter($author_link = '', $args) {
# Needed to get the user ID of the person intended to be displayed.
$user_id = bbp_get_reply_author_id( $args['post_id'] );
#Construct your output here.
$badge_output = '';
@octalmage
octalmage / roles.md
Last active May 14, 2023 17:43
Default WordPress user roles and capabilities.

WordPress v4.3.1

Admin wp_capabilities wp_user_level 10

a:1:{s:13:"administrator";b:1;}

Contributor wp_capabilities wp_user_level 1

@mgibbs189
mgibbs189 / 01_Query_Arguments.php
Last active August 27, 2023 10:11
FacetWP - show both a Google Map and a result listings
<?php
return array(
"post_type" => "park",
"post_status" => "publish",
"posts_per_page" => 100
);
@alenabdula
alenabdula / GravityForm-Dynamic-Selects.php
Created December 22, 2015 18:47
Gravity form dynamically populate select drop down with taxonomy terms
<?php
/**
* --------------------------------------------------
* Gravity Form dynamically populate drop-down
* select for Questions form ID 15
* 'gform_pre_render_14' - _14 represents form ID to filter
* --------------------------------------------------
*/
add_filter( 'gform_pre_render_14', 'pre_populate_gravity_select_for_MY_TAX' );
add_filter( 'gform_pre_validation_14', 'pre_populate_gravity_select_for_MY_TAX' );
@spivurno
spivurno / gw-gravity-forms-advanced-conditional-shortcodes.php
Last active October 21, 2020 17:51
Gravity Wiz // Gravity Forms // Advanced Conditional Shortcodes
<?php
/**
* Gravity Wiz // Gravity Forms // Advanced Conditional Shortcodes
*
* [gravityforms action="conditional" relation="any"
value="{:2}" operator="is" compare="First Choice"
value2="{:1}" operator2="isnot" compare2="Second Choice"]
Content you would like to conditionally display.
[/gravityforms]
*
@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
@leepettijohn
leepettijohn / functions.php
Last active July 28, 2020 09:24
Gravity Forms - Dynamic Dropdown, Radio Button, Multi Select
<?php
/*-----------------------------------------------------------------------------------*/
/* Putting Locations in a Dropdown, Radio Button, or Multi-Select */
/* Helpful article - https://www.gravityhelp.com/documentation/article/dynamically-populating-drop-down-fields/ */
/*-----------------------------------------------------------------------------------*/
$location_form_id = 9;
add_filter( 'gform_pre_render_'.$location_form_id, 'populate_posts' );
add_filter( 'gform_pre_validation_'.$location_form_id, 'populate_posts' );
add_filter( 'gform_pre_submission_'.$location_form_id, 'populate_posts' );
add_filter( 'gform_pre_submission_filter_'.$location_form_id, 'populate_posts' );
@mgibbs189
mgibbs189 / test.js
Created July 31, 2018 17:21
Redirect when a facet is interacted with
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if (FWP.loaded && '' == FWP_HTTP.uri) { // if not the initial pageload, and we're on the homepage
window.location.href = '/listings/?' + FWP.build_query_string(); // redirect
}
});
})(jQuery);