AWSにものすごい勢いでWPを自前で、地味に立てる
- Amazon Linux
- t2.micro
- 確認と作成
- セキュリティーグループの編集
- http 80
- ssh 22
| <?php | |
| /** | |
| * コメント機能の無効化 | |
| * | |
| * @package MHICustom | |
| */ | |
| add_action( | |
| 'admin_init', | |
| function () { |
| /** | |
| * 限定的にパーマリンクを修正する | |
| * | |
| * @param string $url httpsなどを含むフルのURL. | |
| * @param object $post 記事のオブジェクト. | |
| * @return string | |
| */ | |
| function custom_posttype_permalink( $url, $post ) { | |
| if ( is_wp_error( $post ) ) { | |
| return $post; |
| <!DOCTYPE html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <!-- サイト全体のヘッダー --> | |
| <header> | |
| <!-- サイトのロゴ --> |
| <?php | |
| // ユーザエージェント判別用 | |
| class UserAgent { | |
| private $ua; | |
| private $device; | |
| public function set(){ | |
| $this->ua = mb_strtolower($_SERVER['HTTP_USER_AGENT']); | |
| if(strpos($this->ua,'iphone') !== false){ | |
| $this->device = 'mobile'; | |
| }elseif(strpos($this->ua,'ipod') !== false){ |
| <ul> | |
| <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
| <li> | |
| <?php the_time('Y年m月d日'); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> | |
| </li> | |
| <?php endwhile; else : ?> | |
| <li>投稿が見つかりません。</li> | |
| <?php endif; ?> |
| <ul> | |
| <?php | |
| $args = array( 'posts_per_page' => 5, 'offset'=> 1, 'category' => 1 ); | |
| $myposts = get_posts( $args ); | |
| foreach ( $myposts as $post ) : setup_postdata( $post ); ?> | |
| <li> | |
| <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> |
| $ wp cli version | |
| WP-CLI 0.24.1 |
| http://qiita.com/carotene512/items/e00076fe3990b9178cc0 | |
| http://qiita.com/mogetarou/items/e34ca51d3756d55d7800 |
| # .bashrc | |
| # Source global definitions | |
| if [ -f /etc/bashrc ]; then | |
| . /etc/bashrc | |
| fi | |
| # User specific aliases and functions | |
| #!/usr/bin/env bash |