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
<template name="Home"> | |
{{> Svg svg='my-svg'}} | |
</template> |
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 | |
$str = unserialize(str_replace('s:0:;', 's:0:"";', preg_replace('/(.*?)(s:\d+:)([^{};]*?)([;}]+)/', '$1$2"$3"$4', $str))); | |
?> |
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 | |
// Fetch data required for custom orderby types and left join it into the query | |
add_filter('posts_join_paged', 'custom_orderby_joiner', 10, 2); | |
function custom_orderby_joiner($join_paged_statement, $wp_query) { | |
$orderby = $wp_query->query_vars['orderby']; | |
if ($orderby === 'popularity') { | |
$join_paged_statement .= " INNER JOIN (SELECT postid, pageviews FROM wp_popularpostsdata) popularpostsdata ON popularpostsdata.postid = wp_posts.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
eyJ2ZXJzaW9uIjoxLjMsImZlYXR1cmVzIjp7ImxvY2F0aW9uIjp7InJvb20iOnRydWUsIm91dHNpZGUiOnRydWV9fSwic3RvcmVzIjp7Indvb2QiOjI0MiwiZnVyIjoxMzUuNSwidGVldGgiOjU2LCJiYWl0Ijo0NywibWVhdCI6MTYuNSwic2NhbGVzIjoxNCwiY2hhcm0iOjMsImN1cmVkIG1lYXQiOjgzLCJjbG90aCI6NSwibGVhdGhlciI6MjZ9LCJjaGFyYWN0ZXIiOnt9LCJpbmNvbWUiOnsiZ2F0aGVyZXIiOnsiZGVsYXkiOjEwLCJzdG9yZXMiOnsid29vZCI6Mn0sInRpbWVMZWZ0Ijo0fSwiYnVpbGRlciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJ3b29kIjoyfSwidGltZUxlZnQiOjEwfSwiaHVudGVyIjp7ImRlbGF5IjoxMCwic3RvcmVzIjp7ImZ1ciI6NiwibWVhdCI6Nn0sInRpbWVMZWZ0Ijo1fSwidHJhcHBlciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJtZWF0IjotMSwiYmFpdCI6MX0sInRpbWVMZWZ0Ijo1fSwiY2hhcmN1dGllciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJtZWF0IjotNSwid29vZCI6LTUsImN1cmVkIG1lYXQiOjF9LCJ0aW1lTGVmdCI6MX0sInRhbm5lciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJmdXIiOjAsImxlYXRoZXIiOjB9LCJ0aW1lTGVmdCI6MX19LCJ0aW1lcnMiOnt9LCJnYW1lIjp7ImJ1aWxkZXIiOnsibGV2ZWwiOjR9LCJ0ZW1wZXJhdHVyZSI6eyJ2YWx1ZSI6NCwidGV4dCI6ImhvdCJ9LCJmaXJlIjp7InZhbHVlIjo0LCJ0ZXh0Ijoicm9hcmluZyJ9LCJidWlsZGluZ3MiOnsiY2FydCI6MSwidHJhcCI6NywiaHV0 |
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 | |
$paged = max(1, (int) $wp_query->query_vars['paged']); | |
$first_post_index = $paged === 1 ? 1 : ((($paged - 1) * (int) $wp_query->query_vars['posts_per_page']) + 1); | |
$last_post_index = (($first_post_index + (int) $wp_query->post_count) - 1); | |
echo "Showing {$first_post_index} – {$last_post_index} of {$wp_query->found_posts} 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
<?php | |
$query = new WP_Query(array( | |
'post_type' => 'employee', | |
'posts_per_page' => -1 | |
)); | |
while($query->have_posts()) { | |
$query->the_post(); | |
$taxonomy = 'department'; |
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 | |
$html = '<article class="grid-item"><p>Hello World</p></article><article class="grid-item"><p>Goodbye World</p></article>'; | |
$head = '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>'; | |
libxml_use_internal_errors(true); | |
$dom = new DOMDocument('1.0', 'utf-8'); | |
$dom->loadHTML($head . $html); | |
$xpath = new DOMXPath($dom); | |
// Loop through all article.grid-item elements and add the "invisible" class to them |
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
bcrypt $(echo -n "PASSWORD HERE" | sha256sum | cut -d " " -f 1) && echo | |
# or this | |
htpasswd -bnBC 10 "" $(echo -n "PASSWORD HERE" | sha256sum | cut -d " " -f 1) | tr -d ':\n' | sed 's/$2y/$2a/' | |
# orrrr this | |
htpasswd -bnBC 10 "" $(echo -n "PASSWORD HERE" | shasum -a 256 | cut -d " " -f 1) | tr -d ':\n' | sed 's/$2y/$2a/' |
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 sideroad_login_logo() { | |
$ratio = (get_custom_header()->height / get_custom_header()->width); | |
$width = 320; | |
$height = ($width * $ratio); | |
?> | |
<style type="text/css"> | |
#login h1 a, .login h1 a { | |
background-image: url('<?php header_image(); ?>'); | |
width: <?php echo $width; ?>px; |
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 base64_upload($base64, $filename = null) { | |
if (!$filename) $filename = md5($base64); | |
if (!pathinfo($filename, PATHINFO_EXTENSION)) $filename .= '.jpg'; | |
$content = base64_decode($base64); | |
$upload_dir = wp_upload_dir(); | |
$file = $upload_dir['path'] . DIRECTORY_SEPARATOR . $filename; | |
file_put_contents($file, $content); |