都道府県 / 州 / 郡 woocommerce
翻訳ファイルの修正
WooCommerceの日本語ファイル
/wp-content/languages/plugins/woocommerce-ja.mo
woocommerce-ja.po が編集用のファイルなので、このファイルをダウンロード
翻訳ファイルの編集ソフト「Poedit」 をインストール
書き換え後に ファイル MOにコンパイル → woocommerce-ja.mo をアップして上書き
翻訳ファイルの修正
WooCommerceの日本語ファイル
/wp-content/languages/plugins/woocommerce-ja.mo
woocommerce-ja.po が編集用のファイルなので、このファイルをダウンロード
翻訳ファイルの編集ソフト「Poedit」 をインストール
書き換え後に ファイル MOにコンパイル → woocommerce-ja.mo をアップして上書き
投稿記事に過去1ヶ月よりも前の日付があると出てこないので、SQL文で一括で昨日とかにする
update `wp_posts` set post_date='2022-01-01 12:12:12'
,post_date_gmt = '2022-01-01 03:12:12'
$the_query = new WP_Query($args);
foreach($the_query->posts as $key=>$value){
var_dump($value->ID, $value->post_date, $value->post_content);
$thumb_id = get_post_thumbnail_id($postID); // 指定した投稿のアイキャッチ画像の画像IDを取得
$thumb_img = wp_get_attachment_image_src($thumb_id );
$src = $thumb_img[0];
$postID = get_the_ID();
$fivesdrafts = $wpdb->get_results(
"SELECT name , slug
FROM $wpdb->term_relationships
LEFT JOIN $wpdb->term_taxonomy USING (term_taxonomy_id)
LEFT JOIN $wpdb->terms USING(term_id)
WHERE object_id = $postID
AND taxonomy = 'post_tag'"
);
foreach ($fivesdrafts as $key => $val) {
$tag .= $val->slug . $val->name ; // スラッグ。タグ
}
/*
固定ページ 特定のスラッグを親に持つ記事の表示
*/
if ( $post->ancestors ) {
foreach ( $post->ancestors as $post_anc_id ) {
$post_id = $post_anc_id;
} // foreach($post->ancestors as $post_anc_id){
} else {
$post_id = $post->ID;
} // if($post->ancestors){
if ( $post_id ) {
$children = wp_list_pages( 'title_li=&child_of=' . $post_id . '&echo=0' );
if ( $children ) { ?>
<aside class="widget widget_child_page widget_link_list">
<nav class="localNav">
<h1 class="subSection-title"><a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>"><?php echo get_the_title( $post_id ); ?></a></h1>
<ul>
<?php echo $children; ?>
</ul>
</nav>
</aside>
<?php } // if ($children)
} // if ($post_id)
?>
/* データの表示指定 */
$type =15; // カテゴリID
$item_count = 6; //1ページに表示したいアイテム数
$sp = empty($_GET['pg']) ? 1 : $_GET['pg'] ;
$field = "SELECT object_id , p.post_title ,post_content,post_date,post_excerpt,post_name,
p.post_type , p.post_status, m.stock_quantity , m.min_price, m.max_price ,meta_value" ;
$query = "
FROM `$wpdb->term_relationships` as t
left join $wpdb->posts as p on p.id = t.object_id
left join `$wpdb->wc_product_meta_lookup` as m on m.product_id = t.object_id
left join `$wpdb->postmeta` as e on e.post_id = t.object_id
WHERE `term_taxonomy_id` = %d AND p.post_type = 'product' AND p.post_status = 'publish'
AND e.meta_key = '_price' " ;
$sql = $field . $query ." LIMIT %d, $item_count;";
$results = $wpdb->get_results( $wpdb->prepare( $sql ,$type ,($sp-1)*$item_count) );
foreach($results as $row) var_dump($row);
[/highlight_php]
このページのページャー
[highlight_php]
<?php /* 以下、ページャーの表示 */
$field = "SELECT count(*) ";
$sql = $field . $query ;
$product_count = $wpdb->get_var( $wpdb->prepare( $sql , $type) );
$product_page = ceil( $product_count/$item_count); //ページ数
?>
<nav class="undernav pagination">
<?php
if( $sp > 1){
echo '‹ 前へ ';
}
?>
Page =$sp?> of =$product_page?>
<?php
for( $i=1 ; $i <= $product_page; $i++){
if( $i == $sp ){
echo '', $i,'';
}else{
echo '',$i,'';
}
}
if( $sp < $product_page){
echo '次へ ›';
}
?>
#: wp-includes/js/dist/api-fetch.js:705 msgid "The response is not a valid JSON response
”
CentOSなら
<Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride All ←これ Require all granted </Directory>
Apache再起動
.htaccess が作られていないので以下の操作で作らせる
管理画面 → 設定 → パーマリンク
◎ 基本 → 保存
◎カスタム [ category / posttitle]
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles' );
remove_action('admin_print_styles', 'print_emoji_styles');
define('WP_DEBUG', true); //phpデバックモード
define('WP_POST_REVISIONS', 2); //リビジョンの制限
define('SAVEQUERIES', true); // SQLデバック
define('SCRIPT_DEBUG', true); // javaスクリプトデバッグ
define('CONCATENATE_SCRIPTS',false) // メディアライブラリが表示されない場合