データベースに格納されたメタバリューを一括変換する方法 ワイヤレスマイクを・ワイヤレスマイクに変更

データベースのメタバリューに収まっているカスタムフィールドのデータ
必要準備がめたキーで
チェックボックすにて選択したものが入っているメタバリュー

方法は
phpmyadminで
クエリ
SQL ▶ 

複合してあって・が有無が共存していたため二回実行

UPDATE wp_d_temp1postmeta SET meta_value=REPLACE(meta_value,'ワイヤレスマイク','・ワイヤレスマイク')WHERE meta_key LIKE '%必要準備%'
UPDATE wp_d_temp1postmeta SET meta_value=REPLACE(meta_value,'・・ワイヤレスマイク','・ワイヤレスマイク')WHERE meta_key LIKE '%必要準備%'

戸惑ったのはデータベーステーブルがついていたため
参考URLのままでは実行されなかた。

http://okwave.jp/qa/q7916569.html

お名前共有にてローカルで作ったワードプレスアップ手順

1.データベース作成
2.ワードプレスのインストール サーバーでやる(アップしたりパーミッションの問題あるから)
2.phpmyadminインスト

フォルダ階層 wp ▶ 出す ドメイン直下 に
phpadminでサイトURL変える。

—-
wp phpmyadmin
ファイルマネージャー
サーバー情報 ▶からいけるが解凍は出来ない模様
却下

のでphpmyadminファイルジラで解凍アップし phpのパーミッションをすべて700にする必要あり
参考
http://guide.onamae-server.com/sd/apps.php?c1=3&c2=12&c3=15&id=27

ファイルジラでフィルタ
phpのみを作る(ファイル名 後方一致 .php ふぁいるのみ)
フォルダ選択右クリックパーミッション700 中に含むものすべてを指定
参考
http://daredemopc.blog51.fc2.com/blog-entry-927.html

「phpmyadmin」フォルダの下に、設定ファイルを保存する「config」フォルダを作成

https://ドメイン名/phpmyadmin/setup/ にアクセス
セキュリティが警告 進む



http://guide.onamae-server.com/sd/apps.php?c1=3&c2=12&c3=15&id=28
SSL接続の推奨」の「オプション」をクリックしてデータベースとのSSL通信の設定
「セキュリティ」タブをクリックし、「SSL接続の推奨」にチェック
新しいサーバー」をクリックし、データベース設定を追加します。
このサーバーの詳細な名前	 コントロールパネルで作成したデータベースの「ホスト名」 
サーバのホスト名	 コントロールパネルで作成したデータベースの「ホスト名」 
config認証用のユーザ	(空白) 
「サーバー設定」タブメニューにてphpMyAdminで管理するデータベースの設定を入力し「Apply」ボタンをクリックします。 

「基本設定」タブ、及び「認証」タブにてphpMyAdminで管理するデータベースの設定を入力します。 
「デフォルト言語」を「日本語」に変更し、「保存する」をクリックします。 
共用サーバー SDにFTP接続し、 先ほど作成した「config」フォルダの下にある「config.inc.php」ファイルを一度ダウンロードします。その後、「phpmyadmin」フォルダの下にアップロードします。
※脆弱性対策のため、この時点で「config」フォルダのパーミッション設定を「000」に
 変更してください。
設定ファイルの作成に使用した phpmyadmin/setup/index.php ファイルのパーミッション設定を「600」に変更しておきます。 
https://ドメイン名/phpmyadmin/ にアクセスし、 phpMyAdminの画面が表示されたらインストールは終了です。
 以上でphpMyAdminの新規インストールは完了です。
共用サーバー SDのコントロールパネルで表示されたデータベースのユーザー名、パスワードを使ってログインしてください。 
複数のデータベースを管理される方は次の データベースの追加登録 へ
進んでください。
http://guide.onamae-server.com/sd/apps.php?c1=3&c2=12&c3=15&id=29

やはりさくらが一番安心

つずき
問題
データベースにローカルデータベース突っ込もうとおもったら2点
・アップロードサイズが2Mしかない
・データベーステーブル文字がちがうのかアップできない

解決
・いつものphp.iniをphpmyadminにいれたらアップサイズ増えた 安心ほ
・新しくコンパネでデータベース作って空っぽの状態にしてインポートしたらできた。

追記
・ローカルのデータベースアップするとエラーになる
多分まんまプラグインとかアップしてないからおかしいのか
プラグインの少ない方 つまりアップロード済みのデータベースをDLして
ローカルにつっこんでからならアップできた。

その前に
・zipでアップできないからプラグインを必要なものを
インスト時の状態でインストしてった20個以上 めんどい(アップでもパーミッション等あるけどだいじょぶか?)
テーマ 画像フォルダ=アップロードフォルダはファイルジラでアップす

いちおこれでローカルと同じワードプレスあがった

しかしphpmyadmin 等のセキュリティはだいじょぶか?

Welcart まとめてく3

アーカイブページ(商品カテゴリ=親の自動チェックが効かない)でブログと同じカテゴリを使うと
表示件数が分岐できない

即席で 小津メインクエリで

  //商品カテゴリーは全件表示
    if ( $query->is_category(array( 'item','kitchen','stool','others')) && $query->is_main_query() ) {
$query->set('posts_per_page', -1 );
  }

商品ページのカーかイブけんすうと
ブログ件数分けたいなら

ぶろぐをすべて親同じにするか
たくそのみーわけたほうがよいな

さらにカスタムフィールドスイートの場合コピーした時おかしくなる

welcartと相性のいいカスタムフィールドはSmart Custom Fieldsみたいだ

ウェルカートユーザーにはすべての権限を持たせたいがワードプレスの中心部を触られたくないばあい
忠告しさらに
ユーザーIDで1以外をカスタムアドミン2を読み込ます。

以下コード

@charset "utf-8";

#profile-page h3,
/*#profile-page table:nth-of-type(1) tr:nth-child(1),*/
#profile-page table:nth-of-type(1) tr:nth-child(2),
#profile-page table:nth-of-type(1) tr:nth-child(3),
#profile-page table:nth-of-type(1) tr:nth-child(4),
#profile-page table:nth-of-type(1) tr:nth-child(5),
#profile-page table:nth-of-type(2) tr:nth-child(2),
#profile-page table:nth-of-type(2) tr:nth-child(3),
#profile-page table:nth-of-type(2) tr:nth-child(4),
#profile-page table:nth-of-type(2) tr:nth-child(5),

#profile-page table:nth-of-type(3) tr:nth-child(2),
#profile-page table:nth-of-type(3) tr:nth-child(3),
#profile-page table:nth-of-type(3) tr:nth-child(4),
#profile-page table:nth-of-type(3) tr:nth-child(5),
#profile-page table:nth-of-type(4) tr:nth-child(1),
#footer-ozh-oam,#footer-upgrade
{
    display: none;
}


/*
#menu-dashboard	ダッシュボード
#menu-posts	投稿
#menu-media	メディア
#menu-links	リンク
#menu-pages	固定ページ
#menu-comments	コメント
#menu-appearance	外観
#menu-plugins	プラグイン
#menu-users	ユーザー
#menu-tools	ツール
#menu-settings	設定
.wp-menu-separator	(区切り線)
*/
#menu-tools,
#menu-plugins,
#menu-settings,
#menu-pages,
#menu-appearance,
#toplevel_page_edit-post_type-cfs,/*スイート*/
#toplevel_page_edit-post_type-acf,/*アドバンス*/
#toplevel_page_cptui_main_menu,/*CPI*/
#toplevel_page_WP-Optimize,/*オプティ*/
#toplevel_page_zencache/*全キャッシュ*/


{
    display: none;
}
//このcssでCSS3を使って項目見えなくする
//CSSで管理画面内のサイドメニューを非表示にする 権限指定
function custom_admin_styles(){
$current_user = wp_get_current_user(); //現在のユーザー情報を取得
$user = $current_user->ID;
        if($user !== 1){ //doggstar=1 かチェック
            echo '<link rel="stylesheet" type="text/css" href="' .get_bloginfo('template_directory'). '/d_con/custom-admin-css2.css" />';
        }
         
         
    }
    add_action('admin_print_styles', 'custom_admin_styles', 21);
 //これより下はいるのか??
    /*
     * ユーザーの権限をチェックする
     * @param $user ユーザーオブジェクト
     * @param $role ユーザー権限の文字列
     *      (administrator, editor, author, contributor, subscriber)
     */
    function check_user_role($user,$role){
        foreach($user->roles as $user_role){
            if($user_role === $role){
                return true;
            }
        }
        return false;
    }

WordPressのカテゴリのテンプレートで、属する親カテゴリに合わせて、子カテゴリの内容を切り替える関数

//WordPressのカテゴリのテンプレートで、属する親カテゴリに合わせて、
//子カテゴリの内容を切り替える関数

function in_category_family( $parent ) {
if ( empty($parent) )
        return false;

    if ( in_category($parent) )
        return true;

    $parent = get_category($parent);
    foreach ( (get_the_category()) as $child ) {
        $child = get_category($child->cat_ID);
        if ( cat_is_ancestor_of($parent, $child) )
            return true;
    }

    return false;
}
//if ( function_exists('in_category_family') && in_category_family('親カテゴリのスラッグ') ){
	//実行内容
//}

welcart まとめてく2

どこまでいったか

写真(商品写真)をアップする方法
sol-001 が商品名なら sol-001 複数毎目はsol-001–01 (0から1へ読み込むようだから 01~09 10~19 とする)100枚はないだろ?

商品の並べ替え

ファンクション

//順序ポスト使用
add_post_type_support( 'post', 'page-attributes' );

ワードプレス4以降 複数条件でループを並び指定出来る
クエリポスト

'orderby' => array( 'menu_order' => 'DESC', 'date' => 'DESC' ),

メインクエリ

$query -> set( 'orderby', array( 'menu_order' => 'DESC', 'date' => 'DESC' ) ); 

商品画像を出力するコード 参考http://wp-e.org/2014/09/27/5128/
通常

<?php
//商品画像
//usces_the_itemImage(0, 640, 480);
 ?>

クラスなどつける

<img src="<?php usces_the_itemImageURL(0); ?>" class=""/>

複数画像を出力
普通

<?php $imageid = usces_get_itemSubImageNums(); ?>
<?php foreach ( $imageid as $id ) : ?>
		<a href="#"><?php usces_the_itemImage($id, 295, 450, $post); ?></a>
<?php endforeach; ?>

クラス何どつける

<?php $imageid = usces_get_itemSubImageNums(); ?>
<?php foreach ( $imageid as $id ) : ?>
		<a href="#"><img src="<?php usces_the_itemImageURL($id); ?>" class=""/></a>
<?php endforeach; ?>

商品編集ダイレクト ファンクション

//アイテムページの編集をアイテム編集ページに
add_filter('edit_post_link', 'my_edit_post_link');
function my_edit_post_link($output) {
  if(usces_is_item()){
  $output = str_replace('post.php?post', 'admin.php?page=usces_itemedit&post', $output);
    }
    return str_replace('<a ', '<a target="_blank" ', $output);
}

コード

<?php edit_post_link('この商品を編集', '<div class="henshu">', '</div><div style="clear:both"></div>'); ?>

商品ページカレント
参考http://webutubutu.com/webdesign/2108
【検索用キー カレントメニューの作り方 親カテゴリで】
親カテゴリで分岐
ファンクション

//親カテゴリで分岐
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;
}
<?php if ( in_category( '親カテゴリーのスラッグ' ) || post_is_in_descendant_category( get_term_by( 'slug', '親カテゴリーのスラッグ', 'category' ))): ?>
          カテゴリーAとこのカテゴリーを親に持つ子カテゴリーであれば表示する内容
<?php endif; ?>

実際こんな便利なコードができた

 <li<?php if(is_page( '14' )  
 //シングルで商品が親カテゴリーじゃない場合(親カテゴリスラッグで分岐 ファンクションコード使用)
 or is_single() and !post_is_in_descendant_category( get_term_by( 'slug', 'item', 'category' ))
 ) : ?> class="current"<?php endif; ?>><a href="<?php echo home_url(); ?>?page_id=14">BLOG</a></li>





<li<?php if(is_page( '4' ) or in_category( 'item' ) || 
//親カテゴリスラッグで分岐 ファンクションコード使用
 post_is_in_descendant_category( get_term_by( 'slug', 'item', 'category' ))): 
 ?> class="current"<?php endif; ?>><a href="<?php echo home_url(); ?>?page_id=4">PRODUCTS</a></li>  

親カテゴリ指定して 小カテゴリ別に記事一覧 つまり welcart の商品一覧カテゴリ別

<?php
 //親のIDをget_termsへ
$args = array('child_of' => 97);
//子ターム一覧を取得
$dterms=get_terms('category',$args);
?>
   

<?php 	
foreach ( $dterms as $dterm ):
?>


<!--★★★ループ基本-->
<?php
if ( have_posts () ) :
    while ( have_posts() ) :
        the_post();
?>
商品
<?php
    endwhile;
endif;
?>
<?php wp_reset_query(); ?>



<?php endforeach; ?>

font exploer pro xで2台で共有する方法

まずノートでこつこつやったのでそれを
ローカルバックアップ フォント含む設定で保存 ソフト自体はチェック外す

それをもう一台でローカルバックアップ リストア 展開ファイル保存先を選びok

ここまではできた

あとは更新していく時の設定考える

展開保存先を共有することはできるのか?
つまり
両方とも同じバックアップをリストア (DROP BOXで共有できるか)
片一方で変更を加え 後に
書き出して 設定ファイルだけ

それで新しく読み込ませたフォントもセットれるだろうか?

facebook動画をDLして WEBサイトで見せる方法

http://keepvid.com/

ここで入力

» Download MP4 « – HD (720p/960p/1080p)
を右クリックで保存
MP4ができる。

埋め込み

http://honttoni.web.fc2.com/blog_honttoni/samples/sample62set/video.html

<object width="640" height="380">
   <param name="src" value="video/uchiage.mp4">
   <param name="autoplay" value="false">
   <param name="controller" value="true">
   <embed src="video/uchiage.mp4" width="640" height="380" type="video/mp4"
   autoplay="false" controller="true" pluginspage="http://www.apple.com/jp/quicktime/download/">
</object>

youtubedl
http://offliberty.com/

テンプレートを整理した 覚え

すずきさんのHPで変えた

複雑な部分だけ

・ブログループを(ボックス&ダラ読み)
どこに置くか悩む

Dフォルダにおいて インクルードさせる場合 コメントアウトしたようにかかなければならない
理由はページテンプレートをフォルダにまとめたせいだろう。

<?php // include(get_template_directory() . '/a1_d_blog_roop.php'); 
	 
	 include("a1_d_blog_roop.php"); 
	 ?> 

今回やった方法は
top階層において そのまま読み込ます
top階層から読み込む場合は特に指示なく読み込めた。

URLで分岐させる

ドメイン日本語含む

<?php
$url = urldecode($_SERVER['REQUEST_URI']);
?>

参考

http://okwave.jp/qa/q8564604.html

ドメイン英語

<?php
$url = $_SERVER['REQUEST_URI'];
?>

<?php if($url == "/inquiry22.html" ): ?>
・・

<?php else: ?>
・・
<?php endif; ?>

体重計算での小数点計算での誤差

どうやら0.1は2進数で割り切れない数字だから
0.09999999となる??

ので前回からの結果が-0.9.000000000001 となる
ので

$weight_d = sprintf('%.1f', ($weight_now - $weight2[0]));
echo $weight_d;

sprintf(‘%.1f’, ~
でできた。

小数点2けただと
sprintf(‘%.2f’,
となるらしい

参考

http://www.phppro.jp/qa/2601
http://php.net/manual/ja/function.sprintf.php
http://www.psi-net.co.jp/blog/?p=277
https://forum.openoffice.org/ja/forum/viewtopic.php?f=10&t=768