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 results = [ | |
{ | |
answer: "2", | |
question: "12" | |
}, | |
{ | |
answer: "1", | |
question: "13" | |
}, | |
{ |
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
export const pageQuery = graphql` | |
query($slug: String) { | |
allWordpressPost(sort: {order: ASC, fields: date}) { | |
edges { | |
node { | |
featured_media { | |
localFile { | |
childImageSharp { | |
fluid(sizes: "(min-width: 1280px) 327px, (min-width: 768px) 39vw, 81vw") { | |
src |
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( 'pre_get_posts', function( $query ) { | |
if ( ! is_admin() && is_post_type_archive( 'articles' ) ) { | |
$query->set('posts_per_page', 1); | |
} | |
} ); |
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 | |
/* | |
Template name: My custom archive page | |
*/ | |
$posts = new WP_Query( array( | |
'post_type' => 'articles', | |
'posts_per_page' => 1, | |
'paged' => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1 | |
) ); |
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> | |
<div> | |
<ul v-if="posts"> | |
<li v-for="post in posts" v-bind:key="post.id">{{ post.title }}</li> | |
</ul> | |
</div> | |
</template> | |
<script> | |
import axios from 'axios'; |
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
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js'); | |
if (workbox) { | |
const cacheName = 'my-site-cache'; | |
workbox.routing.registerRoute( | |
'/', | |
workbox.strategies.networkFirst({ | |
cacheName | |
}) |
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 | |
/** | |
* Register the custom taxonomy. | |
*/ | |
add_action( 'init', 'register_taxonomy_article_type' ); | |
function register_taxonomy_article_type() { | |
register_taxonomy( 'article_type', 'post', array( | |
'label' => 'Article type', | |
'hierarchical' => 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
<?php | |
/** | |
* Custom image sizes | |
*/ | |
add_image_size('my-custom-image-size', 768, null, false); | |
add_filter( 'image_size_names_choose', function( $sizes ) { | |
// Remove build in sizes | |
unset($sizes['thumbnail']); | |
unset($sizes['medium']); |
NewerOlder