The following function is pluggable as it contains a filter :
// Make function pluggable/overwritable
if ( ! function_exists( 'wpsight_layout_images' ) ) {
function wpsight_layout_images() {
$layout_images = array(
'show_on_single' => true,
'size_archive' => 'post-thumbnail',
'align_archive' => 'left',
'size_single' => 'post-thumbnail',
'align_single' => 'left',
'size_widget' => 'post-thumbnail',
'align_widget' => 'left',
'size_archive_listings' => 'post-thumbnail',
'align_archive_listings' => 'right',
);
return apply_filters( 'wpsight_layout_images', $layout_images );
}
}
My question is the following. Lets say I need to change the value of the two last variables size_archive_listings
and align_archive_listings
using the filter. Do I have to copy over the whole function or can some variables be changed independently ? What is the proper of using add_filter
from a child theme functions file in this situation ?
if( function_exists() )
, letting it be defined in a file that loads before the one which contains this code. the fact that it also contains a filter is unrelated to it being pluggable.