サイドバーのまとめ

//サイドバー
register_sidebars(5, array('before_widget' => '<div>',
	'after_widget' => '</div>'));

ファンクションに書く

<?php $args = array(
	'name'          => sprintf(__('Sidebar %d'), $i ),
	'id'            => 'sidebar-$i',
	'description'   => ''
	'before_widget' => '<li id="%1$s" class="widget %2$s">',
	'after_widget'  => '</li>',
	'before_title'  => '<h2 class="widgettitle">',
	'after_title'   => '</h2>' ); ?>

デフォルトが上

スパンクラスで文章の最後に注目をつける時の 下へずれないCSS

<span class="now">今だけ!3,000円 9月末まで</span>
.now{
	font-size: 12px;
	color: #FFF;
	background-color: #F00;
	line-height: 22px;
	display: inline-block;
	position: absolute;
	padding-top: 2px;
	padding-right: 10px;
	padding-bottom: 2px;
	padding-left: 10px;
	margin-top: 2px;
}

ポイントは
display: inline-block;
position: absolute;
margin-top: 2px;
こうすると上から表示されマージンが効くので調整

プラグイン相性

jquery.page-scroller.js

WP jQuery Lightbox 駄目

jquery.page-scroller.jsバージョンアップ
d-mark3

 <!--wpjライトボックス用rel-->
<a rel="lightbox[roadtrip]" href="
<?php //イメージFULL URLを取得
$attachment_id = $field['jirei_gazou_sab'];
$sample_photo = wp_get_attachment_image_src($attachment_id, "full");
print $sample_photo[0]; 
?>
">

抜粋 the_excerpt の[…] を変える


//echo mb_substr(get_the_excerpt(),0, 240);の...を変える
function new_excerpt_more($more) {
	return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');



//抜粋文字数指定 マルチバイトパッチ必要
function change_excerpt_mblength($length) {
return 111;
}
add_filter('excerpt_mblength', 'change_excerpt_mblength');



unction.phpに以下のコードを追加しますと、「続きを読む」などのリンクに変更

function new_excerpt_more($post) {
    return '<a href="'. get_permalink($post->ID) . '">' . '...続きを読む' . '</a>';    
}    
add_filter('excerpt_more', 'new_excerpt_more');


オリジナル
//抜粋カスタマイズ
function new_excerpt_more($post) {
    return '...<div class="blog_more"><a href="'. get_permalink($post->ID) . '">' . '続きを読む▶▶' . '</a></div>';    
}    
add_filter('excerpt_more', 'new_excerpt_more');

自社紹介のみ様をとる

タクソノミー
1.
<?php
echo $term->name; ?><?php if(is_tax('client') and !is_tax('client','d-marking-design')): echo ' 様';  endif; ?>
 制作実績

2.
<?php if(is_tax('client','d-marking-design')):  ?>
<?php elseif(is_tax('client') and !is_tax('client','d-marking-design')):  //ここのandはなくてもよい?>
<div style="margin-top:15px; text-align:center; font-size:15px;"><i class="icon-coffee"></i>
クライアント様のご紹介</div>

<?php else: ?>
<div style="margin-top:15px; text-align:center; font-size:15px;"><i class="icon-coffee"></i>
ご紹介できる制作物の一部をご紹介いたします。</div>
 <?php endif; ?> 


シングル

<div class="jirei_disp_title">クライアント名:</div><div class="jirei_disp_con"><?php echo get_the_term_list($post->ID, 'client'); ?> <?php if(! is_object_in_term($post->ID, 'client','76') ): echo '様'; endif;?></div>

マックの調子

現象
・マウスの調子がおかしい
・突然クラッシュする
・外付けhddがおかしい

考えられる項目
・外付けssd起動だから?
・外付けSSDがUSB3.0のバスパワーで電源を食ってるから
隣のUSBハブ(本体)に影響を及ぼしている?
・SSD自体が壊れそう?
・マックがおかしい?
・マウスがおかしい?

結果
・メモリが1つおかしかった。
起動時Dを押す ハードウエアテスト(システム診断)をやってくれる
そのときにメモリエラー WEBでわかった
【4MEM/9/40000000~】というエラー

1つメモリ シリコンパワーの永久保証 で着払いで交換送付

・USB3.0ハブがおかしかった
前科もので最近接続が不安定で交換してもらったのに
そいつに差してたから外付けHDDがおかしかった

直指しで対応 返品対応してくれた。

・マウスの問題が1番苦労した。
結果imacの背面に直差ししてはいけない事が判明。
分厚いマウスパッドから外すと上手く動いたり、
不安定・不規則につっかえる感じになっていた。
もしやと思い古いusb2.0ハブを出して全面に出したら
スムーズに動いた。

■その他やった項目

☆起動時コマンドオプションPRで解放
起動ディスク戻る

☆起動時シフトでセーフモード
これでディスク修復も出来るらしいよ

☆アクセス権の修復
ホスター使えなくなる
ssd/etc/hostsのパミーションeveryoneを読み/書きに 757?

☆ディスク検証

☆メモリテストRember
問題無し

☆ssdテスト
外付け対応S.M.A.R.T. for USB and FireWire Drives
SATSMARTDriver-0.9-Debug.dmg

SMARTReporter
SSDテスト健康診断

速度チェック
Blackmagic Disk Speed Test

TOPフラッグマニュアル

<?php
$now_year = date("Y"); // 現在の年を取得
$now_month = date("n"); // 在の月を取得
$now_day = date("j"); // 現在の日を取得
// 曜日の配列作成
$weekday = array( "日", "月", "火", "水", "木", "金", "土" );
// 1日の曜日を数値で取得
$fir_weekday = date( "w", mktime( 0, 0, 0, $now_month, 1, $now_year ) );
 
echo '<table border="1" cellspacing="0" cellpadding="0" style="text-align:center;">';
// 見出し部分<caption>タグ出力
echo "<caption style=\"color:black; font-size:14px; padding:0px;\">"
 .$now_year."年".$now_month."月のカレンダー
 </caption>\n";
 
echo "<tr>\n";
 
// 曜日セル<th>タグ設定
$i = 0; // カウント値リセット
while( $i <= 6 ){ // 曜日分ループ
 
//-------------スタイルシート設定---------------------------------
    if( $i == 0 ){ // 日曜日の文字色
        $style = "#C30";
    }
    else if( $i == 6 ){ // 土曜日の文字色
        $style = "#03C";
    }
    else{ // 月曜~金曜日の文字色
        $style = "black";
    }
//-------------スタイルシート設定終わり---------------------------
 
    // <th>タグにスタイルシートを挿入して出力
    echo "\t<th style=\"color:".$style."\">".$weekday[$i]."</th>\n";
    $i ++; //カウント値+1
}
 
// 行の変更
echo "</tr>\n";
echo "<tr>\n";
 
$i = 0; //カウント値リセット(曜日カウンター)
while( $i != $fir_weekday ){ //1日の曜日まで空白(&nbsp;)で埋める
    echo "\t<td>&nbsp;</td>\n";
    $i ++;
}
 
// 今月の日付が存在している間ループする
for( $day=1; checkdate( $now_month, $day, $now_year ); $day++ ){
 
    //曜日の最後まできたらカウント値(曜日カウンター)を戻して行を変える
    if( $i > 6 ){
        $i = 0;
        echo "</tr>\n";
        echo "<tr>\n";
    }
 
//-------------スタイルシート設定-----------------------------------
    if( $i == 0 ){ //日曜日の文字色
        $style = "#C30";
    }
    else if( $i == 6 ){ //土曜日の文字色
        $style = "#03C";
    }
    else{ //月曜~金曜日の文字色
        $style = "black";
    }
 
    // 今日の日付の場合、背景色追加
    if( $day == $now_day ){
        $style = $style."; background:silver";
    }
//-------------スタイルシート設定終わり-----------------------------
 
    // 日付セル作成とスタイルシートの挿入
    echo "\t<td style=\"color:".$style.";\">".$day."</td>\n";
 
    $i++; //カウント値(曜日カウンター)+1
}
 
while( $i < 7 ){ //残りの曜日分空白(&nbsp;)で埋める
    echo "\t<td>&nbsp;</td>\n";
    $i++;
}
echo "</tr>\n";
echo "</table>\n";
?>

カレンダーサンプルベース
http://php-beginner.com/sample/date_time/calendar2.html

test.php内の月に月を入れて
ソースで日にちの部分からtrまでコピーして貼って
後は木曜とか入れる

ロールオーバー画像js

<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script><script type="text/javascript" src="js/jquery.multirollover.js"></script>

<script type="text/javascript">// <![CDATA[
	$(document).ready(function() {
		$('#head_rogo a').multirollover({
			crossfade	: true,
			suffix		: '_on',
			duration	: 300,

		});
	});
// ]]></script>

もしくはaタグにクラスをつける。

</pre>
<div class="clearfix"><a href="<?php echo home_url(); ?>"><img class="hover" style="padding-top: 5px; padding-bottom: 15px;" alt="愛知県春日井市のホームページ制作|D-Marking Design|格安デザインサンプル" src="img/rogo.png" /></a></div>
<pre>

配置画像はそのままの名前 ホバー画像は_onをつける。

DL先
http://blog.three-co.jp/web/849/

multirollover-master

topフラッグ移行時 トランスミット・googleドライブ・MAMPでCGI/Perl

トランスミットでローカルのパーミッション

googleドライブは インストして 名前を変えて バーからエラーをクリック フォルダを探すで再設定

MAMPでCGIは
/Application/MAMP/conf/apache/httpd.conf 453行目ぐらいにある以下の部分を修正する。

#AddHandler cgi-script .cgi
コメントアウト(#)を削除し、.plも動作するように追加する。

AddHandler cgi-script .cgi .pl
編集したhttpd.confを保存してMAMPを再起動してください。

テストCGIの作成とパーミッションの変更
以下のような簡単なCGIを用意してtest.cgiとしてフォルダーに入れました。
test.cgiを保存する際には、必ず改行コードを LF としてください。

#!/usr/bin/perl
print “Content-type: text/html \n\n”;
print “Hello CGI”;

パーミッション
ターミンナル

$ cd /Users/TanakaKimi/Web/
$ chmod 755 test.cgi

トランスミット
右クリック 情報を見るから755

CGI(perl)を /usr/local/bin/perl でも動くようにする

最初に隠しフォルダを表示して
hd user local にbinを作る

Mac OSXのPerl のパスは [/usr/bin/perl] ですが、
一般的なサーバは [/usr/local/bin/perl] だと思います。
そのままだとローカル環境でテストしたCGIを設置サーバにアップするときにPerlのパスを書き換えなければいけません。
そこで [/usr/bin/perl] に加えて [/usr/local/bin/perl] でも動くように設定します。

 

まず [/usr/local/] ディレクトリには [bin] ディレクトリがありませんので、ターミナルで [/usr/local/bin] ディレクトリを作成し、その中にPerlのシンボリックリンク(エイリアス)を作ります。

アプリケーション > ユーティリティ > ターミナルを起動。
以下を入力してください。
※以下のコード部分に含まれる「$」はコマンド入力していることを表していますので、実際には入力しないでください。

$ sudo ln -s /usr/bin/perl /usr/local/bin/perl
これで、MacOS X でも一般的な [/usr/local/bin/perl] で、CGIが動作するようになります。

サクラのCGIは
/usr/bin/perl

777のフォルダの下でも
動くと思っていたけれど、
実は777ではCGIは動かなくて、
705や755にしないと動かない

ファイルパーミッション 755 または 705 のいずれか
ディレクトリパーミッション 755 または 705 のいずれか

 

メモ ポストメールcgi

cgiへ受け渡すhtmlのurlが絶対パスでは

サクラでは駄目だった。

相対パスで受け渡せた。

css htmlだけで作るメインメニュー

普通にコード書く


<!--メインナビ-->
<div class="d_navi_main_all">
  <div class="d_navi_main_width">
    <div class="d_navi_main_in">
    
   <ul> 
   





<li><a href="<?php echo home_url(); ?><?php include("link5.php") ?>"><i class="icon-home-2 test_icon"></i>HOME</a></li>




<li><a href="<?php echo home_url(); ?>?page_id=4"><i class="icon-cog test_icon"></i>ご利用ガイド</a></li>


<li><a href="<?php echo home_url(); ?>?page_id=14"><i class="icon-star test_icon"></i>制作実績</a></li>


<li><a href="<?php echo home_url(); ?>?page_id=157"><i class="icon-cog test_icon"></i>制作料金</a></li>


<li><a href="<?php echo home_url(); ?>?page_id=409"><i class="icon-edit-alt test_icon"></i>BLOG</a></li>


<li><a href="<?php echo home_url(); ?>?page_id=9"><i class="icon-mail-alt test_icon"></i>お問い合わせ</a></li>



  </ul>
  

  
    </div class="d_navi_main_in">
  </div class="d_navi_main_width">
</div class="d_navi_main_all">
<!--/メインナビ-->  

css

ポイントは 線があり そして ホバー時に背景が色着いて 線も違和感がない

/*メインメニュー*/


.d_navi_main_in ul {
	list-style-type: none;
	overflow: hidden;
	margin: 0px;
	padding-top: 0px;
	padding-right: 0px;
	padding-bottom: 0px;
	padding-left: 0px;
	font-size: 16px;
}

.d_navi_main_in ul li  {
	list-style-type: none;
	display: block;
	float: left;
	width: 16%;
	padding-top: 10px;
	padding-bottom: 10px;
	vertical-align: bottom;
	}

.d_navi_main_in ul li a {
	padding-top: 5px;
	padding-bottom: 5px;
	border-right-width: 1px;
	border-right-style: dotted;
	border-right-color: #CCC;
	box-sizing: border-box;
	text-align: center;
	display: block;
	width: 100%;
	font-size: 15px;
	text-indent: -10px;
}
.d_navi_main_in ul li:nth-last-of-type(1)  a{
	border-right-style: none;
}


/*リストホバー時リストの消したパディングを付加する*/
.d_navi_main_in ul li:hover a{
	display: block;
	color: #FFFFFF;
	text-decoration: none;
	padding-top: 15px;
	padding-bottom: 15px;
}

/*リストホバー時パディングを無くす*/
.d_navi_main_in ul li:hover {
padding-top: 0px;
	padding-bottom: 0px;	
}


/*点線消し含む*/
.d_navi_main_in ul li:hover{
	display: block;
	color: #00AF86;
	text-decoration: none;
	background-color: #00AF86;
	border-left-width: 1px;
	border-left-style: solid;
	border-left-color: #FFF;
	margin-left: -1px;
}

シングルでターム名を出力 ただし親のカテゴリを選ばずに分類していく場合に 親の名前も取得する

ループ内で
親で分岐と同じコードを使い表示

<h2><div class="title1">
<?php //シングルでターム名を全部取得表示
if ($terms = get_the_terms($post->ID, 'cate_jirei')) {
    foreach ( $terms as $term ) {
        echo esc_html($term->name);
    }
}
?>

<?php  //シングルDDD分岐 $term_p に タームの親のたーむIDが入る 2つのコードで使用

//ループでホームページカテゴリか分岐
//これは親を選択せずに小カテゴリのみ選択していった場合にも有効な親のIDで分岐する方法 但し、複数の親の子は未対応

 //& 親を選択しないカテゴリの場合の親情報を取得 これはすぐしたのコード

//ループ内でタームの親で分岐準備 逆さになる場合があるから下記分岐  
$term = array_pop(get_the_terms($post->ID, 'cate_jirei')); //array_popで配列の最後を取り出す
$term_p = $term->parent; //子か確かめる準備

if ( $term_p == 0 ) //取り出したのが親の場合
{
$term = array_shift(get_the_terms($post->ID,'cate_jirei')); //array_shiftで先頭にある配列を取り出す
}

$term_p = $term->parent; //親のID取得

?>



<?php //ここからシングルのタイトル用のコード

$ddterm = get_term($term_p , 'cate_jirei'); //


echo $ddterm->name;



?>





 実績
</div></h2>

親タームで分岐1

タクソノミー

<?php 
//タクソノミーで親のタームIDで分岐
//カテゴリー・タグ情報を取得(slug,アーカイブページでターム名取得,タクソノミー名取得)
$term = get_term_by('slug',get_query_var( 'term' ),get_query_var( 'taxonomy' )
);
?>
<?php //$termにはいってる情報で分岐
if ( $term->parent ) { // 親IDが入ってれば (子だったら)
?>

<!---TOP部分-->
<?php //親のIDを取得してターム情報を引き出す。
$ido=$term->parent;
}?>




  <?php //タームで分岐デザインフォーマット
  
  if ($ido == 2):
 if (is_object_in_term($post->ID, 'hp_cate','フォーマットデザイン')): ?>
  
  <div class="original original2 ">フォーマット</div>
   <?php else: ?> 
<div class="original">オリジナルデザイン</div>
  <?php endif; ?>
  
    <?php endif; ?>


シングル等ループ内


<?php 
//ループでホームページカテゴリか分岐
//これは親を選択せずに小カテゴリのみ選択していった場合にも有効な親のIDで分岐する方法 但し、複数の親の子は未対応

//ループ内でタームの親で分岐準備 逆さになる場合があるから下記分岐  
$term = array_pop(get_the_terms($post->ID, 'cate_jirei')); //array_popで配列の最後を取り出す
$term_p = $term->parent; //子か確かめる準備

if ( $term_p == 0 ) //取り出したのが親の場合
{
$term = array_shift(get_the_terms($post->ID,'cate_jirei')); //array_shiftで先頭にある配列を取り出す
}

$term_p = $term->parent; //親のID取得

if($term_p == 2):

?>

  <?php //タームで分岐デザインフォーマット
 if (is_object_in_term($post->ID, 'hp_cate','フォーマットデザイン')): ?>
  
  <div class="original original2 d_original">フォーマット</div>
   <?php else: ?> 
<div class="original d_original">オリジナルデザイン</div>
  <?php endif; ?>
    <?php endif; 
	//ホームページ分岐終わり?>

上記ベースコード

http://liginc.co.jp/designer/archives/4348

親カテゴリ 分岐 

※なんかうまくいかなかった

ファンクションへ
タクソノミーだけなら下の部分だけでOK

/* For categories */
if ( ! function_exists( 'post_is_in_descendant_category' ) ) :
function post_is_in_descendant_category( $cats, $_post = null ) {
  foreach ( (array) $cats as $cat ) {
		// get_term_children() accepts integer ID only
		$descendants = get_term_children( (int) $cat, 'category' );
		if ( $descendants && in_category( $descendants, $_post ) )
			return true;
	}
	return false;
}
function post_is_in_category_slug($slug){
	global $post;
	$post_id = ( isset($post->ID) ) ? $post->ID : '';
	if ( in_category( $slug, $post_id ) || post_is_in_descendant_category( get_term_by('slug',$slug,'category'), $post_id ) ){
		return true;
	} else {
		return false;
	}
}
endif; //function_exists 'post_is_in_descendant_category'
 
 
/* For taxonomies */
if ( ! function_exists( 'post_is_in_descendant_taxonomy' ) ) :
function post_is_in_descendant_taxonomy( $terms, $taxonomy, $_post = null ) {
	foreach ( (array) $terms as $term ) {
		// get_term_children() accepts integer ID only
		$descendants = get_term_children( (int) $term, $taxonomy );
		if ( $descendants && has_term( $descendants, $taxonomy, $_post ) )
			return true;
	}
	return false;
}
function post_is_in_taxonomy_slug($slug, $taxonomy){
	global $post;
	$post_id = ( isset($post->ID) ) ? $post->ID : '';
	if ( has_term( $slug, $taxonomy, $post_id ) || post_is_in_descendant_taxonomy( get_term_by('slug',$slug,$taxonomy), $taxonomy, $post_id ) ){
		return true;
	} else {
		return false;
	}
}
endif; //function_exists 'post_is_in_descendant_taxonomy'
//宅
if ( post_is_in_taxonomy_slug('Cat-A', カスタムタクソノミー名) )
//具体例
<?php
  if (post_is_in_taxonomy_slug('ホームページ制作', cate_jirei) ):
?>
<?php endif; ?>

//カテ

if ( post_is_in_category_slug('Cat-A')

Custom Field Suite で フルのurl付 これは回りくどいか?

 <!--シンプルライトボックス用rel-->
<a rel="slb slb_group[111111]" href="
<?php //イメージFULL URLを取得
$d_url = wp_get_attachment_image_src(get_post_meta($post->ID,"jirei_gazou",true),full);
echo $d_url[0];
?>
">
<?php
$title= get_the_title();
echo wp_get_attachment_image(get_post_meta($post->ID,"jirei_gazou",true),array(330,500),array('alt'=>$title,'title'=>$title)); ?>

</a>

タームで分岐

  <?php if (is_object_in_term($post->ID, 'rental_set','郵送レンタル')): ?>
   <?php else: ?> 
<img src="img/3free.png" alt="音響スタッフ付き/機材運搬100kmまで無料/機材設置料無料" width="373" height="22">
  <?php endif; ?> 

サブミットボタン submitボタン css

認証にしてdisabledがついた場合のcssも指定

input[type='submit']{
	border: 1px solid #777;
	padding: 4px 10px;
	color: #fff;
	cursor: pointer;
	background: #428ec9;
	border-radius: 5px;
	/* Webkit */
	background: -webkit-gradient(
        linear,
        left top,
        left bottom,
        from(#99c9e5),
        to(#428ec9)
        );
	-webkit-border-radius: 5px;
	-webkit-box-shadow: 1px 1px 1px #fff;
	/* Firefox */
	background: -moz-linear-gradient(
        top,
        #99c9e5,
        #428ec9
        );
	-moz-border-radius: 5px;
	-moz-box-shadow: 1px 1px 1px #fff;
     
/* IE */
    filter:progid:DXImageTransform.Microsoft.gradient
        (startColorstr=#ff99c9e5,endColorstr=#ff428ec9);
	zoom: 1;
	
	font-size: 16px;
}
/* 認証式にした場合 */
input[type='submit'][disabled]{
opacity:0.7;
filter: alpha(opacity=70);        /* ie lt 8 */
-ms-filter: "alpha(opacity=70)";  /* ie 8 */
-moz-opacity:0.7;                 /* FF lt 1.5, Netscape */
-khtml-opacity: 0.7; 
cursor: default;     
	}