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
import { Spinner } from '@wordpress/components'; | |
const ArticlesList = ({ articles }) => { | |
if ( ! articles ) { | |
return ( | |
<Spinner /> | |
); | |
} | |
return ( | |
<ul> |
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
import { withSelect } from '@wordpress/data'; | |
const ArticlesList = ({ articles }) => {} | |
export default withSelect( (select ) => { | |
return { | |
articles : select( 'core' ).getEntityRecords( 'postType', 'post', { per_page: 6 } ) | |
}} | |
)(ArticlesList) |
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
import { registerBlockType } from '@wordpress/blocks'; | |
import { SelectControl } from '@wordpress/components'; | |
registerBlockType( 'block-list-post-type/block-list-post-type', { | |
title: 'List Post Type', | |
category: 'layout', | |
edit: ({ attributes, setAttributes } ) => { | |
const { selected, postTypes } = attributes; | |
return ( | |
<div> |
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 block_list_post_type_register_block() { | |
wp_register_script( | |
'block_list_post_type_scripts', | |
plugins_url( 'build/index.js', __FILE__ ), | |
array("wp-blocks","wp-components","wp-data","wp-element","wp-polyfill"), | |
filemtime( plugin_dir_path( __FILE__ ) . 'build/index.js') | |
); | |
$args = array( |
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
//... | |
"name": "@frontity/wp-source", | |
"state": { | |
"source": { | |
"api": "https://public-api.wordpress.com/wp/v2/sites/goiblas.wordpress.com" | |
} | |
} | |
//... |
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
{ | |
"alias": "blog-name", | |
"version": 2, | |
"builds": [ | |
{ | |
"src": "package.json", | |
"use": "@frontity/now" | |
} | |
] | |
} |
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
import React from "react"; | |
import { connect } from "frontity"; | |
import Disqus from 'disqus-react'; | |
const Comments = ({ state }) => { | |
const data = state.source.get(state.router.link); | |
const post = state.source[data.type][data.id]; | |
const disqusShortname = “blog-name”; |
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
import React from "react"; | |
import { connect, styled } from "frontity"; | |
const Toggle = ({ actions, state }) => { | |
const { setLightMode, setDarkMode } = actions.theme; | |
const { mode } = state.theme; | |
return ( | |
<Container> | |
<ButtonsStyled isSelected={ mode === 'light' } onClick={ setLightMode }>Light</ButtonsStyled> | |
<ButtonsStyled isSelected={ mode === 'dark' } onClick={ setDarkMode }>Dark</ButtonsStyled> |
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
//... | |
const Toggle = ({ actions }) => { | |
const { setLightMode, setDarkMode } = actions.theme; | |
return ( | |
<div> | |
<button onClick={ setLightMode }>Light</button> | |
<button onClick={ setDarkMode }>Dark</button> | |
</div> | |
) |
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
const Theme = ({ state }) => { | |
const data = state.source.get(state.router.link); | |
const { mode } = state.theme; | |
return ( | |
<> | |
<Head> | |
<title>{state.frontity.title}</title> | |
<meta name="description" content={state.frontity.description} /> | |
<html lang="en" /> |