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 | |
/** | |
* Filter the taxonomy hierarchy to inject a parent level of templates. | |
* | |
* @param string $template The current template. | |
* @return string Filtered taxonomy template. | |
*/ | |
function new_tax_hierarchy( $template ) { | |
$term = get_queried_object(); |
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
reddit powers thousands of distinct online communities. | |
these terms and your conduct make that possible. | |
Hello redditors and people of the Internet! We want you to know your rights and our rights and so we have prepared this agreement ("user agreement" or "agreement") between reddit ("we", "our," "us") and you. This agreement sets the terms of your use of the reddit website and services ("reddit") that include subreddits, communities, boards, forums, chats, reddit.tv, and tons of other greatness. This agreement is meant to encourage a fair and tolerant place for ideas, people, links, and discussion. | |
We also operate redditgifts, which has its own terms that you should read here. | |
first, the legal stuff |
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
// This assumes you've already installed Node.js and any related dependencies. | |
// 1. Drop this and package.json into your theme root | |
// 2. Run: npm install | |
// 3. Run: grunt | |
// 4. ?????? | |
// 5. Profit | |
module.exports = function ( grunt ) { | |
grunt.initConfig( { |
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_filter( 'attachment_fields_to_edit', 'attachment_fields_to_edit', 10, 2 ); | |
add_filter( 'attachment_fields_to_save', 'attachment_fields_to_save', 10, 2 ); | |
function attachment_fields_to_edit( $form_fields, $post ) { | |
$form_fields["client_test_input"] = array( | |
"label" => __( 'Test Input URL' , 'client' ), | |
"value" => get_post_meta( $post->ID, "_client_test_input", true ), | |
"helps" => __( 'Test Input Field', 'client' ) | |
); |
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 | |
remove_filter( 'the_content', 'wpautop' ); | |
$content = wpautop( $content, false ); | |
echo apply_filters( 'the_content', $content ); | |
add_filter( 'the_content', 'wpautop' ); |
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 | |
/** | |
* Integrate Imager.js with WordPress | |
* | |
* Imager.js is BBC's solution for serving responsive and retina images, without | |
* the double payload issues that affect other solutions. For more information: | |
* | |
* https://github.com/BBC-News/Imager.js/ | |
* | |
* This collection of functions modifies the output of WordPress's |
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
// iframes | |
var $iframes = $( document.querySelectorAll( '.videos iframe' ) ); | |
function iframeSizing() { | |
var $this = $( this ), | |
width = $this.width(), | |
height = $this.height(), | |
containerWidth = $this.parent().width(), | |
heightRatio = height / width, | |
newHeight = heightRatio * containerWidth; |
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 | |
remove_filter( 'the_content', 'wpautop' ); | |
$content = wpautop( $content, false ); | |
echo apply_filters( 'the_content', $content ); | |
add_filter( 'the_content', 'wpautop' ); |
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 | |
function count_wtd_words() { | |
$posts = get_posts( array( | |
'tag' => 'write-the-docs', | |
'posts_per_page' => -1, | |
'suppress_filters' => false, | |
'post_status' => 'publish', | |
) ); |
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 | |
$id = (int) $id; | |
if ( empty( $id ) ) { | |
return new WP_Error( 'json_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) ); | |
} | |
$post = get_post( $id, ARRAY_A ); |