Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter kyledoesit

    (@kyledoesit)

    I found it, I had to edit 2 files.
    /wp-content/plugins/foodlist/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Controller/activationcontroller.php
    and
    /wp-content/plugins/foodlist/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Controller/commoncontroller.php

    I changed
    add_image_size('fl-menu-item-thumb', 100, 100, true);
    to
    add_image_size('fl-menu-item-thumb', 100, 100, false);

    Plugin Author Denis V (Artprima)

    (@v-media)

    It is not a good idea to edit the sources, as you will have problems with updating the plugin. Instead you should create your own shortcode that is used in the template. Here the proper way how to make your own thumbnail shortcode (this is a brief instruction and it will require php skills):

    1. Register your own image_size in your theme’s functions.php
    2. Find the following file:
    \foodlist\lib\Foodlist\Project\WordPress\Plugin\Foodlist\Generic\Shortcode\Internal\MenuItemThumbnailShortcode.php
    3. Create a copy of it in your theme folder and modify by setting your own namespace.
    3a. Change the image_size to the one you created in the first step.
    3b. Change the tag menu_item_thumbnail to some other unique name.
    4. Register your new shortcode placing the following code in functions.php:

    function my_register_thumbnail_shortcode(\Artprima\Text\ShortcodeManager $sm) {
        $sm->registerShortcode(new \YourNamespace\MenuItemThumbnailShortcode());
    }
    add_action('foodlist_register_menuitem_shortcode', 'my_register_thumbnail_shortcode');

    5. Change the shortcode tag in the template section of Foodlist settings.

    If you do everything properly, you will be able to use your own image size with the needed crop setting.

    Thread Starter kyledoesit

    (@kyledoesit)

    I’m looking in to that now, would it be possible to do it like this?

    add_action('init', 'remove_then_add_image_sizes');
    
    function remove_then_add_image_sizes() {
    	remove_image_size('fl-menu-item-thumb');
    	add_image_size('fl-menu-item-thumb', 100, 100, false);
    }
    Plugin Author Denis V (Artprima)

    (@v-media)

    You can try, but my solution is guaranteed to work, while I cannot guarantee that yours one will. Did you try my solution?

    Thread Starter kyledoesit

    (@kyledoesit)

    I did not, but this one appeared to work. I tried to do the solution that you said but I got a little lost hahah. I am working on creating a theme that requires your plugin and this code worked perfectly.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different menu item image sizes’ is closed to new replies.