Skip to content

Instantly share code, notes, and snippets.

add_action('wp-routes/register_routes', function(){
with('/location-api', function(){
respond('GET', '/[i:id]', function($request){
$post = get_post($request->id);
// $post = get_posts(array('post_type' => 'location'));
header('Content-Type: application/json');
if ($post) {
$fields = array(
'post_id' => $post_id = $post->ID,
'title' => $post->post_title,
@simplethemes
simplethemes / acf_toolbars_functions.php
Created October 20, 2015 21:51
Add toolbars to ACF
<?php
if (! function_exists('st_acf_toolbars')) {
function st_acf_toolbars() {
// Full
$toolbars['Full'] = array();
$toolbars['Full'][1] = apply_filters('mce_buttons', array('code','bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
$toolbars['Full'][2] = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo'), $editor_id);
$toolbars['Full'][3] = apply_filters('mce_buttons_3', array(), $editor_id);
<?php
add_action('kronos_header','site_header',1);
function site_header() { ?>
<div class="wrap header-wrap">
<div class="header-container">
<div class="site-header">
<h1 class="site-title">
<a title="<?php echo get_bloginfo( 'description' );?>" href="<?php echo esc_url(home_url('/'));?>" rel="home"><?php echo get_bloginfo( 'name' );?></a>
</h1>
<?php do_action('kronos_show_menu','primary'); ?>
@simplethemes
simplethemes / style.scss
Created February 12, 2016 07:01
WordPress Gallery Columns - SASS / Bourbon Neat
.gallery-columns-2 {
@include row();
.gallery-item {
margin:0;
@include span-columns(6 of 12);
@include omega(2n);
text-align: center;
}
}
@simplethemes
simplethemes / functions.php
Created April 20, 2016 21:14
Removes the YouTube dog shit from WordPress oEmbed
function deuglify_youtube($embed) {
if (strstr($embed,'https://www.youtube.com/embed/')) {
return str_replace('?feature=oembed','?feature=oembed&autohide=1&rel=0&modestbranding=0&showinfo=0&enablejsapi=1',$embed);
} else {
return $embed;
}
}
add_filter('oembed_result', 'deuglify_youtube', 1, true);
@simplethemes
simplethemes / functions.php
Last active November 23, 2023 12:04
CPT Rewrite
/**
* Register Community Custom Post Type
*/
function community_post_type() {
$labels = array(
'name' => 'Communities',
'singular_name' => 'Community',
'menu_name' => 'Communities',
'name_admin_bar' => 'Communities',
/*
Plugin Name: Set Shop Cookie
Description: Adds a cookie for most recently viewed products
Version: 0.1
Author: Casey Lee
Author URL: https://simplethemes.com
*/
class SetWpShopCookie {
var data = [
{
id: 1,
text: 'Adams'
},
{
id: 2,
text: 'Ashland'
},
{
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>Video Control Example</title>
@simplethemes
simplethemes / utils.scss
Created October 19, 2017 17:12
SASS Margin/Padding Utilities
/*!
* Margin Offsets
*/
.mv0 {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.mh0 {
margin-left: 0 !important;