Skip to content

Instantly share code, notes, and snippets.

pochi pochi-web

Block or report user

Report or block pochi-web

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pochi-web
pochi-web / search.php
Last active Nov 12, 2017
search.phpの作成
View search.php
<?php
/*
Template Name: Search Page
*/
?>
<?php get_header();?>
<body>
<header>
<div id="header_layer">
<h1>
@pochi-web
pochi-web / functions.php
Last active Nov 10, 2017
テーマで使うCSSの設定
View functions.php
<?php
//load css file
function theme_style(){
wp_enqueue_style('font-aweasome','https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css');
wp_enqueue_style('google-font','https://fonts.googleapis.com/earlyaccess/notosansjapanese.css"');
wp_enqueue_style('base',get_template_directory_uri().'/css/base.css');
wp_enqueue_style('element',get_template_directory_uri().'/css/element.css');
wp_enqueue_style('modifier',get_template_directory_uri().'/css/modifier.css');
wp_enqueue_style('style',get_stylesheet_uri(),'');
};
@pochi-web
pochi-web / post-thumbsnails.php
Last active Sep 24, 2017
アイキャッチの有効化
View post-thumbsnails.php
add_theme_support( 'post-thumbnails' );
@pochi-web
pochi-web / arvchive.php
Last active Nov 12, 2017
archive.phpを作成
View arvchive.php
<?php/*
Template Name: Archive
*/
?>
<?php get_header();?>
<body>
<?php
$categories = get_the_category();
$tags = get_the_tags();
@pochi-web
pochi-web / archive.php
Created Sep 24, 2017
カテゴリーの記事一覧を表示するテンプレートを作成
View archive.php
<?php get_header();?>
<main <?php post_class();?> >
<?php if(have_posts()):?>
<?php while(have_posts()):the_post();?>
<?php
$categories = get_the_category();
if ( !empty( $categories ) ): ?>
<?php foreach($categories as $category ):?>
<ul>
<li class="category_name">
@pochi-web
pochi-web / category-and-tags-informations.php
Last active Sep 24, 2017
カテゴリとタグ、投稿日を表示させる。
View category-and-tags-informations.php
<?php
$categories = get_the_category();
$tags = get_the_tags();
if(!empty($tags) || !empty($categories) ):?>
<?php if(!empty($categories)):
foreach($categories as $category ):?>
<ul>
<li class="category_name">
<a href="<?php echo get_category_link($category->term_id);?>">
<?php echo $category->name;?>
@pochi-web
pochi-web / password-require-message.php
Created Sep 22, 2017
パスワード保護の場合のデフォルト文章を変更
View password-require-message.php
<?php if( post_password_required( $post )){
$my_excerpt = get_the_excerpt();
if ( $my_excerpt != '' ) {
$my_excerpt = 'この記事は会員のみ閲覧可能です。';
}
echo $my_excerpt;
}else{
the_excerpt();
}
?>
@pochi-web
pochi-web / footer.php
Created Sep 21, 2017
wp_nav_menuを使って、カスタムメニューを表示&任意クラス付与
View footer.php
@pochi-web
pochi-web / header.php
Created Sep 21, 2017
カスタムメニューを読み込む
View header.php
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>some-titles</title>
<link rel="stylesheet" href="<?php echo get_template_directory_uri();?>/style.css">
<?php wp_head();?>
@pochi-web
pochi-web / functions.php
Created Sep 21, 2017
カスタムメニュー有効化
View functions.php
<?php
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'ヘッダーメニュー' ),
'footer-menu' => __( 'フッターメニュー' )
)
);
}
add_action( 'init', 'register_my_menus' );
You can’t perform that action at this time.