よくある下記でページ内リンクのズレ解消が出来ない時は要素の上に空要素を追加して非表示にする
#service { display: block; visibility: hidden; width: 100%; height: 100px; } #service { padding-top: 100px; margin-top: -100px; }
よくある下記でページ内リンクのズレ解消が出来ない時は要素の上に空要素を追加して非表示にする
#service { display: block; visibility: hidden; width: 100%; height: 100px; } #service { padding-top: 100px; margin-top: -100px; }
「NONCE_SALT constant is missing from the wp-config.php file」というエラーは、WordPressの設定ファイル「wp-config.php」に「NONCE_SALT」定数が含まれていないことを示しています。
このエラーは、WordPressのセキュリティを強化するために使用される「NONCE_SALT(一時的なトークン)」の機能に関連しています。
Local Sites/サイト名/app/public/wp-config.php
などのwp-config.phpに下記を追加します。
/**#@+ * Authentication unique keys and salts. * * Change these to different unique phrases! You can generate these using * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}. * * You can change these at any point in time to invalidate all existing cookies. * This will force all users to have to log in again. * * @since 2.6.0 */ //追加する define('NONCE_SALT', 'ここに任意の文字列を入力');
【WordPress ローカル作業におけるエラー】NONCE_SALT constant is missing from the wp-config.php file. について | ギークの逆襲 🐟
<?php //除外するカテゴリーのIDを入力 $prev_navigation = get_adjacent_post(false, '39', true); $next_navigation = get_adjacent_post(false, '39', false); ?> <nav class="page-nav"> <?php if (!empty($prev_navigation)) : ?> <div class="prev-link"> <?php if (get_the_post_thumbnail($prev_navigation->ID)) : // 前の投稿に画像があれば表示 ?> <?php echo get_the_post_thumbnail($prev_navigation->ID, '100,100'); ?> <?php else : ?> <?php $image = get_field('cf-noimg', 'option'); $url = $image['url']; ?> <img src="<?php echo $url; ?>" alt="no-img"> <?php endif; ?> <span>前の記事へ<br><?php echo get_the_title($prev_navigation->ID); ?></span> <a href="<?php echo get_permalink($prev_navigation->ID); ?>" class="link-over"></a> </div> <?php endif; ?> <?php if (!empty($next_navigation)) : ?> <div class="next-link"> <?php if (get_the_post_thumbnail($next_navigation->ID)) : // 前の投稿に画像があれば表示 ?> <?php echo get_the_post_thumbnail($next_navigation->ID, '100,100'); ?> <?php else : ?> <?php $image = get_field('cf-noimg', 'option'); $url = $image['url']; ?> <img src="<?php echo $url; ?>" alt="no-img"> <?php endif; ?> <span>次の記事へ<br><?php echo get_the_title($next_navigation->ID); ?></span> <a href="<?php echo get_permalink($next_navigation->ID); ?>" class="link-over"></a> </div> <?php endif; ?> </nav>
<?php /*==================================================== 月別アーカイブ =====================================================*/ $cat_slug = 'album';←変える $args = array( 'category_name' => $cat_slug, 'posts_per_page' => -1 ); $archive_query = new WP_Query($args); while ($archive_query->have_posts()) { $archive_query->the_post(); //年月毎に記事情報を配列に格納 $archive_list[get_the_time('Y/n', $post->ID)][] = $post->post_title; } wp_reset_postdata(); ?> <?php if ($archive_list) : ?> <ul> <?php foreach ($archive_list as $year_month => $archive) : $year_month_arr = explode('/', $year_month); ?> <li> <a href="<?php echo esc_url(home_url($year_month . '/?cat_slug=' . $cat_slug)) ?>"> <?php echo $year_month_arr[0] . '年' . $year_month_arr[1] . '月' ?> </a> </li> <?php endforeach; ?> </ul> <?php endif; ?>
<?php //$category_nameがなければ引き渡した情報を格納します。(例:album) if (!$category_name) { $category_name = $_GET['cat_slug']; } if (have_posts()) : ?> <ul class="archive-info-list flex"> <?php while (have_posts()) : the_post(); // 記事毎のカテゴリ取得 $categories = get_the_category(); $cat_id = $categories[0]->term_id; // アーカイブのカテゴリがアルバムだったらアルバムのみ表示する if ($category_name === "album") : ?> <?php if ($cat_id === 39) : ?> <li> <!-- 画像・リンク --> <?php if (has_post_thumbnail()) : ?> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium'); ?></a> <?php endif; ?> <!-- 日付 --> <time itemprop=”datepublished”><?php echo get_the_date("Y/m/d"); ?></time> <!-- カテゴリ --> <?php if ($categories) { echo '<ul class="archive-info-cat">'; foreach ($categories as $category) { echo '<li><a href="' . esc_url(get_category_link($category->term_id)) . '">' . $category->name . '</a></li>'; } echo '</ul>'; } ?> <!-- タイトル・リンク --> <h2 class="archive-info-title mb0"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> </li> <?php endif; ?> <?php else : // アーカイブのカテゴリがアルバム以外ならアルバム以外を全て取得 ?> <?php if ($cat_id !== 39) : ?> <p>アーカイブのカテゴリがアルバム以外ならアルバム以外を全て取得</p> <?php endif; ?> <?php endif; endwhile; ?> </ul> <?php else : ?> <h2 class="no-post">記事が見つかりませんでした。</h2> <?php endif; ?> <?php if (function_exists('pagination')) : pagination($wp_query->max_num_pages, get_query_var('paged')); endif; ?> <?php wp_reset_postdata(); ?>
if( function_exists('acf_add_options_page') ) { acf_add_options_page(array( 'page_title' => 'テストオプションページ', 'menu_title' => 'テストオプションページ', 'menu_slug' => 'test-optionpage-settings', 'capability' => 'edit_posts', 'redirect' => false )); }
Advanced Custom Fields のオプションページの設定方法と表示方法 | wp.geek
/* ------------------------------------------------------------------------------ Basic認証 ------------------------------------------------------------------------------ */ function basic_auth($auth_list, $realm = "Restricted Area", $failed_text = "認証に失敗しました") { if (isset($_SERVER['PHP_AUTH_USER']) and isset($auth_list[$_SERVER['PHP_AUTH_USER']])) { if ($auth_list[$_SERVER['PHP_AUTH_USER']] == $_SERVER['PHP_AUTH_PW']) { return $_SERVER['PHP_AUTH_USER']; } } header('WWW-Authenticate: Basic realm="' . $realm . '"'); header('HTTP/1.0 401 Unauthorized'); header('Content-type: text/html; charset=' . mb_internal_encoding()); die($failed_text); }
<?php if (!is_home()) : if (get_post_type() === 'parent-post' || is_page('912') || is_singular('parent-post') || has_term('parent_cat') || is_post_type_archive('parent-post')) : $user = get_field('user', 'option'); $pass = get_field('pass', 'option'); $userArray = array( "$user" => "$pass" ); basic_auth($userArray); endif; endif; ?>
.n2-ss-slide-backgrounds { height: 80vw !important; }