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 | |
/** | |
* Implements hook_entity_type_alter(). | |
*/ | |
function example_entity_type_alter(array &$entity_types) | |
{ | |
foreach ($entity_types as $entity_type) { | |
if ($entity_type->getProvider() == 'eck' && !is_null($entity_type->getBundleOf())){ | |
$entity_type->setLinkTemplate('auto-label', $entity_type->getLinkTemplate('edit-form') . "/auto-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 | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
* | |
* Indicate some details about the field on the field overview form | |
*/ | |
function MYMODULE_form_field_ui_field_overview_form_alter(&$form, &$form_state, $form_id) { | |
$instances = field_info_instances( $form['#entity_type'], $form['#bundle'] ); | |
$fields = field_info_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 | |
/* | |
* Plugin Name: Lock plugin updates | |
* Description: Prevent plugin updates | |
* Version: 1.0.0 | |
* Author: daggerhart | |
*/ | |
add_filter( 'http_request_args', 'lock_plugins_http_request_args', 5, 2 ); |
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( 'wp_kses_allowed_html', array( $this, 'my_kses_allowed_html_hook' ), 20, 2 ); | |
function my_kses_allowed_html_hook( $tags, $context = null ){ | |
if ( 'post' == $context && ! isset( $tags['img'] ) ) { | |
$tags['img'] = array( | |
'src' => 1, | |
'height' => 1, | |
'width' => 1, | |
'alt' => 1, |
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 | |
/** | |
* Example of using wp_kses() to clean up WordPress post data. | |
*/ | |
function __cleanup_post_data(){ | |
global $wpdb; | |
// default wordpress "allowed html" for posts | |
$allowed_tags = wp_kses_allowed_html( 'post' ); |
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 | |
function __cleanup_post_data(){ | |
global $wpdb; | |
// default wordpress "allowed html" for posts | |
$allowed_tags = wp_kses_allowed_html( 'post' ); | |
// don't allow spans | |
unset($allowed_tags['span']); |
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 | |
/* | |
* Get the most recently replied-to topics, and their most recent reply | |
*/ | |
function custom_bbpress_recent_replies_by_topic($atts){ | |
$short_array = shortcode_atts(array('show' => 5), $atts); | |
extract($short_array); | |
// get the 5 topics with the most recent replies |
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 | |
/* | |
* Filter for bbpress reply post_title, without "Reply To: " prefix | |
* - reference: https://bbpress.trac.wordpress.org/browser/trunk/src/includes/replies/template.php | |
*/ | |
function custom_bbp_get_reply_title_fallback( $post_title = '', $post_id = 0 ){ | |
// Bail if title not empty, or post is not a reply | |
if ( ! empty( $post_title ) || ! bbp_is_reply( $post_id ) ) { | |
return $post_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 | |
/* | |
* Get the most recently replied-to topics, and their most recent reply | |
*/ | |
function custom_bbpress_recent_replies_by_topic($atts){ | |
$short_array = shortcode_atts(array('show' => 5, 'forum' => false, 'include_empty_topics' => false), $atts); | |
extract($short_array); | |
// default values |
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 | |
/* | |
Plugin Name: Custom QW Field Example | |
Description: Example of custom Query Wrangler field with $post and $field parameters. | |
Author: Jonathan Daggerhart | |
Version: 1.0 | |
*/ | |
add_filter('qw_fields', 'custom_qw_field'); | |