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_action('wp_head', function() { | |
$paged = get_query_var('paged'); | |
}); |
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_action( 'wp_head', function() { | |
if(!(is_single() || is_page())){ | |
return; | |
} | |
$value = get_post_meta(get_the_ID(), 'is_noindex', true ); | |
if(!((int)$value)) { | |
return; | |
} | |
wp_no_robots(); |
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
function addPrefixToName(WrappedComponent, prefix) { | |
return class extends WrappedComponent { | |
render() { | |
const wrappedTree = super.render() | |
let newProps = {} | |
if (wrappedTree && wrappedTree.type === 'input') { | |
newProps = {name: `${prefix}-${wrappedTree.props.name}`} | |
} | |
const props = { ...wrappedTree.props, ...newProps } // Object.assign({}, wrappedTree.props, newProps) と同様 | |
const newTree = React.cloneElement(wrappedTree, props, wrappedTree.props.children) |
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
function showMessageWhenDataIsEmpty(WrappedComponent) { | |
return class extends WrappedComponent { | |
render() { | |
if (this.props.data.length > 0) { // データが存在するときだけ表示 | |
return super.render() | |
} | |
else { | |
return <span>データが存在しません!</span> | |
} | |
} |
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
function withSubscription(WrappedComponent, selectData) { | |
return class extends WrappedComponent { | |
constructor(props) { | |
super(props) | |
this.handleChange = this.handleChange.bind(this) | |
this.state = { | |
data: selectData(DataSource, props) | |
} | |
} | |
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
function withSubscription(WrappedComponent, selectData) { | |
return class extends React.Component { | |
constructor(props) { | |
super(props) | |
this.handleChange = this.handleChange.bind(this) | |
this.state = { | |
data: selectData(DataSource, props) | |
} | |
} | |
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
function withSubscription(WrappedComponent, selectData) { | |
return class extends React.Component { | |
constructor(props) { | |
super(props) | |
this.handleChange = this.handleChange.bind(this) | |
this.state = { | |
data: selectData(DataSource, props) | |
} | |
} | |
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 Card = ({ card }) => ( | |
<div className="card"> | |
<div className="card-content" style={{ color: card.color }}> | |
{card.name} | |
</div> | |
</div> | |
) | |
class List extends React.Component { | |
constructor(props) { |
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
<IfModule mod_rewrite.c> | |
### WordPress 用 #### | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^index\.php$ - [L] | |
##################### |
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
<IfModule mod_rewrite.c> | |
### WordPress 用 #### | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^index\.php$ - [L] | |
##################### |
NewerOlder