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 | |
| echo $check_fn = ( function_exists( 'http_parse_message' ) ) ? 'yo' : 'no'; | |
| echo ' '; | |
| echo $check_ext = ( extension_loaded( 'pecl_http' ) ) ? 'yo' : 'no'; | |
| if ( class_exists('My_Class') ) { | |
| $my_class = new My_Class(); | |
| } | |
| echo 'Current PHP version: ' . phpversion(); |
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 | |
| /* | |
| * Display a new item every day of current month (like an Advent calendar). | |
| * If day has arrived: display the article HTML. | |
| * If day hasn't arrived, print default HTML. | |
| * Restrict numbers to total days in current month. | |
| * | |
| * Compares an array's key (day number) to current day of month. | |
| * Made for Hearing Voices page "Xmas: HV Holiday Stories" (2016). |
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
| <ol> | |
| <?php | |
| /* Remove duplicate meta, in this case Author and Contact (custom tax) */ | |
| // Get all posts assigned a term in a specific custom taxonomy. | |
| $tax = 'contact'; | |
| $args = array( | |
| 'post_type' => 'post', | |
| 'posts_per_page' => 1000, | |
| 'orderby' => 'ID', |
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 | |
| /** | |
| * Change attribute for WP audio shortcode and embed. | |
| * | |
| * Default preload attribute is 'none' which shows time as 'O:OO'. | |
| * Setting attribute to 'metadata' displays time upon page load. | |
| * | |
| * @param string $html Default audio shortcode HTML output. | |
| * @return string $html Filtered audio shortcode HTML output. | |
| */ |
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 | |
| /******************************* | |
| =Yoast SEO Hooks (includes Premium) | |
| ******************************/ | |
| /* Remove default redirects feature, for posts and term. | |
| * @link https://kb.yoast.com/kb/how-to-disable-automatic-redirects/ | |
| */ | |
| add_filter('wpseo_premium_post_redirect_slug_change', '__return_true' ); | |
| add_filter('wpseo_premium_term_redirect_slug_change', '__return_true' ); |
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 | |
| /* Get IDs of posts with content that doesn't contain a search term. */ | |
| $keyword = 'search term here'; | |
| $max_posts = 400; // More than the total number of posts. | |
| $query_ids = new WP_Query( array( 'post_type' => 'post', 'fields' => 'ids', 'posts_per_page' => $max_posts ) ); | |
| $query_search = new WP_Query( array( 'post_type' => 'post', 'fields' => 'ids', 'posts_per_page' => $max_posts, 's' => $keyword ) ); | |
| $ids_not_found = array_diff( $query_ids->posts, $query_search->posts ); | |
| sort( $ids_not_found ); | |
| print_r( $ids_not_found ); |
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 | |
| /** | |
| * Shortcode to hide email address from Spam Bots. | |
| * | |
| * Example: [email]me@mysite.com[/email] | |
| * | |
| * @uses antispambot() Wordpress native function | |
| * | |
| * @param array $atts Shortcode attributes. Not used. |
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 | |
| /** | |
| * Use Jetpack's Contact form to provide download links (in success message). | |
| * | |
| * Filter the Jetpack Contact Form's message returned after a successful submission. | |
| * Put download links in a custom field to display in success message. | |
| * | |
| * @param string $r_success_message Success message. | |
| * @return string $r_success_message Success message. | |
| */ |
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 | |
| /* Shortcode to list page family tree, for current parent. | |
| * | |
| * Optional shortcode attributes: parent (ID), a depth, and title. | |
| * [my_page_family_list parent="123" depth="2" title="My List Title"] | |
| * | |
| * @param array $atts Array of settings for wp_list_pages(). | |
| * | |
| * @return string $list HTML list (nested) of page-family links. | |
| */ |