<meta http-equiv="X-UA-Compatible" content="IE=9"> こいつを <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="X-UA-Compatible" content="IE=9">
カテゴリー: Code コード
sakura wwwありなし
①www有り
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yyy\.com
RewriteRule (.*) http://www.yyy.com/$1 [R=301,L]
(最後は空白行)
②www無し
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yyy\.com
RewriteRule (.*) http://yyy.com/$1 [R=301,L]
(最後は空白行)
③index有り
RewriteEngine on
RewriteRule ^$ /index.html [R=301]
(最後は空白行)
④index無し
RewriteEngine on
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ /$1 [R=301,L]
(最後は空白行)
初期ドメインリダイレクト
Redirect /zback1/sugaryawd/ “http://sugaryawd.com/”
ダブルパンチ例
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.2youngc\.com
RewriteRule (.*) http://2youngc.com/$1 [R=301,L]
RewriteEngine on
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ /$1 [R=301,L]
ダブルパンチ例
トリプルパンチ
Redirect /zback1/sugaryawd/ “http://sugaryawd.com/”
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.sugaryawd\.com
RewriteRule (.*) http://sugaryawd.com/$1 [R=301,L]
RewriteEngine on
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ /$1 [R=301,L]
index.php含み
Redirect /zback2/mirto/ “http://http://www.mirto.jp/”
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mirto\.jp
RewriteRule (.*) http://www.mirto.jp/$1 [R=301,L]
RewriteEngine on
RewriteCond %{THE_REQUEST} ^.*/index.(html|php)
RewriteRule ^(.*)index.(html|php)$ /$1 [R=301,L]
必殺文字画像高さ合わせ
<div class="menu_cate"><img src="img/food_menu/menu_cate-01.png" width="90" height="36" alt="一宮、和食、御膳料理" /></div>
.menu_cate{
padding-top: 30px;
padding-bottom: 30px;
vertical-align: top;
line-height: 36px;
}
画像の高さにラインハイト
バーティカルトップ
画像カレントjs スプリットも使い まずカレントクラスをつける
<!--画像カレントホバー-->
<!--スプリットURL-->
<script type="text/javascript">
$(function(){
var url = window.location.pathname;
var url = url.split("/")[1];
$('.food_menu li a[href="'+url+'"]').parent().addClass('current');
});
</script>
<!--画像カレントホバー-->
<script type="text/javascript" >
$(function(){
$(".food_menu li:not(.chill):not(.current)").each(function(){
var a = $(this);
var img = a.find("img");
var src_off = img.attr("src");
var src_on = src_off.replace(/^(.+)_off(\.[^\.]+)$/,"$1_on$2");
$("<img />").attr("src",src_on);
a.bind("mouseenter focus", function(){
img.attr("src", src_on);
});
a.bind("mouseleave blur", function(){
img.attr("src", src_off);
});
});
});
//current表示
$(function() {
if ($('.food_menu li').hasClass('current')) {
$(".food_menu li.current img").attr("src",$(".food_menu li.current img").attr("src").replace(/^(.+)_off(\.[^\.]+)$/,"$1_current$2"));
}
});
</script>
中の事 オープン前にやること
1. 内部ALT
2.h&Pマークアップ(h1タグ変動かどうか)
3.タイトルタグ
4.ディスプリクションキーワード
5.facebook ogp アプリID
6.アナティリスク&WEBマスター
表示順を変える カテゴリ インデックス などのアーカイブ
add_action( 'pre_get_posts', 'foo_modify_query_post_order' );
function foo_modify_query_post_order( $query ) {
if ( $query->is_tax('genre') && $query->is_main_query() ) {
$query->set( 'orderby', 'menu_order' );
$query->set( 'order', 'DESC' );
}
}
add_action( 'pre_get_posts', 'foo_modify_query_post_order2' );
function foo_modify_query_post_order2( $query ) {
if ( $query->is_tax('test') && $query->is_main_query() ) {
$query->set( 'orderby', 'menu_order' );
$query->set( 'order', 'DESC' );
}
}
参考http://gatespace.jp/2012/09/10/modify_main_queries/
<?php
/**
* pre_get_posts を使ってメインクエリーを書き換える
* http://notnil-creative.com/blog/archives/1996
*/
add_action( 'pre_get_posts', 'foo_modify_main_query' ); // pre_get_postsにフック
// フック時に使う関数
function foo_modify_main_query( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( $query->is_home() ) { // ホーム
$query->set( 'post_type', array( 'post', 'news' ) ); // 投稿とカスタム投稿タイプ news を含める
return;
}
if ( $query->is_month() ) { // 月別アーカイブ
$query->set( 'posts_per_page', -1 ); // すべて表示
return;
}
if ( $query->is_category() ) { // カテゴリーアーカイブ
$query->set( 'posts_per_page', 10 ); // 10件ずつ表示
return;
}
}
管理画面まとめ
サムネイル画像リサイズ
regenerate-thumbnails
http://www.memo.d-marking.com/?p=779
TinyMCE Advanced
TypePad emoji for TinyMCE
(シンプルライトボックスと被るので別の
wp-jquery-lightbox
を使う
古いバージョンならOK)
PS Disable Auto Formatting
開発時
Duplicate Post
記事コピー
春日井ナビのTOPで使った動き解説
http://www.webopixel.net/javascript/507.html
画像 カレントホバー 特殊 リンク無し ドロップ用 :not重ね掛け
<!--画像カレントホバー-->
<script type="text/javascript" >
$(function(){
$(".d_navi_main_in li:not(.chill):not(.current)").each(function(){ //ここ大事
var a = $(this);
var img = a.find("img");
var src_off = img.attr("src");
var src_on = src_off.replace(/^(.+)_off(\.[^\.]+)$/,"$1_on$2");
$("<img />").attr("src",src_on);
a.bind("mouseenter focus", function(){
img.attr("src", src_on);
});
a.bind("mouseleave blur", function(){
img.attr("src", src_off);
});
});
});
//current表示
$(function() {
if ($('.d_navi_main_in li').hasClass('current')) {
$(".d_navi_main_in li.current img").attr("src",$(".d_navi_main_in li.current img").attr("src").replace(/^(.+)_off(\.[^\.]+)$/,"$1_current$2"));//ここ大事
}
});
</script>
ドロップダウン 自作
まず普通に 出てる状態を作り
消して
ホバーで見せる
hidden 0がポイント
参考
http://weboook.blog22.fc2.com/blog-entry-359.html
<li class="line"><img src="img/menu/line.png" width="1" height="29" /></li> <li><img src="img/menu/menu-04_off.jpg" width="127" height="61" /> ここから <ul class="drop_down"> <li class="chill"><a href="<?php echo home_url(); ?>/?page_id=34">尾張旭店</a></li> <li class="chill"><a href="<?php echo home_url(); ?>/?page_id=37">日進店</a></li> </ul> ここまで </li> <li class="line"><img src="img/menu/line.png" width="1" height="29" /></li>
.drop_down{
z-index: 10000;
overflow: visible!important;
position: absolute;
width: 127px;
}
.drop_down li{
width: 100%;
background-color: #24AC66;
/*ここで隠し*/
height: 0px!important;
overflow:hidden!important;
/*/ここで隠し*/
}
/*ここでみせる*/
.d_navi_main_in ul li:hover .drop_down li{
height: auto!important;
overflow: visible!important;
}
/*/ここでみせる*/
.drop_down li a{
color: #FFF;
background-color: #2CB370;
text-align: center;
width: 100%;
display: block;
padding-top: 10px;
padding-bottom: 10px;
}
.drop_down li a:hover{
/*background-color: #ff8e00;*/
text-decoration: none;
background-color: #74491C;
}
タブメニュー自作 コード css
マイナスマージンが決め手
オーバーフロー hidenも注意 使わない
<!------------------タブ店舗全ページ----------------------------------> <ul class="tab_menu"> <li><a href="<?php echo home_url(); ?>/?page_id=34" class="current">尾張旭店</a></li> <li><a href="<?php echo home_url(); ?>/?page_id=37">日進店</a></li> <div style="clear:both"></div> </ul> <!------------------/タブ店舗全ページ---------------------------------->
/*タブ*/
.tab_menu{
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #CCC;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 10px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 30px;
margin-left: 0px;
}
.tab_menu li{
float: left;
list-style-type: none;
margin-bottom: -1px;
margin-left: -1px;
}
.tab_menu li a{
display: block;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #CCC;
border-right-color: #CCC;
border-bottom-color: #CCC;
border-left-color: #CCC;
padding-top: 5px;
padding-right: 25px;
padding-bottom: 5px;
padding-left: 25px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
}
.tab_menu li a:hover{
color: #FFF;
background-color: #00A550;
text-decoration: none;
}
.tab_menu li a.current{
background-color: #6a3906;
color: #FFF;
border-bottom-color: #FFF;
}
googlemap 吹き出し消す
&iwloc=B
タイトル文字制限
<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php
if(mb_strlen($post->post_title)>20) { $title= mb_substr($post->post_title,0,20) ; echo $title. ・・・ ;
} else {echo $post->post_title;}?></a>
カテゴリ複数
クエリポスト
'cat=2,6,17,38' 'category__in' => array( 2, 6 )
曜日
l で日曜日 とかでる
fanction php まとめ
//サムネイルサイズ増やす trueが強制切り抜き
add_image_size( 'jirei_big', 703, 467,true);//ギャラリー横用
add_image_size( 'jirei_big_height', 703, 467); //ギャラリー正方形 縦用
add_image_size( 'jirei_small', 110, 110, true );
add_image_size( 'blog_sam', 230, 153, true );
add_image_size( 'side_new_post_sam', 68, 68, true );
//タイトルを入力してくださいを変える
function change_default_title( $title ) {
$screen = get_current_screen();
if ( 'shop' == $screen->post_type ) {
$title = '店舗名をご入力ください。';
} else if ( 'shop_profiless' == $screen->post_type ){
$title = 'ブログニックネームを入力';
} else if ( $screen -> post_type == 'post' ) {
$title = 'これは投稿だけ変更します';
}
return $title;
}
add_filter('enter_title_here', 'change_default_title');
//管理フッターテキスト
function remove_footer_admin () {
echo 'サイト名';
}
add_filter('admin_footer_text', 'remove_footer_admin');
//投稿後カテゴリ階層維持
function lig_wp_category_terms_checklist_no_top( $args, $post_id = null ) {
$args['checked_ontop'] = false;
return $args;
}
add_action( 'wp_terms_checklist_args', 'lig_wp_category_terms_checklist_no_top' );
//管理メニュー追加
function test_menu_page() {
$siteurl = get_option( 'siteurl' );
?>
<div class="wrap">
<h2>登録ガイド</h2>
<?php include("tebiki.php"); ?>
</div>
<?php
}
function test_admin_menu() {
add_menu_page( '登録ガイド', '登録ガイド', 'read',
__FILE__, 'test_menu_page' );
}
add_action( 'admin_menu', 'test_admin_menu' );
//管理バー消す管理者以外
//function my_function_admin_bar(){
//return false;
//}
//add_filter( 'show_admin_bar' , 'my_function_admin_bar');
//管理バー消す管理者以外
//function my_function_admin_bar($content) {
//return ( current_user_can("administrator") ) ? $content : false;
//}
//add_filter( 'show_admin_bar' , 'my_function_admin_bar');
//管理画面css
function wp_custom_admin_css() {
echo "\n" . '<link rel="stylesheet" type="text/css" href="' .get_bloginfo('template_directory'). '/custom-admin-css.css' . '" />' . "\n";
}
add_action('admin_head', 'wp_custom_admin_css', 100);
//ログイン画面css
function login_css() {
echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo("template_directory").'/login.css">';
}
add_action('login_head', 'login_css');
====http://ja.forums.wordpress.org/topic/3063=====
// 投稿画面の [表示オプション|表示する項目]のオプション値をフィルタする
function my_get_user_option_meta_box_hidden_post($result, $option, $user){
return array('postexcerpt', 'trackbacksdiv', 'commentstatusdiv', 'commentsdiv', 'slugdiv', 'authordiv', 'revisionsdiv', 'tagsdiv-post_tag');
}
add_filter('get_user_option_metaboxhidden_post', 'my_get_user_option_meta_box_hidden_post', 10, 3);
add_filter('get_user_option_managepostcolumnshidden', 'my_get_user_option_meta_box_hidden_post', 10, 3);
// 投稿画面の[表示オプション|スクリーンレイアウト|列の数]のオプション値をフィルタする
function my_get_user_option_screen_layout_post($result, $option, $user){
return 2;
}
add_filter('get_user_option_screen_layout_post', 'my_get_user_option_screen_layout_post', 10, 3);
// カテゴリ->カスタムフィールド->公開 に毎回並び替える
function my_footer() {
echo '<script type="text/javascript">
//<![CDATA[
jQuery(function(){
jQuery("#normal-sortables").prepend(jQuery("#side-sortables").children("#categorydiv"));
jQuery("#normal-sortables").append(jQuery("#side-sortables").children("#submitdiv"));
jQuery("#categorydiv").prependTo(jQuery("#normal-sortables"));
jQuery("#submitdiv").appendTo(jQuery("#normal-sortables"));
});
//]]>
</script>';
}
add_action('admin_footer', 'my_footer');
====セットhttp://ja.forums.wordpress.org/topic/3063=====
//特定のカテゴリと特定のタグで絞った記事数の表示方法
function taxonomy_found_posts_num() {
$args = array(
'post_type' => array('shoku','asobu','share','seikatsu','iryou','manabu','koukyou','ofuroyado'), //カスタム投稿名
);
$my_query = new WP_Query($args);
return $my_query->found_posts;
}
//表示箇所に
//<?php echo taxonomy_found_posts_num('hokkaido','タグ1'); 件<br />
//<?php echo taxonomy_found_posts_num('aomori','タグ2'); 件
無料サイトまとめ
イラストEPS等まとめ
http://web-mimemo.com/web/illust_material/
NEWアイコン
http://sozai.akuseru-design.com/category/sozai/text/page/2/
TOP画像 2枚目が有ればこのスクリプト 読み込む
<!---Top画像2があればこのスクリプトを読む-->
<?php
$args = array(
'posts_per_page' => -1,
'paged' => $paged,
'orderby' => 'menu_order',
'order' => 'ASC',
//'tax_query' => array(
// 'relation' => 'AND',
// array(
// 'taxonomy' => 'event',
// 'field' => 'slug',
// 'terms' => array( 'トップ用', '予備' ),
//'operator'=>'NOT IN'
// ),
//),
'post_type' => 'd_midashi', //カスタム投稿名
);
?>
<?php
query_posts( $args );
?>
<!--★★★ループ基本-->
<?php
if ( have_posts () ) :
while ( have_posts() ) :
the_post();
?>
<?php if(post_custom('toppage画像2')): ?>
<!--TOPフェード-->
<script type="text/javascript">
$(function(){
var setImg = '#main_contents_top';
var fadeSpeed = 1500;
var switchDelay = 5000;
$(setImg).children('img').css({opacity:'0'});
$(setImg + ' img:first').stop().animate({opacity:'1',zIndex:'20'},fadeSpeed);
setInterval(function(){
$(setImg + ' :first-child').animate({opacity:'0'},fadeSpeed).next('img').animate({opacity:'1'},fadeSpeed).end().appendTo(setImg);
},switchDelay);
});
</script>
<?php endif; ?>
<?php
endwhile;
endif;
?>
<?php wp_reset_query(); ?>
<!---/Top画像2があればこのスクリプトを読む-->
お名前 サブドメイン 設定
DNSレコード設定
DNSレコード設定を利用する
test.doggstarpromotion.comを作成
サブドメイン type A 3600 ip 203.189.109.200
DNSレコード設定用ネームサーバー変更確認はチェックしない
理由 既存のページのネームサーバーは変わると困る。
すぐに独自ドメイン追加でサブドメインを追加してみたが
トップレベルドメイン【.doggstarpromotion.com】は、使用できません。[fixedPart.1]
と出た。
少し反映するまでまとう
2時間ほど3時間まで
その後独自ドメインを設定して メールを設定してみよう
ロリポップはできないみたいだ
今度はサクラで調整
Quick Cache まとめ
http://ma3eng.com/2012/06/05/quick-cache/
スマフォようとかだとだめ
ろぐあうとしんとだめ