A Pen by Lindsay B. on CodePen.
This file contains hidden or 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
/* the lines of code that generates ALL checkbox fields*/ | |
case 'checkbox': | |
echo '<input type="checkbox" name="'.$field['id'].'" class="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/> | |
<label for="'.$field['id'].'">'.$field['desc'].'</label>'; | |
break; | |
/* the actual HTML output seems the same */ |
This file contains hidden or 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 | |
/** | |
* Ajax Alphavet A-Z Post Loading | |
* | |
* @package WordPress | |
* @subpackage Twenty_Fifteen | |
* @since Twenty Fifteen 1.0 | |
*/ | |
/** | |
* List letters A-Z Based on posts in the database |
This file contains hidden or 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
$myposts = get_posts( $args ); | |
$fri = date('Y-m-d',strtotime('friday this week')); | |
$sat = date('Y-m-d',strtotime('saturday this week')); | |
$sun = date('Y-m-d',strtotime('sunday next week')); | |
// one of the posts dumped in this has the "single date" array | |
var_dump($myposts); | |
This file contains hidden or 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
//makes an array of IDs (which is always going to be an array of ONE ID | |
$location = array($_POST['cat']); | |
// var_dump($location); | |
// Add the content of the form to $post as an array | |
$post = array( | |
'post_title' => $title, | |
'post_content' => $description, | |
'post_date' => date('Y-m-d H:i:s'), | |
//does not throw error but doesnt update the taxonomy with the term selected | |
'tax_input' =>array( 'location' => array( $location ) ), |
This file contains hidden or 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
if( 'POST' == $_SERVER['REQUEST_METHOD'] | |
) { // Check what the post type is here instead | |
// Setting the 'post_type' => $_POST['post_type'] in the $post array below causes 404 | |
// Just set it based on what is set in the above IF $_POST type == 'book'. | |
// and below do 'post_type' => 'book' | |
// Do some minor form validation to make sure there is content | |
if (isset ($_POST['postTitle'])) { $title = $_POST['postTitle']; } else { echo 'Please enter a title'; } | |
if (isset ($_POST['postContent'])) { $description = $_POST['postContent']; } else { echo 'Please enter the content'; } |
This file contains hidden or 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
foreach($var as $img): | |
$img=$img['ID']; | |
$newimg = wp_get_attachment_link($img, 'full'); | |
$i = 0; | |
?> | |
<li id="<?php echo $img[number];?>"><?php echo $newimg; ?></li> | |
<?php |
This file contains hidden or 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
$date_start = strtotime('first day of next month'); | |
$end_date = strtotime("last day of next month", $date_start); | |
while ($date_start <= $end_date) : | |
$weekdates[] = date("Y-m-d", $date_start); | |
$date_start = strtotime('+1 day', $date_start); | |
endwhile; | |
foreach ( $weekdates as $days): |
This file contains hidden or 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 callInstagram($url) | |
{ | |
$ch = curl_init(); | |
curl_setopt_array($ch, array( | |
CURLOPT_URL => $url, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_SSL_VERIFYPEER => false, | |
CURLOPT_SSL_VERIFYHOST => 2 | |
)); | |
This file contains hidden or 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
if ( 'multi' == pods_var( 'pick_format_type', $options ) && 1 != $pick_limit && taggable='true') { | |
tags: true, | |
createSearchChoice: function(term, data) { | |
if ($(data).filter(function() { | |
return this.text.localeCompare(term) === 0; | |
}).length === 0) { | |
return { | |
id: term, | |
text: term | |
}; |