サポート » テーマ » 横幅の最大を決め外側をカラー付けしたい(Lightning無償版)

  • 解決済 syntaro

    (@syntarou)


    bodyタグの中に、divタグを追加して、divタグ内の幅と、bodyタグの背景色を設定しています。

    function.phpです。

    <?php
    
    function body_php_include()  {
        include('body-include.php');
    }
    add_action('wp_body_open', 'body_php_include');
    
    function footer_php_include()  {
        include('footer-include.php');
    }
    add_action('wp_footer', 'footer_php_include');
    
    function style_change() {
    ?>
    <style type="text/css">
    	<?php if (is_mobile()) { ?>
    		.site-body {
    			margin-left: 12px;
    			margin-right: 12px;
    		}
    		.has-huge-font-size {
    			font-size: 23px;
    		}
    	<?php } else { ?>
    		body {
    			background-color: lightblue;
    		}
    		#user-body {
    			max-width: 1000px;
    			text-align: center;
    			margin-left: auto;
    			margin-right: auto;
    			background-color: white;
    		}
    	<?php } ?>
    </style>
    <?php }
    add_action( 'wp_head', 'style_change');
    
    ?>

    body-include.phpです

    <div id="user-body">

    footer-include.phpです

    </div> <-- user-body />

    だいたいうまくいくのですが、テーマ自体が横幅を固定していると、ダメですね。
    そこで、

    .fix-width {
    	max-width: 1000px;	
    	text-align: center;
    	margin-left: auto;
    	margin-right: auto;
    }

    も追加したのですが、

    Lightningのトップページスライドショーや、
    Lightningのトップメニューのスクロールした場合のポップアップや、
    Wordpress標準のカバー機能でうまくいきません。

    それらについても、幅に収めたい場合、どのようにすればよろしいでしょうか?
    なにか、少しでも、アイデアお願いいたします。

    • このトピックはsyntaroが1年、 8ヶ月前に変更しました。
1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック投稿者 syntaro

    (@syntarou)

    スライドショーは対応できませんでしたが、
    カバーの設定(画面のプルダウンメニュ-)の全幅をなしに設定したところうまくいきました。

    お邪魔しました。

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック「横幅の最大を決め外側をカラー付けしたい(Lightning無償版)」には新たに返信することはできません。