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 | |
// My rewrite | |
$our_thinking_structure = 'our-thinking/%category%/%postname%'; | |
$wp_rewrite->add_permastruct('our_thinking', $our_thinking_structure, false); | |
// Going to /our-thinking/scenarios/a-spirit-of-entrepreneurship/ works just fine. | |
// But going to /our-thinking/scenarios/ tries to load an archive page. | |
// Can I get it to load the page I have set in WP instead? |
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
$leader_structure = '/performance/leaders/%leader%'; | |
$wp_rewrite->add_rewrite_tag("%leader%", '([^/]+)', "leader="); | |
$wp_rewrite->add_permastruct('leader', $leader_structure, false); | |
// Works | |
http://test.dev/?leader=from-basement-startup-to-global-force#more-118 | |
// Doesn't work | |
http://test.dev/performance/leaders/from-basement-startup-to-global-force |
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
<article role="article" itemscope itemtype="http://schema.org/BlogPosting"> | |
<img src="someimage.jpg"> | |
<header> | |
<h5><a href="#">TedX Edmonton Story (21pt)</a></h5> | |
<p><time itemprop="dateCreated" datetime="2013-10-12">Wednesday, October 12, 2013</time></p> | |
</header> | |
<p>15/24pt Velit auctor aliquet. Aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit. Duis sed odio sit amet nibh vulputate cursus a sit amet mauris. Morbi accumsan ipsum velit. Nam nec tellus a odio tincidunt auctor a ornare odio himenaeos.</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 | |
if (wp_is_mobile()) { | |
wp_deregister_script('jquery'); | |
wp_register_script('zepto-js', JS_PUBLIC_URI . 'vendor/zepto/zepto.min.js', array(), '', false); | |
wp_enqueue_script('zepto-js'); | |
} |
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
<figure class="quote"> | |
<blockquote> | |
Measuring programming progress by lines of code is like measuring aircraft building progress by weight. | |
</blockquote> | |
<figcaption>Bill Gates</figcaption> | |
</figure> |
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
$(document).ready(function() { | |
$(window).resize(function() { | |
// Do your thing | |
}).trigger('resize'); | |
}); |
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
var current_odometer_top = 0; | |
if ($('ul.odometer')) { | |
$('ul.odometer').animate({ top:0 }, 500, function() { | |
window.setInterval(function() { | |
odometer(); | |
}, 3000); | |
}); | |
$('ul.odometer li:nth-child(1)').addClass('active'); | |
} |
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
<? | |
$client = new Guzzle\Http\Client('http://zip.elevenbasetwo.com/v2'); | |
$response = $client->get('CA/T8N7L6')->send(); | |
if ($response->isSuccessful()) { | |
$data = $response->json(); | |
echo sprintf('City: %s<br>State: %s<br>Country: %s', $data['city'], $data['state'], $data['country']); | |
} else { | |
return false; | |
} |
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 | |
private function check_json() | |
{ | |
switch (json_last_error()) { | |
case JSON_ERROR_DEPTH: | |
$messages['error']['json'] = 'Maximum stack depth exceeded.'; | |
break; | |
case JSON_ERROR_STATE_MISMATCH: | |
$messages['error']['json'] = 'Underflow or the modes mismatch.'; |
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 | |
add_action('template_redirect', function() { | |
$url = $_SERVER['REQUEST_URI']; | |
if (strstr($url, '/wp-admin/downloads/communications')) { | |
// Do stuff | |
} | |
if (strstr($url, 'utm')) { |