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 | |
// Prefixing is recommended if you are not using a namespace. | |
// namespace TimJensen\GenesisStarter\Setup; | |
/** | |
* Adds hooks immediately before and after Genesis structural wraps. | |
* | |
* @version 1.1.0 | |
* | |
* @return void |
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 | |
// Replace with the name of your field group JSON. | |
$field_group_json = 'group_59e226a200966.json'; | |
$field_group_array = json_decode( file_get_contents( get_stylesheet_directory() . "/acf-json/{$field_group_json}" ), true ); | |
// Omit this line when using the Field Group Values package/plugin. | |
$config = $field_group_array['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 | |
// Make sure to prefix the function if you do not use a namespace. | |
// namespace TimJensen\HelperFunctions; | |
/** | |
* Returns an auto generated post excerpt, or a manual excerpt if one has been set. | |
* | |
* @version 1.2.1 | |
* | |
* @param int $post_id Required. Post ID. |
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_filter( 'enter_title_here', function( $title ) { | |
$screen = get_current_screen(); | |
if ( 'your_custom_post_type' == $screen->post_type ){ | |
$title = 'Your custom placeholder text'; | |
} | |
return $title; |
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_filter( 'get_search_form', 'prefix_render_faceted_search_form' ); | |
/** | |
* Adds checkboxes to the search form for searching specific post types. | |
* | |
* @param string $form The search form HTML output. | |
* | |
* @return string | |
*/ | |
function prefix_render_faceted_search_form( $form ) { |
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 | |
$data_types = [ 'data_item_one', 'data_item_two' ]; | |
// Props to @hellofromtonya for this. | |
$data_type_placeholders = implode( ', ', array_fill( 0, count( $data_types ), '%s' ) ); | |
global $wpdb; | |
$query = " | |
SELECT pm.post_id, pm.meta_key, pm.meta_value |
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_login', 'fj_infusionsoft_api_sample_usage', 10, 2 ); | |
/** | |
* Adds a user as an Infusionsoft contact after they log in to WordPress. | |
* | |
* @param string $user_login WP user login | |
* @param object $user WP user object | |
*/ | |
function fj_infusionsoft_api_sample_usage( $user_login, $user ) { | |
// Instantiates the Infusionsoft object and ensures that we have a valid access token. |
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
<form id="contact-form" method="post" action="mailer.php" role="form"> | |
<div class="messages"></div> | |
<div class="controls"> | |
<div class="row"> | |
<div class="col-md-6"> | |
<div class="form-group"> | |
<label for="form_name">Firstname *</label> |
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( 'cmb2_admin_init', 'yourprefix_register_demo_metabox' ); | |
/** | |
* Creating a metabox for a Genesis CPT Archive Settings page, where the CPT is 'webinars'. | |
*/ | |
function yourprefix_register_demo_metabox() { | |
/** | |
* Sample metabox to demonstrate each field type included |
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( 'genesis_meta', 'process_structural_wrap_handler' ); | |
/** | |
* Process the structural wrap handler. | |
* | |
* @since 1.0.0 | |
* | |
* @return void | |
*/ | |
function process_structural_wrap_handler() { |