トップレベルだけが取得できる。
$top_level_terms = get_terms('my_taxonomy', array(
'parent' => 0
));
$top_level_terms = get_terms('my_taxonomy', array(
'parent' => 0
));
wp_editor('', 'editor', array('editor_height'=>100));
// カスタムタクソノミー 'taxonomy_type' にセットされた値(ターム)を取得 $term = wp_get_post_terms($post->ID, 'taxonomy_type')[0]->name;
{
"key1": "value1", // これは OK
'key2': 'value2' // これは NG
}
echo '<?xml version="1.0" encoding="utf8"?>';
AllowOverride All
Theme: テーマ名 Theme URI: テーマのURL Description: テーマの説明 Author: 作者名 Version: テーマのバージョン License: テーマのライセンス License URI: ライセンス本文へのリンク Tags: テーマ検索で参照されるタグ
// if 文の書き方2通り
if(true) {
echo 'yes';
}
if(true) :
echo 'yes';
endif;
// while 文の書き方2通り
$i = 0;
while($i++ < 5) {
echo $i;
}
$i = 0;
while($i++ < 5) :
echo $i;
endwhile;
// for 文の書き方2通り
for($i = 0; $i < 5; $i++) {
echo $i;
}
for($i = 0; $i < 5; $i++) :
echo $i;
endfor;
// foreach 文の書き方2通り
$numbers = array(1, 2, 3, 4, 5);
foreach($numbers as $number) {
echo $i;
}
$numbers = array(1, 2, 3, 4, 5);
foreach($numbers as $number) {
echo $number;
}
// switch 文の書き方2通り
$i = 2;
switch($i) {
case 1:
echo '1';
break;
case 2:
echo '2';
break;
case 3:
echo '3';
break;
}
$i = 2;
switch($i) :
case 1:
echo '1';
break;
case 2:
echo '2';
break;
case 3:
echo '3';
break;
endswitch;
それぞれ { が : へmysql:ホスト名;ポート;DB名;文字コード
var result = 4.225 * 100; console.log(result); // 422.49999999999994
var result = (4.225 * 100).toFixed(1); console.log(result); // 422.5
function get_names() {
$pdo = new PDO($dsn, $config['dbuser'], $config['dbpass']);
$sth = $pdo->preapre('SELECT `name` FROM `my_table`');
if(!$sth->execute()) {
return false;
}
return $sth->fetchAll(PDO::FETCH_COLUMN);
}
get_names(); // ['tanaka', 'satou', 'suzuki', ...]
$ sudo port install php56-apache2handler
$ cd /opt/local/apache2/modules $ sudo /opt/local/apache2/bin/apxs -a -e -n php5 mod_php56.so
$ sudo apachectl restart
AddType application/x-httpd-php .php
<table class="table">
<tr>
<td>りんご</td>
<td>¥100</td>
</tr>
<tr>
<td>みかん</td>
<td>¥200</td>
</tr>
</table>
<table class="table">
<tr>
<td>りんご</td>
<td>¥100</td>
</tr>
<tr>
<td>みかん</td>
<td>¥200</td>
</tr>
</table>
SELECT MIN(`date_column`) AS first_date MAX(`date_column`) AS last_date FROM `my_table`'
$ sudo port install php56
$ sudo port select php php56
$ php -v
PHP 5.6.2 (cli) (built: Nov 7 2014 02:29:59)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
$ sudo vim /opt/local/share/mysql56/support-files/macports/my.cnf
$ sudo /opt/local/share/mysql56/support-files/mysql.server restart