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 | |
/** | |
* @package Custom_queries | |
* @version 1.0 | |
*/ | |
/* | |
Plugin Name: Custom queries | |
Plugin URI: http://wordpress.org/extend/plugins/# | |
Description: This is an example plugin | |
Author: Carlo Daniele |
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 | |
// Register Post Type | |
add_action('init', 'hwk_post_type_exemple', 0); | |
function hwk_post_type_exemple(){ | |
register_post_type('exemple', array( | |
'hierarchical' => false, // true | false. See 'post_row_actions' & 'page_row_actions' filters | |
'public' => false, | |
'show_ui' => true, | |
'show_in_menu' => true, |
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('sanitize_file_name', 'hwk_sanitize_file_name'); | |
function hwk_sanitize_file_name($input){ | |
$path = pathinfo($input); | |
$extension = (isset($path['extension']) && !empty($path['extension'])) ? $path['extension'] : ''; | |
$file = (!empty($extension)) ? preg_replace('/.' . $extension . '$/', '', $input) : $input; | |
return sanitize_title(str_replace('_', '-', $file)) . ((!empty($extension)) ? '.' . $extension : ''); | |
} |
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 | |
/** | |
* Post a message to Slack from WordPress | |
* | |
* @param string $message the message to be sent to Slack | |
* @param string $channel the #channel to send the message to (or @user for a DM) | |
* @param string $username the username for this bot eg : WordPress bot | |
* @param string $icon_emoji the icon emoji name for this bot eg :monkey: | |
* |
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 | |
/* | |
* ----------------------------------------------------------------------------- | |
* Advanced Custom Fields Modifications | |
* ----------------------------------------------------------------------------- | |
*/ | |
function PREFIX_apply_acf_modifications() { | |
?> | |
<style> |
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: Remove Slug from Custom Post Type | |
* Description: Remove slug from custom post type URLs. | |
* Version: 0.1.0 | |
* Author: Kellen Mace | |
* Author URI: https://kellenmace.com/ | |
* License: GPLv2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ |
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: Disable plugins when doing local dev | |
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ |
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
/** | |
* WordPress | |
* Showing feature image in admin post listing | |
*/ | |
add_filter('manage_posts_columns' , 'ask_custom_columns'); | |
/*add_filter('manage_{post-type-slug}_posts_columns' , 'ask_custom_columns');*/ | |
function ask_custom_columns( $columns ) { | |
$columns = array( |
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 | |
/* | |
* This code is modified from the original here | |
* https://github.com/Hube2/acf-filters-and-functions/blob/master/acf-reciprocal-relationship.php | |
* | |
* Some comments may not be useful anymore since the modifications | |
*/ | |