php - Overriding a Wordpress parent function that isn't tied to any actions -
i have parent theme function follows:
/*-----------------------------------------------------------------------------------*/ /* 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 } i want edit markup function outputs. @ first thought i'd need utilise actions/filters somehow filter output. on closer inspection, function doesn't seem tied actions, , called straight template file loop-portfolio.php:
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; ?> so question is, duplicate loop-portfolio.php kid theme, , alter function phone call different function? seems work i'm checking there's not improve way this. thanks.
if parent function doesn't offer filter hook alter markup nor encapsulated within if(!function_exists(func)) {} (known pluggable function), yes, kid theme + new function way go.
php wordpress wordpress-theming customization
No comments:
Post a Comment