douwu7563 2015-08-20 20:16
浏览 52

在子主题上添加功能后页面不显示

I am using Genesis framework and modern-studio-pro as a child theme. I have just copy this code

function genesis_standard_loop() {

//* Use old loop hook structure if not supporting HTML5
if ( ! genesis_html5() ) {
    genesis_legacy_loop();
    return;
}

if ( have_posts() ) :

    do_action( 'genesis_before_while' );
    while ( have_posts() ) : the_post();

        do_action( 'genesis_before_entry' );

        printf( '<article %s>', genesis_attr( 'entry' ) );

            do_action( 'genesis_entry_header' );

            do_action( 'genesis_before_entry_content' );

            printf( '<div %s>', genesis_attr( 'entry-content' ) );
            do_action( 'genesis_entry_content' );
            echo '</div>';

            do_action( 'genesis_after_entry_content' );

            do_action( 'genesis_entry_footer' );

        echo '</article>';

        do_action( 'genesis_after_entry' );

    endwhile; //* end of one post
    do_action( 'genesis_after_endwhile' );

else : //* if no posts exist
    do_action( 'genesis_loop_else' );
endif; //* end loop

}

from Genesis to child theme functions.php. After that my site is showing

Fatal error: Cannot redeclare genesis_standard_loop() (previously declared in /home/u282646374/public_html/wp-content/themes/modern-studio-pro/functions.php:198) in /home/u282646374/public_html/wp-content/themes/genesis/lib/structure/loops.php on line 115

I have delete that code from child theme but site not showing. Please tell me how can i regain my site? This is the link of my page http://andrewspalding.co.uk/

  • 写回答

1条回答 默认 最新

  • dongpengqin3898 2015-08-20 21:09
    关注

    Your problem is that you are redeclaring the function genesis_standard_loop() inside functions.php of your child theme while on the main genesis theme this function is inside lib/structure/loops.php child themes will overwrite the parent theme functions if they are inside the same file that they are in the parent theme, if you want to modify a function from the parent theme you might contemplate the idea of looking for filters or actions.

    If you MUST redeclare the function try recreating the same file structure, but remember to add all of the other functions inside that particular file.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大