This file contains 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 | |
class BEA_ACF_Helpers { | |
// Fields to not add to the available fields of acf | |
private static $unauth_fields = array( | |
'repeater', | |
'relationship', | |
'flexible_content' | |
); | |
/** |
This file contains 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 | |
/** | |
* Show taxonomy selection in WordPress admin as single <select> box or checkboxes | |
* | |
* @author Jari Pennanen / https://github.com/ciantic | |
* @license Public Domain | |
**/ | |
// Usage example: | |
register_taxonomy("my_taxonomy", array("post"), array( |
This file contains 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
add_action( 'wp_footer', 'infinite_load' ); | |
function infinite_load() { | |
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; | |
?> | |
<script> | |
jQuery(document).ready(function($){ | |
if( window.history && history.pushState ) { | |
var $page = <?php echo $paged; ?>; |
This file contains 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 onViewport(el, elClass, offset, callback) { | |
/*** Based on http://ejohn.org/blog/learning-from-twitter/ ***/ | |
var didScroll = false; | |
var this_top; | |
var height; | |
var top; | |
if(!offset) { var offset = 0; } | |
$(window).scroll(function() { |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<templateSet group="WordPress"> | |
<template name="aa" value="add_action( '$hook$', '$callback$' ); $END$" description="add_action" toReformat="false" toShortenFQNames="true"> | |
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="HTML_TEXT" value="false" /> | |
<option name="HTML" value="false" /> | |
<option name="XSL_TEXT" value="false" /> | |
<option name="XML" value="false" /> |
This file contains 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 | |
/** | |
* Class ACF_Terms_Fields | |
* @version 1.1.0 | |
* | |
* Fill all the taxonomy terms with ACF metas | |
*/ | |
class ACF_Terms_Fields { | |
/** |
This file contains 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 | |
add_action( 'wp_insert_post', 'willy_set_default_term', 10, 3 ); | |
function willy_set_default_term( $post_id, $post, $update ) { | |
if ( 'cpt' == $post->post_type ) { // replace `cpt` with your custom post type slug | |
/** | |
* Replace `taxo` by the taxonomy slug you want to control/set | |
* … and replace `default-term` by the default term slug (or name) | |
* (or you can use a `get_option( 'my-default-term', 'default term' )` option instead, which is much better) | |
*/ | |
if ( empty( wp_get_post_terms( $post_id, 'taxo' ) ) ) { |