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
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event)) | |
}) | |
/** | |
* @param event | |
*/ | |
async function handleRequest(event) { | |
const cache = caches.default |
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 if ( is_user_logged_in() ) { ?> | |
<p style="margin:40px 0;line-height:200%"><?php edit_post_link('Edit', '', ''); ?><br /> | |
<a href="<?php echo get_dashboard_url() ?>">Dashboard</a> | |
</p> | |
<?php } ?> |
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
/** | |
* Display a custom taxonomy dropdown in admin | |
* @author Mike Hemberger | |
* @link http://thestizmedia.com/custom-post-type-filter-admin-custom-taxonomy/ | |
*/ | |
add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy'); | |
function tsm_filter_post_type_by_taxonomy() { | |
global $typenow; | |
$post_type = 'person'; // change to your post type |
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( 'admin_post_thumbnail_html', 'add_featured_image_instruction'); | |
function add_featured_image_instruction( $content ) { | |
return $content .= '<p>The Featured Image is an image that is chosen as the representative image for Posts or Pages. Click the link above to add or change the image for this post. </p>'; | |
} |
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 | |
$post_type = 'person'; | |
// Get all the taxonomies for this post type | |
$taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) ); | |
foreach( $taxonomies as $taxonomy ) : | |
// Gets every "category" (term) in this taxonomy to get the respective posts | |
$terms = get_terms( $taxonomy ); |
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
$number = 20; | |
if ($number % 2 == 0) { | |
print "It's even"; | |
} |
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
# BEGIN GZIP | |
<ifmodule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript | |
</ifmodule> | |
# END GZIP | |
##### EXPIRE CACHING - LEVERAGE BROWSER CACHING ##### | |
# Enable expirations |
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
<ul class="side-archives"> | |
<?php | |
/**/ | |
$years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) | |
FROM $wpdb->posts WHERE post_status = 'publish' | |
AND post_type = 'post' ORDER BY post_date DESC"); | |
foreach($years as $year) : | |
?> | |
<li><h2 class="side-archives__year"><?php echo $year; ?></h2> |
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
<h1> | |
<?php | |
global $wp_query; | |
echo $wp_query->found_posts; | |
echo " "; | |
if($wp_query->found_posts > 1){ | |
_e('results found for','leo'); | |
} else { | |
_e('result found for','leo'); | |
} |
NewerOlder