网站footer底部版权备案信息修改

/ 0评 / 1

目的:更改底部版权备案信息显示,尽量保证居中显示

原主题自带样式代码:

<footer class="footer">
    <section class="container">
        <?php wp_nav_menu(
            array(
                'container' => false,
                'theme_location' => 'footer_nav',
                'depth' => 0
            )
        ); ?>
        <div style="display: flex;justify-content: space-between;">
            <div class='left'>
                <span>&copy; <?= date('Y') ?> <a href="<?= get_bloginfo('url') ?>"><?= get_bloginfo('name') ?></a></span>
                <?php if (get_option('zh_cn_l10n_icp_num')) { ?>
                    <span> . <a href="http://www.beian.miit.gov.cn" target="_blank"><?= get_option('zh_cn_l10n_icp_num') ?></a></span>
                <?php } ?>
            </div>
            <div class='right'>
                <span>Theme by <a href="https://biji.io" target="_blank">Adams</a></span>
            </div>
        </div>
    </section>
</footer>

修改后

<footer class="footer">
    <section class="container">
        <?php wp_nav_menu(
            array(
                'container' => false,
                'theme_location' => 'footer_nav',
                'depth' => 0
            )
        ); ?>
        <div style="display: flex;justify-content: space-between;">
            <div class='left'>
                <span>&copy; 2022-<?= date('Y') ?> <a href="https://zou16.com" target="_blank">zou16.com</a></span>
					  <span>版权所有 ICP证:<a href="https://beian.miit.gov.cn" target="_blank">渝ICP备2022003065号-1</a></span>
                <?php if (get_option('zh_cn_l10n_icp_num')) { ?>
                    <span><a href="http://www.beian.miit.gov.cn" target="_blank"><?= get_option('zh_cn_l10n_icp_num') ?></a></span>
                <?php } ?>
            </div>
            <div class='right'>
				     <span>驱动 by <a href="https://wordpress.org/" target="_blank">Wordpress</a></span>
                <span>Theme by <a href="https://biji.io" target="_blank">Adams</a></span>
            </div>
        </div>
	    </section>
</footer>

因为信息太多,而且原样式分开了左右,导致在其他设备访问时会出现左右各自跳行的问题,再次修改

<footer class="footer">
    <section class="container">
        <?php wp_nav_menu(
            array(
                'container' => false,
                'theme_location' => 'footer_nav',
                'depth' => 0
            )
        ); ?>
        <div style="display: flex;justify-content: space-between;">
                <span>&copy; 2022-<?= date('Y') ?> <a href="http://zou16.com" target="_blank">zou16.com</a></span>
			        <span>版权所有</span>
					  <br /><span>ICP证:<a href="https://beian.miit.gov.cn" target="_blank">渝ICP备2022003065号-1</a></span>
                <br /><span>Theme by <a href="https://biji.io" target="_blank">Adams</a></span>
			<p>&copy; 2022-<?= date('Y') ?> | <a rel="nofollow" href="https://beian.miit.gov.cn/" target="_blank">渝ICP备2022003065号-1</a>Theme by <a href="https://biji.io" target="_blank">Adams</a></p>
         </div>
	    </section>
</footer>

始终达不到想要的效果,没办法,作为程序小白,只能看一看其他网站的源代码,尽量找一个符合自己想要的网站底部footer代码,copy过来再慢慢修改,最终效果应该可以了

<footer class="footer">
    <section class="container">
        <?php wp_nav_menu(
            array(
                'container' => false,
                'theme_location' => 'footer_nav',
                'depth' => 0
            )
        ); ?>
        <div style="display: flex;justify-content: center;">
<p>&copy; <?= date('Y') ?> | <a rel="nofollow" href="https://beian.miit.gov.cn/" target="_blank">渝ICP备2022003065号-1</a> | Theme by <a href="https://biji.io" target="_blank">Adams</a></p>
         </div>
	    </section>
</footer>

要注意原样式用到的左右分散居中对齐的问题,虽然看不懂,但是在保证大格式不变的前提下,把

<div style="display: flex;justify-content: space-between;">

修改为

<div style="display: flex;justify-content: center;">

不知道是不是这样,但是好像可以用了?

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注