Skip to content

Instantly share code, notes, and snippets.

View ControlledChaos's full-sized avatar

Controlled Chaos Design ControlledChaos

View GitHub Profile
@ControlledChaos
ControlledChaos / README.md
Last active January 26, 2017 18:10 — forked from anonymous/index.html
Transforming, triangle bullet thing
@ControlledChaos
ControlledChaos / .maintenance
Last active November 5, 2024 10:06 — forked from mikemanger/.maintenance
Example WordPress .maintenance file. maintenance.php is optional but useful for styling the message the public will see (it is also used when updating WordPress components), drop it in your wp-content folder.
<?php
function is_user_logged_in() {
$loggedin = false;
foreach ( (array) $_COOKIE as $cookie => $value ) {
if ( stristr( $cookie, 'wordpress_logged_in_' ) ) {
$loggedin = true;
}
}
return $loggedin;
}
@ControlledChaos
ControlledChaos / register-post-type.php
Created May 11, 2017 19:34 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@ControlledChaos
ControlledChaos / acfw_location_rules.php
Created May 19, 2017 18:37 — forked from daronspence/acfw_location_rules.php
Return an array of rules for use with register_field_group() 'location' key
<?php
/**
* @func acfw_location_rules
* Return an array of rules for use with register_field_group() 'location' key
* @param array $a
* @param str $param
* @param str $operator
* @param bool $extended
*/
function acfw_location_rules( array $a, $param, $op, $extended = false ){
$.extend({
replaceTag: function (element, tagName, withDataAndEvents, deepWithDataAndEvents) {
var newTag = $("<" + tagName + ">")[0]
// From [Stackoverflow: Copy all Attributes](http://stackoverflow.com/a/6753486/2096729)
$.each(element.attributes, function() {
newTag.setAttribute(this.name, this.value);
});
$(element).children().clone(withDataAndEvents, deepWithDataAndEvents).appendTo(newTag)
return newTag
}
@ControlledChaos
ControlledChaos / README.md
Last active August 8, 2017 18:53 — forked from mayeenulislam/Default Taxonomy Term for CPT
Make Default taxonomy term for Custom Post Type - WordPress

Default Taxonomy Term

WordPress Snippet

@ControlledChaos
ControlledChaos / README.md
Last active January 2, 2020 12:54 — forked from mattradford/featured image from gallery.php
Set the featured image from the first image in an ACF gallery. Saves only for a specified post type.

Featured Image from ACF Gallery

WordPress Snippet + ACF

@ControlledChaos
ControlledChaos / README.md
Last active August 8, 2017 18:47 — forked from luetkemj/wp-query-ref.php
WP: Query $args

WP Query Arguments

WordPress Reference

@ControlledChaos
ControlledChaos / custom-search-acf-wordpress.php
Created September 14, 2017 01:15 — forked from felthy/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request. Updated to use wpdb prepare() and esc_like().
<?php
/*
##############################
########### Search ###########
##############################
Included are steps to help make this script easier for other to follow
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10
[list_searcheable_acf list all the custom fields we want to include in our search query]
@return [array] [list of custom fields]