Add Pages & related images to the megamenu

Posted in: Newspaper
Post count: 35

Hello,

I would like to display in my megamenu some pages & their associated featured image, just like it is possible to display images for posts.
Is this doable?

many thanks

http://le-meilleur-du-golf.com/

Post count: 7909

Hi,

Unfortunately there is no option for this. The MegaMenu works only with categories and get posts and featured images from there.

Thanks!

Post count: 35

Hi Alin,

Is there a plan for Newspaper to go there in a close future? I believe Newsmag has the ability already?
any thoughts?
thanks a lot

Post count: 6600

Hi,

The newsmag theme has the option to create and set a page to be used by the mega menu: https://forum.tagdiv.com/menus-newsmag/
This feature will be available in newspaper also from version 5 of the theme.

Thanks

Post count: 17

Hi,
struggling for this to work in newsmag I found two alternatives I would like to share:

1. Do the same as this,
but add one item to the array named ‘installed_post_types’ with the post-types needed:
‘installed_post_types’=>’post,page’

This approach has the disadvantage of touching the theme source code.

2. This is kind of tricky: create a child-theme and a new folder named ‘override’ or whatever. Copy td_block_mega_menu.php to that folder (Note that this file is internal and is not overriden by the general child theme method described in the documentation). In that copy, change render method to add ‘installed_post_types’ to the array before performing the query as in the previous paragraph.
Now, in your functions.php create a hook for ‘after_setup_theme’. This will be get called after parent newsmag/newspaper theme is finished.
Then you will have to change the api file for the megamenu block, invoking td_api_block::update_key (‘td_block_mega_menu’,’file’,FULLPATHTOMYNEWFILE);
Now when a megamenu is to be created, the overriden file is chosen instead of the core one.
This method is valid for updating some api blocks and files without touching parent theme.

P.D. Forgot to mention, first of all you should add category taxonomy to pages, using a plugin or in child-theme with register_taxonomy_for_object_type

Best regards

  • This reply was modified 11 years by mpindado.
  • This reply was modified 11 years by mpindado. Reason: wrong link
Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.