This snippet has been moved to the CMB2 Snippet Library.
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 | |
/** | |
* Handly place to define our endpoints all in one spot | |
* @return array Array of our endpoints | |
*/ | |
function prefix_custom_endpoints() { | |
return array( | |
'portfolio', | |
'testimonials', |
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
.advanced-toggle .toggle-label { | |
cursor: pointer; | |
display: block; | |
line-height: 3em; | |
border-bottom: 1px solid #e9e9e9; | |
border-left: 1px solid #e9e9e9; | |
border-right: 1px solid #e9e9e9; | |
padding-left: .8em; | |
} | |
.advanced-toggle .inside .cmb-row { |
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 | |
// Include tlc lib | |
require_once WPMU_PLUGIN_DIR . '/wp-tlc-transients/tlc-transients.php'; | |
/** | |
* Use in place of `get_posts` | |
* | |
* @param array $args Array of get_posts arguments | |
* @param integer $time Amount of time before cache expires |
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 | |
$cmb->add_field( array( | |
'name' => __( 'Postive numbers', 'theme-domain' ), | |
'desc' => __( 'Numbers only', 'msft-newscenter' ), | |
'id' => $prefix . 'number', | |
'type' => 'text', | |
'attributes' => array( | |
'type' => 'number', | |
'pattern' => '\d*', |
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 | |
function cmb_opt_groups( $args, $defaults, $field_object, $field_types_object ) { | |
// Only do this for the field we want (vs all select fields) | |
if ( '_cmb_option_field' != $field_types_object->_id() ) { | |
return $args; | |
} | |
$option_array = array( | |
'Group 1' => array( |
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 Selector_Cache() { | |
var elementCache = {}; | |
var get_from_cache = function( selector, $ctxt, reset ) { | |
if ( 'boolean' === typeof $ctxt ) { | |
reset = $ctxt; | |
$ctxt = false; | |
} | |
var cacheKey = $ctxt ? $ctxt.selector + ' ' + selector : selector; |
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
UPDATE wp_posts | |
inner join wp_term_relationships rel on wp_posts.id=rel.object_id | |
inner join wp_term_taxonomy tax on rel.term_taxonomy_id=tax.term_taxonomy_id | |
inner join wp_terms term on tax.term_id=term.term_id | |
set wp_posts.post_type='your_post_type' | |
WHERE | |
term.slug="category_name" |
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
[branch] | |
autosetuprebase = always | |
[mergetool "p4merge"] | |
cmd = /home/<username>/dir/to/p4v/bin/p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED" | |
keepTemporaries = false | |
trustExitCode = false | |
keepBackup = false | |
[merge] |
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 | |
# 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 |