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: Schema API | |
| * Plugin URI: | |
| * Description: | |
| * Version: 0.1.0 | |
| * Author: Micah Wood | |
| * Author URI: https://wpscholar.com | |
| * License: GPL2 |
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 taxonomy filtering to custom post types | |
| * | |
| * Original example for one post type, https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/ | |
| * | |
| */ | |
| function filter_cpt_by_taxonomies( $post_type, $which ) { | |
| // Affected post types | |
| $post_types = array( | |
| 'my_post_type', |
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
| /** | |
| * 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 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 | |
| // Recursively key search into a multidimensional array | |
| function recursive_array_search( $needle, $haystack ) { | |
| foreach ( $haystack as $key => $value ) { | |
| $current_key = $key; | |
| if ( $needle === $value || ( is_array( $value ) && recursive_array_search( $needle, $value ) !== false ) ) { | |
| return $current_key; | |
| } | |
| } |
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 | |
| /* | |
| * 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 | |
| */ |
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
| // inspired by: https://gist.github.com/rveitch/9018669face1686e74aaa68026856f36 | |
| // add title to CPTs which don't provide a title (useful for the relationship field (https://www.advancedcustomfields.com/resources/relationship/)) | |
| function sync_acf_post_title($post_id, $post, $update) { | |
| $post_type = get_post_type($post_id); | |
| // check for the current CPT | |
| if($post_type === "cpt_name_1") { |
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
| // put this in functions.php or in your custom plugin or theme code. | |
| $m = new Mandatory_Excerpt(); | |
| $m->add('post', 20 ); // will require all 'post' post types to have an excerpt at least 20 characters long | |
| /** | |
| * Helper class which removes specified metaboxes from specified pages. It manages setting up the hooks | |
| * and calling them. | |
| * | |
| * @author: Michael Fielding | |
| * |
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_action( 'edit_form_after_title', 'mc_post_excerpt_meta_box_before_content' ); | |
| /** | |
| * Move the post excerpt before post content | |
| * | |
| * @param $post | |
| * | |
| * @author Maxime CULEA | |
| */ | |
| function mc_post_excerpt_meta_box_before_content( $post ) { |
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
| $getposts = get_posts( array( | |
| 'numberposts' => -1, | |
| 'post_type' => 'post', | |
| 'post_status' => 'any', | |
| 'fields' => 'ids', | |
| 'meta_query' => array( | |
| 'relation' => 'OR', | |
| array( | |
| 'key' => 'custom_field', | |
| 'compare' => 'NOT EXISTS', |
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
| http://www.youtube.com/watch?v=-wtIMTCHWuI | |
| http://youtube.com/watch?v=-wtIMTCHWuI | |
| http://m.youtube.com/watch?v=-wtIMTCHWuI | |
| https://www.youtube.com/watch?v=lalOy8Mbfdc | |
| https://youtube.com/watch?v=lalOy8Mbfdc | |
| https://m.youtube.com/watch?v=lalOy8Mbfdc | |
| http://www.youtube.com/watch?v=yZv2daTWRZU&feature=em-uploademail | |
| http://youtube.com/watch?v=yZv2daTWRZU&feature=em-uploademail | |
| http://m.youtube.com/watch?v=yZv2daTWRZU&feature=em-uploademail |