Skip to content

Instantly share code, notes, and snippets.

<?php $program = get_sub_field('program_selection'); ?>
<?php if( $program == 'intensity' ){ ?>
<?php } else if( $program == 'crossfit' ){ ?>
<?php } else if( $program == 'personal' ){ ?>
<?php } else if( $program == 'allprograms' ){ ?>
@eyecandy91
eyecandy91 / Paid Membership Pro Plugin
Created August 10, 2016 08:54 — forked from emiliano1991/Paid Membership Pro Plugin
Remove or edit "now." “The price for membership is $0.00 now.” for Membership Levels
function my1_pmpro_level_cost_text($text, $level) {
// is livel is free do nothing
if (pmpro_isLevelFree($level)) {
return "";
// else is different to free do this
} else {
//the full string is : The price for membership is $0.00 now.
$restituisci = str_replace("now.","",$text); // in this case you can remove "now." in the full string
return $restituisci;
@eyecandy91
eyecandy91 / gist:f1651934b5debfd0288e9dc79c3c31f2
Created August 15, 2016 01:51 — forked from strangerstudios/gist:4027538
Hide the confirm email and confirm password fields from the Paid Memberships Pro checkout page.
/*
Don't show confirm password or email fields on the checkout page.
Add this code to your active theme's functions.php or a custom plugin.
*/
add_filter("pmpro_checkout_confirm_password", "__return_false");
add_filter("pmpro_checkout_confirm_email", "__return_false");
@eyecandy91
eyecandy91 / php-get-user-agent
Created August 18, 2016 11:44
conditionally load content php via user agents
<?php
//Detect special conditions devices
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
//do something with this information
if( $iPod || $iPhone ){ ?>
<?php//browser reported as an iPhone/iPod touch -- do something here ?>
@eyecandy91
eyecandy91 / php
Created August 23, 2016 05:35
php if admin
if ( current_user_can( 'manage_options' ) ) {
/* A user with admin privileges */
} else {
/* A user without admin privileges */
}
@eyecandy91
eyecandy91 / php
Created August 23, 2016 12:26
remove the annoying customizer admin panel
function as_remove_menus () {
remove_menu_page('upload.php'); //hide Media
remove_menu_page('link-manager.php'); //hide links
remove_submenu_page( 'edit.php', 'edit-tags.php' ); //hide tags
global $submenu;
// Appearance Menu
unset($submenu['themes.php'][6]); // Customize
}
add_action('admin_menu', 'as_remove_menus');
@eyecandy91
eyecandy91 / php
Created August 25, 2016 08:35
php get title and thumbnail inside next and prev btns
<div id="cooler-nav" class="navigation">
<?php $prevPost = get_previous_post(true);
if($prevPost) {?>
<div class="nav-box previous" style="float:left;">
<?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(100,100) );}?>
<?php previous_post_link('%link',"$prevthumbnail %title", TRUE); ?>
</div>
<?php $nextPost = get_next_post(true);
if($nextPost) { ?>
@eyecandy91
eyecandy91 / php
Last active September 15, 2016 12:02
show data IF checkbox is checked using the theme options plugin
// Remember to make the option field 'std' => '1',
<?php if ( 1 == of_get_option('app_on_off') ) { ?>
<p>checked</p>
<?php } else { ?>
<p>unchecked</p>
<?php } ?>
@eyecandy91
eyecandy91 / dabblet.css
Created February 24, 2017 08:12 — forked from chriscoyier/dabblet.css
Click open/close Dropdown in pure CSS
/* Click open/close Dropdown in pure CSS */
/* Disclaimer: Not the most semantic
thing in the universe. */
/* Forked from original idea
http://jsfiddle.net/paullferguson/Sv54G/3/ */
.tabs {
position: relative;
@eyecandy91
eyecandy91 / add to wp nav menu
Created March 21, 2017 06:04
add some html to the wp nav menu
wp_nav_menu(
array(
'theme_location' => 'primary',
'menu_class' => 'nav-menu',
'before' => '<span>',
'after' => '</span>'
)
);