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 | |
/** | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any | |
* means. | |
* |
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 | |
$file = '/path/to/file.png'; | |
$filename = basename($file); | |
$upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
if (!$upload_file['error']) { | |
$wp_filetype = wp_check_filetype($filename, null ); | |
$attachment = array( | |
'post_mime_type' => $wp_filetype['type'], | |
'post_parent' => $parent_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 | |
// filter the Gravity Forms button type | |
add_filter("gform_submit_button", "form_submit_button", 10, 2); | |
function form_submit_button($button, $form){ | |
// The following line is from the Gravity Forms documentation - it doesn't include your custom button text | |
// return "<button class='button' id='gform_submit_button_{$form["id"]}'>'Submit'</button>"; | |
// This includes your custom button text: | |
return "<button class='button' id='gform_submit_button_{$form["id"]}'>{$form['button']['text']}</button>"; | |
} | |
// Oops this strips important stuff |
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 | |
class RW_Delete_Entry { | |
function __construct() { | |
if( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8.5.8', '>=' ) ) | |
return; | |
add_filter( 'gform_tooltips', array( $this, 'add_delete_tooltip') ); | |
add_filter( 'gform_form_settings', array( $this, 'add_delete_setting' ), 10, 2 ); | |
add_action( 'gform_pre_form_settings_save', array( $this, 'save_delete_setting' ), 10 ); | |
add_action( 'gform_after_submission', array( $this, 'maybe_delete_form_entry' ), 15, 2 ); |
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
<!-- Place this data between the <head> tags of your website --> | |
<title>Page Title. Maximum length 60-70 characters</title> | |
<meta name="description" content="Page description. No longer than 155 characters." /> | |
<!-- Twitter Card data --> | |
<meta name="twitter:card" value="summary"> | |
<!-- Open Graph data --> | |
<meta property="og:title" content="Title Here" /> | |
<meta property="og:type" content="article" /> |
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 | |
/** | |
* Converting address to latitude and longitude | |
*/ | |
function setLatitudeAndLongitude($address) { | |
$address = urlencode($address); | |
$request_url = "http://maps.googleapis.com/maps/api/geocode/xml?address=".$address."&sensor=true"; | |
$xml = simplexml_load_file($request_url) or die("url not loading"); | |
$status = $xml->status; |
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 | |
//////////////// | |
// User Example | |
//////////////// | |
$user = pods( 'user' ); // User | |
$params = array( | |
'orderby' => 't.user_login', | |
'limit' => 10, |
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
$(function() { | |
'use strict'; | |
// the css selector for the container that the image should be attached to as a background-image | |
var imgContainer = '.cover-img picture'; | |
function getCurrentSrc(element, cb) | |
{ | |
var getSrc; | |
if (!window.HTMLPictureElement) { |
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 | |
$things_to_do = pods( 'things_to_do' ); | |
$limit = 9; | |
$params = array( | |
'fields' => array( | |
'region', | |
'activity', | |
'legend_items' | |
), |
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 | |
/* | |
For a better understanding of ics requirements and time formats | |
please check https://gist.github.com/jakebellacera/635416 | |
*/ | |
// UTILS | |
// Check if string is a timestamp |
OlderNewer