Php 重写不为';不要拘泥于任何行动

Php 重写不为';不要拘泥于任何行动,php,wordpress,wordpress-theming,customization,Php,Wordpress,Wordpress Theming,Customization,我有一个父主题函数,如下所示: /*-----------------------------------------------------------------------------------*/ /* Display first image linked portfolio */ /*-----------------------------------------------------------------------------------*/ function ct_fi

我有一个父主题函数,如下所示:

/*-----------------------------------------------------------------------------------*/
/* Display first image linked portfolio */
/*-----------------------------------------------------------------------------------*/

function ct_first_image_linked_portfolio() {
    $photo = ct_get_post_image();
    global $ct_options;
    global $post; ?>
    <figure>
        <div><?php the_post_thumbnail('large'); ?></div>
        <figcaption>
            <h3 class="marB0"><?php the_title(); ?></h3>
            <span><?php the_author(); ?></span>
            <a href="<?php the_permalink() ?>">View</a>
        </figcaption>
    </figure>
<?php }

所以我的问题是,我是否只是将loop-portfolio.php复制到我的子主题中,然后将函数调用更改为其他函数?这似乎是可行的,但我正在检查没有更好的方法来做到这一点。谢谢。

如果父函数不提供任何更改标记的功能,也没有封装在
中,如果(!function_exists(FUNC)){}
(称为可插拔函数),则是的,子主题+新函数是一种选择

while ( $query->have_posts() ) : $query->the_post(); ?>

    <li class="<?php ct_first_term(); ?> item col span_4">
        <?php ct_first_image_linked_portfolio(); ?>
    </li>   

<?php endwhile; ?>