• Resolved benjaminmattsson

    (@benjaminmattsson)


    Hi,

    I want to change some things in the plugin, for example the measurements. I’ve succesfully changed the wording in “class.cooked-measurements.php” but this is not the best way to do it since it will be replaced when updating the plugin, right?

    A comment says “Use the “cooked_measurements” filter to add your own measurements”. How do I do that? Where should I paste my edited code to override the plugins’ wording? Is it in my child themes function.php?

    Br,
    Benjamin

Viewing 1 replies (of 1 total)
  • Plugin Author Boxy Studio

    (@boxystudio)

    You would place this code either in your theme’s functions.php file (easy option) or create a custom plugin that includes the code (best option):

    add_filter( 'cooked_measurements', 'custom_cooked_measurements', 10, 1 );
    function custom_cooked_measurements( $measurements ){
    	$measurements['a'] = array(
    		'singular_abbr' => 'a',
    		'plural_abbr' => 'aa',
    		'singular' => 'custom a',
    		'plural' => 'custom a plural'
    	);
    	$measurements['b'] = array(
    		'singular_abbr' => 'b',
    		'plural_abbr' => 'bb',
    		'singular' => 'custom b',
    		'plural' => 'custom b plural'
    	);
        return $measurements;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Edit plugin without editing plugin files’ is closed to new replies.