覆盖子文件夹中的Wordpress父主题blog.php

覆盖子文件夹中的Wordpress父主题blog.php,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我正在研究一个儿童主题。父主题有一个单页模板。安装polylang后,我想覆盖父主题blog section.php,因为我需要用其他语言(如西班牙语)显示“阅读更多”,而不是总是用英语显示 父主题中的博客PHP如下所示: layouts->blog-section.php; blank-section.php; etc. 我尝试创建一个名为layouts的新文件夹,并将自己的blog section.php粘贴到子主题文件夹中。我更改了子主题blog部分.php中的一些代码。我试了好几

我正在研究一个儿童主题。父主题有一个单页模板。安装polylang后,我想覆盖父主题
blog section.php
,因为我需要用其他语言(如西班牙语)显示“阅读更多”,而不是总是用英语显示

父主题中的博客PHP如下所示:

layouts->blog-section.php;
blank-section.php;
etc.
我尝试创建一个名为layouts的新文件夹,并将自己的
blog section.php
粘贴到子主题文件夹中。我更改了子主题
blog部分.php
中的一些代码。我试了好几次,但都没变

我从谷歌上读到了关于这些钩子等功能的信息,但我不知道在这种情况下如何使用它。我重写css,并将其他函数添加到我的函数文件中。那些工作

当模板位于父主题的子文件夹下时,有人能给我一些建议吗?父主题名称为accesspress parallax。子项名称为accesspress视差子项。提前谢谢你的建议

父主题主页:

<?php
/**
 * Template Name: Home Page
 *
 * @package accesspress_parallax
 */

get_header();

$sections = of_get_option('parallax_section');

if(!empty($sections)):
foreach ($sections as $section) :
    $page = get_post( $section['page'] ); 
    $overlay = $section['overlay'];
    $image = $section['image'];
    $layout = $section['layout'];
    $category = $section['category']; 
    $googlemapclass = $layout == "googlemap_template" ? " google-map" : "";
?>

<?php if(!empty($section['page'])): ?>
    <section class="parallax-section clearfix<?php echo $googlemapclass." ".$layout;  ?>" id="<?php echo "section-".$page->ID; ?>">
    <?php if(!empty($image) && $overlay!="overlay0") : ?>
        <div class="overlay"></div>
    <?php endif; ?>

    <?php if($layout != "googlemap_template") :?>
        <div class="mid-content">
    <?php endif; ?>
        <?php  
            $query = new WP_Query( 'page_id='.$section['page'] );
            while ( $query->have_posts() ) : $query->the_post();
        ?>
            <?php 
            if($layout != "action_template" && $layout != "blank_template" && $layout != "googlemap_template"): ?>
                <h1><span><?php the_title(); ?></span></h1>

                <div class="parallax-content">
                <?php if(get_the_content() != "") : ?>
                    <div class="page-content">
                    <?php the_content(); ?>
                    </div>
                <?php endif; ?>
                </div> 
            <?php endif; ?>
        <?php 
            endwhile;    
        ?>

                <?php 
                    switch ($layout) {
                        case 'default_template':
                            $template = "layouts/default";
                            break;

                        case 'service_template':
                            $template = "layouts/service";
                            break;

                        case 'team_template':
                            $template = "layouts/team";
                            break;

                        case 'portfolio_template':
                            $template = "layouts/portfolio";
                            break;

                        case 'testimonial_template':
                            $template = "layouts/testimonial";
                            break;

                        case 'action_template':
                            $template = "layouts/action";
                            break;

                        case 'blank_template':
                            $template = "layouts/blank";
                            break;

                        case 'googlemap_template':
                            $template = "layouts/googlemap";
                            break;

                        case 'blog_template':
                            $template = "layouts/childblog";
                            break;

                        default:
                            $template = "layouts/default";
                            break;
                    }
                ?>

                <?php include($template."-section.php");?>

        <?php if($layout != "googlemap_template") :?>
        </div>
        <?php endif; ?>
    </section>
<?php
endif; 
endforeach;
endif;
?>

<?php get_footer(); ?>


顺便说一下,Florian Lemaitre编辑部的tks。现在清楚多了。不知道法国人的英语这么好XD
<?php
/**
 * The template for displaying all Parallax Templates.
 *
 * @package accesspress_parallax
 */
?>

<div class="blog-listing clearfix">
<?php 
    $args = array(
        'cat' => $category,
        'posts_per_page' => 3
        );
    $count_service = 0;
    $query = new WP_Query($args);
    if($query->have_posts()):
        $i = 0;
        while($query->have_posts()): $query->the_post();
            $i = $i + 0.25;
    ?>

    <a href="<?php the_permalink(); ?>" class="blog-list wow fadeInDown" data-wow-delay="<?php echo $i; ?>s">
        <div class="blog-image">
        <?php if(has_post_thumbnail()) : 
        $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'blog-thumbnail'); ?>
            <img src="<?php echo esc_url($image[0]); ?>" alt="<?php the_title(); ?>">
        <?php else: ?>
            <img src="<?php echo get_template_directory_uri(); ?>/images/no-image.jpg" alt="<?php the_title(); ?>">
        <?php endif; ?>
        </div>
        <div class="blog-excerpt">
        <h3><?php the_title(); ?></h3>
        <h4 class="posted-date"><i class="fa fa-calendar"></i><?php echo get_the_date(); ?></h4>
            <?php echo accesspress_letter_count( get_the_excerpt(), 200 ); ?> <br />
        <span><?php _e('**Read more**','accesspress-parallax') ?>&nbsp;&nbsp;<i class="fa fa-angle-right"></i></span>
        </div>
    </a>

    <?php
        endwhile;
        wp_reset_postdata();
    endif;
?>
</div>
<div class="clearfix btn-wrap">
    <a class="btn" href="<?php echo get_category_link($category)?>"><?php _e('Read more','accesspress-parallax'); ?></a>
</div>