Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@yratof
yratof / functions.php
Last active August 29, 2015 14:14
Better gform pricing quartly structure
/*
Make a hidden field, make it dynamic, give it the value of $parameter.
@usage: gform_field_value_$parameter
1) Ask what month is it.
2) Return a price depending on where the month sits.
These are the parameters that I want to use:
trackadult - Track Adult Prices
@yratof
yratof / Mannequin.js
Created January 30, 2015 16:45
Mannequin Builder
/*
Mannequin Builder / Dress Builder
----------------------------------
http://app.carolinearthur.com/
- List thumbnails image src and alt tag
- Each thumbnail has a class, this class is added to the URL
- image has class anem of category and style, you can only pick one of each of these classes.
For example: accessories.shoulders
@yratof
yratof / customdash.php
Created February 5, 2015 10:15
Strips the wordpress admins css, leaves you raw
<?php
/**
* Plugin Name: Pneumatic Dashboard
* Plugin URI: http://eyeversuseye.com/pneumatic/dashboard
* Description: Pneumatic dashboard
* Version: 0.1
* Author: Eivin Landa
* Author URI: http://www.forsvunnet.co.uk
* License: MIT
*/
@yratof
yratof / fade-in.html
Created February 20, 2015 14:23
Animate fade in elements on first / last grid
<style>
/* This, if .js is active, will hide the content for the next script*/
.js .first, .js .last { opacity: 0; }
.js .first { left: -10vw; }
.js .last { right: -10vw; }
</style>
<script type="text/javascript">
(function (jQuery) {
jQuery(window)
.load(function () {
@yratof
yratof / functions.php
Last active October 18, 2016 13:45
Promote & Demote users through user.php
/* Update the users role inside the users page with a fucking button! */
/** Manage custom columns on instances of 'WP_List_Table' */
add_action('init', 'my_setup_custom_columns', 110, 0);
function my_setup_custom_columns(){
/** Manage columns on the WP_Users_List_Table */
add_filter('manage_users_columns', 'my_add_custom_columns');
/** Populate additional columns on the WP_Users_List_Table */
@yratof
yratof / functions.php
Created February 24, 2015 10:10
wp-members change forgot password text
/*
Change "Forgot Password" Text, but keep the links
*/
add_filter( 'wpmem_forgot_link_str', 'my_forgot_link' );
function my_forgot_link( $str ) {
$link = apply_filters( 'wpmem_forgot_link', wpmem_chk_qstr( WPMEM_MSURL ) . 'a=pwdreset' );
return '<a href="' . $link . '">' . __( 'Lost Password?', 'wp-members' ) . '</a>';
}
@yratof
yratof / cpt.php
Last active August 12, 2023 18:02
Wordpress AJAX search through custom post type
<form role="search" method="post" class="search-form padding-4" action="<?php echo home_url( '/' ); ?>">
<label>
<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ) ?></span>
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search...', 'placeholder' ) ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" />
<input class="post_type" type="hidden" name="post_type" value="frequent" />
</label>
<input type="submit" class="search-submit button brand" id="searchsubmit" value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>" />
</form>
<script type="text/javascript">
@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
@yratof
yratof / _forms.scss
Created March 17, 2015 15:38
1, 2, 3 or 4 of an item. Perfect for payment selects
/*
Selecting elements by amount of them
------------------------------------
*/
select {
/* One Child*/
&:nth-of-type(1):nth-last-child(1),
&:only-child {
width: 100%;
@yratof
yratof / functions.php
Created March 25, 2015 16:42
Advanced Custom Fields - Update Image / File with Gravity Forms
// Front Raw
$gravity_form_id = 6; // gravity form id, or replace {$gravity_form_id} below with this number
add_filter("gform_after_submission_{$gravity_form_id}", 'eve_set_front_raw_image_field', 10, 2);
function eve_set_front_raw_image_field($entry, $form){
$gf_images_field_id = 50; // the upload field id
$acf_field_id = 'field_54ca50b09afe2'; // the acf front raw field id
// get post
if (isset($entry['post_id'])) {
$post = get_post($entry['post_id']);