This file contains hidden or 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
export const rem = (...px) => px.map((p) => `${p / 16}rem`).join(' '); |
This file contains hidden or 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 | |
// In WP multisite, WP strips out things like script tags and embeds from the | |
// editor for non-super-admins. This filter allows editors to use these tags. | |
add_filter('map_meta_cap', function ($caps, $cap, $user_id, $args) { | |
if ( | |
$cap === 'unfiltered_html' | |
&& (user_can($user_id, 'editor') || user_can($user_id, 'administrator')) | |
) { | |
$caps = ['unfiltered_html']; | |
} |
This file contains hidden or 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 | |
$items = array_fill(0, 16, 'item'); | |
$col = 0; | |
$row = 0; | |
foreach($items as $item) { | |
$col++; | |
if ($col > 4) { | |
$col = 1; | |
$row++; | |
} |
This file contains hidden or 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
.text-media { | |
padding: rem(70px 0); | |
&__layout { | |
@include container; | |
display: flex; | |
flex-direction: column; | |
gap: 5%; | |
align-items: center; | |
justify-content: center; |
This file contains hidden or 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 | |
$rating = 3.68; | |
$parts = explode('.', $rating); | |
?> | |
<style> | |
.rating { | |
display: flex; | |
align-items: center; | |
gap: 5px; |
This file contains hidden or 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
/* | |
const person = { | |
name: 'John', | |
age: 30, | |
address: { | |
street: 'Main Street', | |
city: 'New York', | |
state: 'NY', | |
zip: '10001' | |
}, |
This file contains hidden or 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 | |
abstract class Text { | |
public static function characters($nCharacters = 1) { | |
$words = self::$words; | |
$characters = ''; | |
while (strlen($characters) < $nCharacters) { | |
$characters .= self::words() . ' '; | |
} | |
$characters = substr($characters, 0, $nCharacters); |
This file contains hidden or 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_filter( 'admin_post_thumbnail_html', function($content, $post_id, $thumbnail_id) { | |
if ( 'post_type' !== get_post_type( $post_id ) ) { | |
return $content; | |
} | |
// remove the default recommended size | |
$string = '<p class="hide-if-no-js howto">We recommend a 16:9 aspect ratio for featured images.</p>'; | |
$content = str_replace($string, '', $content); | |
// add a custom caption | |
$caption = '<p class="howto">' . esc_html__( 'Minimum image size: 783x645', 'iv' ) . '</p>'; |
NewerOlder