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 | |
add_filter( 'the_content', function( $content ){ | |
// Just pretend you have a custom metabox that saves the ID for you. | |
$image_id = get_post_meta( 'custom_image', $post->ID ); | |
$image_src = ''; // instantiate variable | |
if ( !empty( $image_id ) ){ | |
$image_src = wp_get_attachment_image_src( $image_id, 'large'); | |
} |
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 | |
add_filter( 'the_content', function( $content ){ | |
$extra_content = get_post_meta( 'extra_content', $post->ID ); | |
if ( ! empty($extra_content ) ) | |
return $content . $extra_content ; | |
else | |
return $content; |
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 | |
/** | |
* Plugin Name: Quick Edit Pro | |
* Plugin Author: Daron Spence | |
* Version: 0.1 | |
*/ | |
add_action( 'quick_edit_custom_box', function( $column_name, $post_type ){ | |
if ( 'post' === $post_type && 'post_excerpt' === $column_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
add_filter( 'acfw_custom_template_dir', 'my_acfw_custom_directory' ); | |
function my_acfw_custom_directory( $template_dir ){ | |
$template_dir = get_stylesheet_directory() . '/my-templates/'; | |
return $template_dir; | |
} |
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
jQuery('#publish').on('click', function(e){ | |
var $checkboxes = jQuery('#project_categorieschecklist input[name*="project_categories"][type="checkbox"]'); | |
var checked = false; | |
var loop = jQuery.each( $checkboxes, function( i, el ){ | |
if ( true == jQuery( el ).prop('checked') ){ | |
checked = true; | |
return false; // bail early | |
} |
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 | |
/** | |
* Remove ACFE Options Page from ACF Feild Groups Location | |
* | |
* @since 1.0 | |
*/ | |
add_filter('acf/location/rule_values/options_page', function( $choices ) { | |
unset( $choices['acfe-licenses'] ); // options sub page menu-slug |
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 | |
class acf_field_gravity_forms extends acf_field { | |
function __construct() { | |
$this->name = 'gravity_forms_field'; | |
$this->label = __( 'Gravity Forms', 'acf' ); | |
$this->category = __( "Relational", 'acf'); | |
$this->defaults = array( | |
'multiple' => 0, |
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 | |
class WPMDBPro_Addon extends WPMDB_Base { | |
protected $version_required; | |
function __construct( $plugin_file_path ) { | |
$this->is_addon = true; | |
parent::__construct( $plugin_file_path ); | |
} | |
function meets_version_requirements( $version_required ) { |
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
add_action('wp_head', function(){ | |
global $posts; | |
foreach ( $posts as $post ){ | |
if ( strpos($post->post_content,'[acfe_form') !== false ){ | |
echo 'Contains the shortcode<br>'; // now do acf_form_head() | |
} | |
} | |
}); |
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
add_action('init', function(){ | |
global $wp_roles; | |
$roles = $wp_roles->roles; | |
$choices = array(); | |
foreach ( $roles as $key => $value ){ | |
if ( $key !== 'administrator') | |
continue; |