Skip to content

Instantly share code, notes, and snippets.

@ammist
ammist / slider.html
Created March 13, 2024 02:07
Basic HTML code for a slider page example
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style.css">
<style>
button {
border: none;
background: green;
color: white;
font-weight: bold;
border-radius: 5px;
@ammist
ammist / gravity_form_event_rsvp.json
Created September 21, 2018 23:25
Gravity Forms Custom Fields (TL Event RSVP WordPress Plugin)
{"0":{"title":"Support Group RSVP","description":"Pre-register for the support group. If you are a member, log in and attend for free.","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Register","imageUrl":"","conditionalLogic":null},"fields":[{"type":"email","id":2,"label":"Email","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":51,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"user_email","visibility":"visible","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","emailConfirmEnabled":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false},{"type":"name","id":1,"label":"Name",
@ammist
ammist / functions.php
Last active December 7, 2018 22:47
ACF Front-End Form
/* Append these functions in your functions.php file */
// add the genesis hooks we need based on whether the uesr is logged in, what page we're on, etc.
function prep_genesis(){
if ( ( is_singular( 'my_post_type' ) || is_singular('my_othter_post_type' ) ) && is_user_logged_in () ){
$user = wp_get_current_user();
$post = get_queried_object();
@ammist
ammist / page_show_children.php
Created August 7, 2018 23:56
Show Child Pages on Genesis (Page Template)
<?php
/* Template Name: Section Landing Children */
function tl_show_page_children(){
// get the child pages
global $post;
$args = array(
@ammist
ammist / page_owner_and_modified.php
Last active July 7, 2018 15:44
Get info about owner and last modified by in WordPress
function tl_show_page_owner(){
// uncomment the line below if you want to use this only on pages.
// if (!is_page()) return;
$page = get_queried_object();
if (!($page instanceof WP_Post)){
return;
}
@ammist
ammist / custom_post_type.php
Last active June 20, 2018 23:13
WordPress Save Hook Examples
<?php
// called when saving a post.
public function tl_save_post($post_id){
// dont do this on auosave.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// verify this came from the our screen and with proper authorization,
@ammist
ammist / woocommerce_filters.php
Last active September 21, 2019 23:14
WooCommerce Fractional Quantities for PayPal
/* ---------------------------------
* Paypal Args. Paypal only accepts integer quantities, so we have to update the
* information that's sent from the order, but only for metals.
* --------------------------------- */
add_filter('woocommerce_paypal_args', 'tl_paypal_args', 100, 1);
function tl_paypal_args( $args ){
$counter = 1;
while(isset( $args[ 'quantity_' . $counter])){
@ammist
ammist / woocommerce_filters.php
Last active March 24, 2019 22:52
WooCommerce Crop Single Product Image
// filter single product image to enable cropping
add_filter('woocommerce_get_image_size_single', 'bb_crop_woo_image', 100);
function bb_crop_woo_image( $size ){
$size['crop'] = 1;
$size['height'] = 315;
return $size;
}
// Or use a different fixed size image on the gallery in the single product page
add_filter( 'woocommerce_gallery_image_size' , 'bb_medium_image_size' );
@ammist
ammist / match_with_priority_newer.json
Last active May 31, 2018 23:10
ElasticSearch Queries
GET _search
{
"size":24,
"from":0,
"query" : {
"function_score" : {
"query":{
"multi_match":{
"query":"bagel",
"fields":["post_title^3","post_excerpt^2","post_content","post_author.display_name","terms.category.name", "terms.resource-category.name","terms.post_tag.name"],
@ammist
ammist / page_tl_full_width.php
Last active March 30, 2018 21:53
Full-Width Page Template for Genesis Child themes
<?php
/**
* This file adds a full-width page to Genesis that you can use with Beaver Build.
*
*/
/*
Template Name: Full-Width Beaver Builder Page
*/