Skip to content

Instantly share code, notes, and snippets.

View aspectbox.html
<figure class=“aligncenter”>
<style>img#mv-trellis-img-1::before {padding: 100%; }img#mv-trellis-img-1 {display: block;}</style>
<noscript><img src=“http://mediavine.local/wp-content/uploads/2013/03/image-alignment-580x300-1.jpg” alt=“Image Alignment 580x300” class=“wp-image-906" data-pin-media=“http://mediavine.local/wp-content/uploads/2013/03/image-alignment-580x300-1.jpg” loading=“lazy”></noscript>
<img alt=“Image Alignment 580x300” class=“wp-image-906 lazyload” data-pin-media=“http://mediavine.local/wp-content/uploads/2013/03/image-alignment-580x300-1.jpg” loading=“lazy” data-src=“http://mediavine.local/wp-content/uploads/2013/03/image-alignment-580x300-1.jpg” id=“mv-trellis-img-1" src=“data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3Crect%20width='300'%20height='300'%20style='fill:%23e3e3e3'/%3E%3C/svg%3E” width=“300" height=“300”>
</figure>
View graphtags.html
<p>Join Mediavine by helping us build the future, and your own online community, by opting into the Grow.me open beta.</p>
<p>Grow.me is a new platform by Mediavine to help you increase traffic, make more money, build your audience and improve user experience.</p>
<p>You don't need WordPress or the Grow Social Pro plugin to run Grow.me, which works directly from the Mediavine script wrapper. There will be enhanced features if you use Social Pro, but it is not required to run Grow.me.</p>
<p>Grow.me brings the speed and stability of Mediavine Ad Management to Grow, and it's where we’ll be adding future features. Right now, it will run alongside the WordPress Grow Social Pro plugin.</p>
<p>The initial Grow.me beta allows readers to love, bookmark and share your content easily to their favorite social platforms. But this is only the beginning. We've got big ideas, all designed to enhance your website for readers and keep them coming back.</p>
<p>So much is coming to the Grow.me beta that you can be p
View meta.html
<div class="article-meta">
<p>
<span class="posted-on"><span class="screen-reader-text">Posted on </span><time class="entry-date published" datetime="2015-08-14T03:20:35+10:00">14/08/2015</time><time class="updated" datetime="2020-06-04T08:50:09+10:00">04/06/2020</time></span> <span class="cat-links"><span class="screen-reader-text">Categories </span><a href="https://worldtravelfamily.com/category/money-to-travel/" rel="category tag">How to Get Money to Travel. How to Afford Travel</a></span> </p>
<p>
By: <span class="byline"><span class="screen-reader-text">Author </span><a class="url fn n" href="https://worldtravelfamily.com/author/travelschooling/">Alyson for World Travel Family</a></span> </p>
</div>
View sample.html
<script>
<?php if ( $google_analytics_delay ) { ?>
setTimeout(function(){
<?php } ?>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<?php echo esc_js( self::$ga_id ); ?>');
<?php if ( $google_analytics_delay ) { ?>
@jdcauley
jdcauley / sample.js
Created Mar 31, 2020
Lazy Load JS groups with IO
View sample.js
// Sample from Trellis
import { loadImages } from './helpers/lazyload'
const boot = () => {
const bodyTag = document.getElementsByTagName('body')[0];
bodyTag.className = bodyTag.className.replace(/\bmvt-no-js\b/,'mvt-js')
const insertLegacyScript = () => {
const legacyTag = document.createElement('script')
legacyTag.src = `${window.mvt.theme_directory}/assets/dist/legacy.${window.mvt.version}.js`
View data.json
{
"id": 1,
"slug": 'something-house-wives',
"title": 'Something House Wives",
// additional core meta data
"post": {
"html": "the html that would be rendered at servertime",
"editor_content": "editor version with whatever your shortcodes are"
},
"author: {
View creation.json
{
"title": "Pancakes",
"author": "Chelsea Cauley",
"yield": "16 Pancakes ",
"suitable_for_diet": null,
"thumbnail_id": "425",
"thumbnail_uri": "http://barleyandcraft.com/wp-content/uploads/2018/09/CC77BE4B-7151-4CF9-9CDC-8691D42503AB.jpeg",
"description": null,
"category": "2",
"category_name": "Breakfast",
View ui-definition.json
[
{
"id": "2442598894",
"type": "setting",
"slug": "mv_create_copyright_attribution",
"value": null,
"data": {
"type": "text",
"label": "Default Copyright Attribution",
"instructions": "If left blank, the Create Card author will be displayed."
View fletch.js
class Fletch {
constructor(props) {
this.defaults = {}
if (props.root) {
this.defaults.root = props.root
}
this.send = this.send.bind(this)
this.post = this.post.bind(this)
View custom_field.php
function api_featured_images( $post ) {
$field = get_post_meta($post['id'], 'field_id', true);
return $field;
}
add_action('rest_api_init', function() {
register_rest_field( 'post, 'field_name', array(
'get_callback' => 'your_field_function'
));
});
You can’t perform that action at this time.