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
/** | |
* Process form data: make PDF, send email; trigged on Form Submit. | |
* | |
* Documentation: | |
* https://docs.google.com/document/d/1O4Y-3VqhhnL-kXPXM3S2XDoQebevIH7UoXQUxpjjtuo/edit | |
* | |
* @param {e} obj Form data (includes user-submitted field values). | |
* | |
* @return void | |
*/ |
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 | |
/** | |
* Adds modified date to displayed post meta. | |
* | |
* Uses action in theme's /inc/template-tags.php file. | |
* Param values passed by the action hook. | |
* @param int $post_id The ID of the post. | |
* @param array $post_meta An array of post meta information. | |
* @param string $location The location where the meta is shown. | |
*/ |
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 | |
/******************************* | |
CUSTOM POST STATUS | |
******************************/ | |
/** | |
* Register custom post status. | |
* | |
* @return object | |
*/ | |
function my_custom_post_status(){ |
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 | |
/** | |
* Sort query results by one meta value; filter by another. | |
* For example, post are 'cities': | |
* Sort cities with >40K population ('city_pop') by average income ('city_income'). | |
*/ | |
$args = array( | |
'post_type' => 'cities', | |
'posts_per_page' => 1000, | |
'meta_query' => 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 | |
// @ see: http://www.justin-cook.com/2006/03/31/php-parse-a-string-between-two-strings/ | |
function get_string_between( $string, $start, $end){ | |
$string = " " . $string; // Convert to string. | |
$ini = strpos( $string, $start ); // Position of start text. | |
if ($ini == 0) { | |
return ""; | |
} | |
$ini += strlen( $start ); // Length of start text. |
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 image data column to Media Library */ | |
/** | |
* Add columns (file-size) to the Media Library list table. | |
* | |
* @param array $posts_columns Existing array of columns displayed in the Media list table. | |
* @return array Amended array of columns to be displayed in the Media list table. | |
*/ | |
function my_media_columns( $posts_columns ) { | |
$posts_columns['size'] = __( 'Size', 'headecon' ); |
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 | |
// Make CSS class name from site URL. | |
$urlparts = parse_url( site_url() ); | |
$class_domain = 'site-' . str_replace( '.', '-', $urlparts [host] ); | |
?> | |
<body <?php body_class( $class_domain ); ?>> | |
?> | |
/* | |
Example of adding CSS badge over site logo only at Staging site: |
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 category posts. | |
$query_args = array( | |
'category_name' => 'episode', // Name of category. | |
'posts_per_page' => 50, // Do in bathces to avoid overloading server. | |
'offset' => 0, // Skip previous batch by incrementing by 50 each time run. | |
); | |
$query = new WP_Query( $query_args ); |
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 a Character Counter to Excerpt box in Edit Post screen. | |
* | |
* Includes suggested range. | |
* Char-count number is color red when outside range and green within. | |
* | |
* @link http://wpsites.org/add-character-counter-excerpt-box-10503/ | |
*/ | |
function my_excerpt_count_js() { |
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 | |
/* 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. | |
*/ |
NewerOlder