Skip to content

Instantly share code, notes, and snippets.

@WerdsWords
WerdsWords / posts_join_paged.php
Created July 19, 2013 08:20
#10: posts_join_paged
<?php
@WerdsWords
WerdsWords / http_response.php
Last active December 19, 2015 23:49
#11: http_response
<?php
/**
* Return canned body content for invalid http requests
*
* @see WP_Http::request()
*
* @param array $response The http response.
* @param array $args An array of arguments.
* @param string $url The request URL.
*
@WerdsWords
WerdsWords / protected_title_format.php
Last active December 20, 2015 00:29
#12: protected_title_format
<?php
/**
* 'Members Only' title for protected posts
*
* @see get_the_title()
*
* @param string $protected Text prefixed to the title for password-protected posts.
*
* @return string The filtered prefix text.
*/
@WerdsWords
WerdsWords / author_rewrite_rules.php
Created July 22, 2013 05:48
#13: author_rewrite_rules
<?php
/**
* Change 'author' permalinks to 'contributors'
*
* @see WP_Rewrite::rewrite_rules()
*
* @param array $author_rewrite The authors rewrite rules.
*
* @return array The filter rewrites array.
*/
@WerdsWords
WerdsWords / author_rewrite_rules_bonus.php
Created July 22, 2013 05:50
#13: author_rewrite_rules bonus functions
<?php
/**
* Add 'redirect' query var
*
* @see WP::parse_request()
*
* @param array $query_vars The query vars array.
*
* @return array The filtered query vars array.
*/
@WerdsWords
WerdsWords / the_editor_content.php
Last active December 20, 2015 01:49
#14: the_editor_content
<?php
/**
* Inject a post template into the post editor
*
* @see _WP_Editors::editor(), wp_editor()
*
* @param string $content The editor content.
*
* @return string The filtered editor content.
*/
@WerdsWords
WerdsWords / the_content.php
Created July 22, 2013 15:32
#15: the_content
<?php
/**
* Convert double-spaced sentence endings to singles
*
* @param string $content The post content.
*
* @return string The filtered post content.
*/
function wpdocs_double_spaces_to_singles( $content ) {
// Replaces '. ' with '. '
@WerdsWords
WerdsWords / page_link.php
Created July 23, 2013 16:57
#16: page_link
@WerdsWords
WerdsWords / paginate_links.php
Last active December 20, 2015 03:39
#17: paginate_links
@WerdsWords
WerdsWords / pre_link_description.php
Created July 24, 2013 15:34
#18: pre_link_description