タイトルバーと検索結果を「記事タイトル ブログタイトル」にしたい。
(HTML,ワードプレス初心者です)
ワードプレスを使って、ブログを書いています。
タイトルバーと、検索結果で表示されるものが、意図したものになりません。
タイトルバーと検索結果を「記事タイトル ブログタイトル」にしたいのですが、どうすれば良いのでしょうか。
プラグインは、使っていません。
ブログのテーマは、賢威7です。
少し前までは、All in One SEO Packを使用していましたが、賢威7との相性が悪いので、消しました。
タイトルバーに表示されるものは、以下の冒頭部分です。
また、検索結果では、記事タイトルの後ろに以下の文字が続いたり、以下の文字が記事タイトルより先に来てしまうこともあります。
###タイトルバー、検索結果に出る文字。
試したこと
ワードプレスのテーマヘッダーのペイジで、HTMLコードをいじりました。
<title>と</title>の間に、色々コードを入れてみましたが、入れたコードがそのままタイトルバーに表示されます。 検索しても、解決方法が紹介されているサイトがありません。 どうすれば良いのでしょうか。テーマヘッダー(header php)
<?php /** * header.php */ global $post; $pid = ""; if ( isset( $post ) ) { $pid = $post->ID; } ?><!DOCTYPE html> <html lang="ja" class="<?php echo getPageLayout( $pid ); ?>"<?php if ( the_keni( 'gp_view' ) == "y" ) { ?> itemscope itemtype="http://schema.org/<?php echo getMicroCodeType(); ?>"<?php } ?>> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-5918760080580616", enable_page_level_ads: true }); </script><meta name="description" content="<?php description_keni(); ?>"> <?php } } elseif ( the_keni( 'view_meta' ) == "y" ) { ?> <meta name="keywords" content="<?php keyword_keni(); ?>"><title><% if:extra_title %><% extra_title %> - <% blog.title %><% /if %><% unless:extra_title %><% blog.title %><% /unless %></title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <?php if ( the_keni( 'mobile_layout' ) == "y" ) { ?> <meta name="viewport" content="width=device-width, initial-scale=1.0"><?php } ?> <?php if ( ! the_keni( 'view_meta' ) ) { ?> <?php if ( the_keni( 'view_meta_keyword' ) && the_keni( 'view_meta_keyword' ) == "y" ) { ?> <meta name="keywords" content="<?php keyword_keni(); ?>"> <?php } ?> <?php if ( the_keni( 'view_meta_description' ) && the_keni( 'view_meta_description' ) == "y" ) { ?>
</head> <?php $gnav = ( ( get_globalmenu_keni( 'top_menu' ) == "" ) || ( is_singular() && get_post_meta( $pid, 'menu_view', true ) == "n" ) ) ? "no-gn" : ""; // メニューを表示しない場合は、classにno-gnを設定する // ランディングページで画像をフルサイズで表示する if ( is_singular( LP_DIR ) && get_post_meta( $pid, 'fullscreen_view', true ) == "y" ) { $gnav .= ( $gnav != "" ) ? " lp" : "lp"; ?> <body <?php body_class( $gnav ); ?>> <?php echo do_shortcode( the_keni( 'body_text' ) ) . "\n"; ?> <div class="container"> <header id="top" class="site-header full-screen"<?php if ( get_post_meta( $pid, 'header_image', true ) != "" ) { ?> style="background-image: url(<?php echo get_post_meta( $pid, 'header_image', true ); ?>)"<?php } ?>> <div class="site-header-in"> <div class="site-header-conts"> <h1 class="site-title"><?php echo ( get_post_meta( $pid, 'page_h1', true ) ) ? esc_html( get_post_meta( $pid, 'page_h1', true ) ) : get_h1_keni(); ?></h1> <?php echo get_post_meta( $pid, 'catch_text', true ) ? "<p class=\"lp-catch\">" . esc_html( get_post_meta( $pid, 'catch_text', true ) ) . "</p>" : ""; ?> <p><a href="#main"><img src="<?php echo get_template_directory_uri(); ?>/images/common/icon-arw-full-screen.png" alt="メインへ" width="48" height="48"></a></p> </div> </div> </header> <?php if ( strpos( $gnav, "no-gn" ) === false ) { ?> <!--▼グローバルナビ--> <nav class="global-nav"> <div class="global-nav-in"> <div class="global-nav-panel"><span class="btn-global-nav icon-gn-menu">メニュー</span></div> <ul id="menu"> <?php echo get_globalmenu_keni( 'top_menu' ); ?> </ul> </div> </nav> <!--▲グローバルナビ--> <?php }<meta name="description" content="<?php description_keni(); ?>"> <?php } wp_enqueue_script( 'jquery' ); if ( get_option( 'blog_public' ) != false ) { echo getIndexFollow(); } canonical_keni(); pageRelNext(); wp_head(); facebook_keni(); tw_cards_keni(); microdata_keni(); if ( function_exists( "get_site_icon_url" ) && get_site_icon_url() == "" ) { ?> <link rel="shortcut icon" type="image/x-icon" href="<?php echo get_template_directory_uri(); ?>/favicon.ico"> <link rel="apple-touch-icon" href="<?php echo get_template_directory_uri(); ?>/images/apple-touch-icon.png"> <link rel="apple-touch-icon-precomposed" href="<?php echo get_template_directory_uri(); ?>/images/apple-touch-icon.png"> <link rel="icon" href="<?php echo get_template_directory_uri(); ?>/images/apple-touch-icon.png"> <?php } ?> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script><![endif]--> <?php echo do_shortcode( the_keni( 'meta_text' ) ) . "\n"; if ( is_single() || is_page() ) { echo get_post_meta( $pid, 'page_tags', true ) . "\n"; } ?>
// それ以外の場合 } else { ?> <body <?php body_class( $gnav ); ?>> <?php echo do_shortcode( the_keni( 'body_text' ) ) . "\n"; ?> <div class="container"> <header id="top" class="site-header <?php if ( is_singular( LP_DIR ) ) { echo 'normal-screen'; } ?>"> <div class="site-header-in"> <div class="site-header-conts"> <?php if ( is_singular( LP_DIR ) ) { echo '<h1 class="site-title">'; echo get_h1_keni(); echo "</h1>\n"; echo ( get_post_meta( $pid, 'catch_text', true ) ) ? "<p class=\"lp-catch\">" . esc_html( get_post_meta( $pid, 'catch_text', true ) ) . "</p>\n" : ""; ?> <?php } elseif ( is_front_page() ) { ?> <h1 class="site-title"><a href="<?php echo esc_url( home_url() ); ?>"><?php echo ( the_keni( 'site_logo' ) != "" ) ? "<img src=\"" . the_keni( 'site_logo' ) . "\" alt=\"" . esc_html( get_bloginfo( 'name' ) ) . "\" />" : esc_html( get_bloginfo( 'name' ) ); ?></a> </h1> <?php } else { ?> <p class="site-title"><a href="<?php echo esc_url( home_url() ); ?>"><?php echo ( the_keni( 'site_logo' ) != "" ) ? "<img src=\"" . the_keni( 'site_logo' ) . "\" alt=\"" . esc_html( get_bloginfo( 'name' ) ) . "\" />" : esc_html( get_bloginfo( 'name' ) ); ?></a> </p> <?php } ?> </div> </div> <?php if ( $gnav == "" ) { ?> <!--▼グローバルナビ--> <nav class="global-nav"> <div class="global-nav-in"> <div class="global-nav-panel"><span class="btn-global-nav icon-gn-menu">メニュー</span></div> <ul id="menu"> <?php echo get_globalmenu_keni( 'top_menu' ); ?> </ul> </div> </nav> <!--▲グローバルナビ--> <?php } if ( is_front_page() && ( ! isset( $_GET['post_type'] ) || $_GET['post_type'] == "" ) ) { $mainimage = the_keni( "mainimage" ); if ( ! empty( $mainimage ) ) { ?> <div class="main-image"> <?php if ( the_keni( "mainimage_posision" ) == "image" ) { ?> <div class="main-image-in<?php if ( the_keni( 'mainimage_wide' ) == "y" ) { ?> wide<?php } ?>"> <img class="header-image" src="<?php echo esc_url( $mainimage ); ?>" alt="<?php echo esc_html( the_keni( "mainimage_alt" ) ); ?>"/> </div> <?php } else { ?> <div class="main-image-in-text<?php if ( the_keni( 'mainimage_wide' ) == "y" ) { ?> wide<?php } ?>" style="background-image: url(<?php echo esc_url( $mainimage ); ?>);"> <div class="main-image-in-text-cont"> <?php if ( the_keni( "main_catchcopy" ) != "" ) { ?><p class="main-copy"><?php echo esc_html( the_keni( "main_catchcopy" ) ); ?></p><?php } ?> <?php if ( the_keni( "sub_catchcopy" ) != "" ) { ?><p class="sub-copy"><?php echo esc_html( the_keni( "sub_catchcopy" ) ); ?></p><?php } ?> <?php if ( the_keni( "free_catchcopy" ) != "" ) { echo "<div class=\"main-image-in-text-box\">\n" . the_keni( "free_catchcopy" ) . "\n</div>\n"; } ?> </div> </div> <?php } ?> </div> <?php } elseif ( the_keni( "mainimage_posision" ) != "image" ) { ?> <div class="main-image-in-text<?php if ( the_keni( 'mainimage_wide' ) == "y" ) { ?> wide<?php } ?>" style="background-color: #<?php echo the_keni( 'mainimage_bg_color' ); ?>;"> <div class="main-image-in-text-cont"> <?php if ( the_keni( "main_catchcopy" ) != "" ) { ?><p class="main-copy"><?php echo esc_html( the_keni( "main_catchcopy" ) ); ?></p><?php } ?> <?php if ( the_keni(
以下、文字数により略。
回答1件
あなたの回答
tips
プレビュー