• Resolved lcsternstrategy

    (@lcsternstrategy)


    I need to have a featured image for menus themselves, not just the menu items. I’ve added this functionality by adding thumbnail support for the Menu custom post type in the cpts.php file, but would love it if this change was incorporated in the core so I didn’t hack it.

    Thanks! I’m really hoping this plugin will work out for the project we’re working on.

    https://www.ads-software.com/plugins/food-and-drink-menu/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi lcsternstrategy,

    You can use the fdm_menu_args filter to adjust the custom post type from your theme’s functions.php file or a custom plugin.

    If you’re not familiar with actions and filters, take a look at these docs on the WordPress codex. This might be a more accessible introduction to their use.

    In this case, you’d use code like this to modify the post type arguments:

    add_filter( 'fdm_menu_args', 'lcsternstrategy_add_menu_thumbnail' );
    function lcsternstrategy_add_menu_thumbnail( $args ) {
    	array_push( $args['supports'], 'thumbnail' );
    	return $args;
    }

    Beware I haven’t tested this code. If you run into problems just check it for syntax errors and make sure it all lines up.

    The filter runs early, so make sure you’re hooked in before the init call. If you’re building your own theme, the functions.php file is probably the best place for this.

    Thread Starter lcsternstrategy

    (@lcsternstrategy)

    Nate,

    Thanks for the quick response! That code as is actually worked perfectly to add a thumbnail to the menu! Cheers!

    Hi lcsternstrategy,

    Glad to hear it! The plugin is packed with hooks that allow you to filter a lot of things so you don’t need to make changes to the plugin itself. And there’s a whole templateing system as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Menu Thumbnail’ is closed to new replies.