Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Shelob9 / five-stars.php
Last active March 11, 2017 00:46 — forked from mathetos/give5stars.php
Shortcode to display number of 5-star ratings of a plugin on the WordPress.org Plugin Directory (aka Plugin Repo)
<?php
add_shortcode( 'five_star_reviews', 'matt_get_give_five_stars' );
function matt_get_give_five_stars( $atts ) {
$atts = shortcode_atts( array(
'slug' => 'caldera-forms',
), $atts, 'five_star_reviews' );
$plugin_slug = $atts[ 'slug' ];
// Get any existing copy of our transient data
@Shelob9
Shelob9 / cmb2-number-field.php
Last active September 8, 2016 21:40 — forked from jtsternberg/cmb2-number-field.php
CMB2 Number Field
array(
'name' => __( 'Postive numbers', 'theme-domain' ),
'desc' => __( 'Numbers only', 'msft-newscenter' ),
'id' => $prefix . 'number',
'type' => 'text',
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
'sanitization_cb' => 'absint',
@Shelob9
Shelob9 / functions.php
Created June 28, 2016 18:13 — forked from mathetos/functions.php
Custom Autopopulate Dropdown for CalderaForms
add_filter( 'caldera_forms_autopopulate_options_post_value_field', 'givewp_customer_addon_purchases', 24, 2 );
function givewp_customer_addon_purchases()
{
$current_user = wp_get_current_user();
$purchases = edd_get_users_purchases($current_user->user_email, 100, false, 'any');
if ( $purchases ) {
foreach ($purchases as $purchase) {
$licenses = edd_software_licensing()->get_licenses_of_purchase( $purchase->ID );
<?php
// Declare paremeters of Pods
// Limiting by 4, and looping through the category slug called "for-parents"
$params = array(
'limit' => 4,
'where' => "category.slug = 'for-parents'"
);
// Create a variable called $links and assign that my pod called "link" pulling in the parameters from above
$links = pods('link', $params );
// If there are more than 0 links, let's display them!
jQuery( function () {
My_Object.init( params );
} );
(function ( $, app ) {
/**
* A variable
*/
app.var = 42;
This is my original template:
<ul><a href="{@detail_url}">{@name}</a> | <?php echo str_replace( '.00', '', $obj->field( 'price' ) ); ?> | {@123} </ul>
@Shelob9
Shelob9 / related-to-act.php
Last active November 28, 2016 22:01 — forked from axeldevo/gist:9648855
Get links to an advanced custom post type related to another Pod. See http://pods.io/tutorials/get-values-from-a-custom-relationship-field/
@Shelob9
Shelob9 / 0_reuse_code.js
Created December 18, 2013 23:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Shelob9
Shelob9 / dabblet.css
Created May 16, 2013 22:13 — forked from kizu/dabblet.css
Arc movement
/* Arc movement */
.wrapper {
width: 500px;
margin: 300px 0 0;
transition: all 1s;
transform-origin: 50% 50%;
}
.inner {
display: inline-block;