如何将店面主题页脚小部件移出页脚行?

How to move Storefront theme footer widgets out of the footer row?

Storefront 主题 footer.php 文件具有将页脚小部件和页脚信用一起插入的操作。这是代码部分

    <footer id="colophon" class="site-footer" role="contentinfo">
        <div class="col-full">

            <?php
            /**
             * Functions hooked in to storefront_footer action
             *
             * @hooked storefront_footer_widgets - 10
             * @hooked storefront_credit         - 20
             */
            do_action( 'storefront_footer' );
            ?>

        </div><!-- .col-full -->
    </footer><!-- #colophon -->

我想将 storefront_footer_widgets 部分移出容器 <div class="col-full"> 并将其插入另一个容器上方的新容器 <div class="new-row"> 中。所以新的结构是这样的:

<footer id="colophon" class="site-footer" role="contentinfo">
        <div class="new-row">
            @hooked storefront_footer_widgets - 10
        </div>
        <div class="col-full">
            @hooked storefront_credit         - 20
        </div><!-- .col-full -->
    </footer><!-- #colophon -->

我该怎么做?

你应该可以这样拆分。我没有测试,但应该可以。

首先将这些添加到您的子主题的 functions.php

add_action( 'storefront_footer1', 'storefront_footer_widgets', 10 );
add_action( 'storefront_footer2', 'storefront_credit', 10 );

然后你可以在自定义中调用它们footer.php

<footer id="colophon" class="site-footer" role="contentinfo">
  <div class="new-row">
  <?php
    do_action( 'storefront_footer1' );
  ?>
  </div>
  <div class="col-full">
  <?php
    do_action( 'storefront_footer2' );
  ?>
  </div><!-- .col-full -->
</footer><!-- #colophon -->