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 exclude_nonadvertorial_search($query) { | |
//only run for the main query and don't run on admin pages | |
if (!is_admin() && $query->is_main_query()) { | |
//now check to see if you are on a search results page | |
if ($query->is_search) { | |
//get sponsor posts that are NOT advertorials, so we can exclude their IDs from search | |
$args = array( | |
//get posts of the custom post type sponsor_post | |
'post_type' => 'sponsor_post', | |
//get all posts |
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
//remove default category (uncategorized) when another category has been set | |
function remove_default_category($ID, $post) { | |
//get all categories for the post | |
$categories = wp_get_object_terms($ID, 'category'); | |
//if there is more than one category set, check to see if one of them is the default | |
if (count($categories) > 1) { | |
foreach ($categories as $key => $category) { | |
//if category is the default, then remove it |
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
// navbar logo redirect | |
document.addEventListener("contextmenu", function(e) { | |
var triggerClass = "right-click-redirect", | |
logosUrl = "/logos/", | |
$target = $(e.target); | |
if ($target.hasClass(triggerClass) || $target.parents('.' + triggerClass).length) { | |
if (window.location.pathname !== logosUrl) { | |
window.location = logosUrl; | |
} else { | |
alert("You can download our logo below"); |
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 | |
function omit_twitter_script($provider, $url, $args) { | |
//get the hostname of the oEmbed endpoint provider being called | |
$host = parse_url($provider, PHP_URL_HOST); | |
//check to see that hostname is twitter.com | |
if (strpos($host, 'twitter.com') !== false) { | |
//adding ?omit_script=true to oEmbed endpoint call stops the returned HTML from containing widgets.js | |
$provider = add_query_arg('omit_script', 'true', $provider); | |
} | |
//return the $provider URL so the oEmbed can be fetched |
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
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'YOUR ANALYTICS ID HERE', 'auto'); | |
ga('set', 'dimension1', 'John Q. Author'); | |
ga('send', 'pageview'); | |
</script> |
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
<a href="<?php echo get_the_permalink(); ?>"> | |
<?php | |
//check if Jetpack is acctive | |
if (class_exists('Jetpack_PostImages')) { | |
//get the ID of the post thumbnail image | |
$thumb_id = get_post_thumbnail_id(); | |
//get the URL of the image | |
$img_url = wp_get_attachment_image_src($thumb_id, 'full'); | |
//get the image alt text | |
$alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true); |
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
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"masterDnsNamePrefix": { | |
"type": "string", | |
"metadata": { | |
"description": "Sets the Domain name prefix for the Master nodes in a cluster. The concatenation of the domain name and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address." | |
} | |
}, |
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
# Catch-all server block, resulting in a 444 response for unknown domains. | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name _; | |
return 444; | |
} |