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
add_action( 'customize_register', function ( $manager ) { }, 10, 1 ); |
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
module.exports = { | |
eleventyComputed: { | |
tags: data => { | |
if(!data.draft) return 'posts'; | |
return ''; | |
} | |
} | |
} |
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
function prefix_site_icon() { | |
// I'm assuming separate files for separate environments. | |
// You could adapt this to one svg icon with different css varaibles controlling the color per environemnt. | |
if ( ! has_site_icon() ) { | |
// this is your default/production favicon | |
$icon = '<link rel="apple-touch-icon" sizes="180x180" href="">'; | |
$icon .= "\n" . '<link rel="icon" type="image/png" sizes="32x32" href="">'; |
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
add_action( 'rss2_item', 'prefix_add_rss_image' ); | |
function prefix_add_rss_image() { | |
global $post; | |
if ( is_feed() && has_post_thumbnail( $post->ID ) ) { | |
$image_url = get_the_post_thumbnail_url( $post->ID ); | |
if ( $image_url ) { | |
$image_id = get_post_thumbnail_id( $post->ID ); | |
if ( $image_id ) { | |
$image_title = get_the_title( $image_id ); |
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
function redirect_search() { | |
if (is_search() && !empty($_GET['s'])) { | |
wp_redirect('https://cse.google.com/cse?cx=PSE_ID&q=' . urlencode(get_query_var('s')) ); | |
exit(); | |
} | |
} | |
add_action('template_redirect', 'redirect_search' ); |
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
(?d).DS_Store | |
(?i).git* |
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
function prefix_enqueued_assets() { | |
$version_string = NULL; | |
if ( 'production' !== wp_get_environment_type() ) { | |
$version_string = bin2hex(random_bytes(4)); | |
} | |
wp_register_style( | |
'prefix-theme-css', |
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
function prefix_template_meta() { | |
if (get_page_template_slug() == 'page template slug') { | |
// This is an arbitrary operation, in this case. You could do anything here. | |
// Beware making assumptions about the availability of things, like the post ID, if you change the action hook. | |
add_filter( 'language_attributes', 'prefix_xml_namespaces' ); | |
} | |
} |
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
add_filter( 'language_attributes', 'prefix_xml_namespaces' ); | |
function prefix_xml_namespaces($output) { | |
return $output . ' xmlns="http://www.w3.org/1999/xhtml" etc'; | |
} |
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
function prefix_filter_embeds( $content ) { | |
if strpos( $content, 'string' ) !== false ) { | |
add_action( 'wp_head', 'prefix_url_actions', 0 ); | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'prefix_filter_embeds' ); | |
function prefix_url_actions() { |
NewerOlder