Where to place modified code?
-
// Set the dfi in cache. $meta_cache['_thumbnail_id'][0] = apply_filters( 'dfi_thumbnail_id', $dfi_id, $object_id ); wp_cache_set( $object_id, $meta_cache, 'post_meta' );
Found this line in the plugin (searching for ‘dfi_thumbnail_id’) Would I place the additional code above or below this … or within functions.php? (‘dfi_thumbnail_id’ doesn’t appear in function.php – maybe another core? – or perhaps it only relates to your app’s php code)
function dfi_category ( $dfi_id, $post_id ) { if ( has_category( 'Free Section', $post_id ) ) { ... .. . } } add_filter( 'dfi_thumbnail_id', 'dfi_category', 10, 2 );
** Out of curiousity, what do the “10” and “2” relate too (if not too technical!)
I’m also wondering if this add_filter will mean that WHENEVER it finds a post in that category, it will use that image. If poss, I’d like it to be “conditional”, ie if the post does have a feature image attached, use that, otherwise, substitute the default as set by function above
(Don’t want much, do I !!)
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Where to place modified code?’ is closed to new replies.