1

I'm making a Wordpress theme that generate placeholder menus using the theme support "starter content". I read the documentation and is very vague: https://make.wordpress.org/core/2016/11/30/starter-content-for-themes-in-4-7/.

I want in my theme generate menus and them put images in each menu item using the plugin Menu Image. But I can't find a hook that executes after starter content generation and executes only once. The hooks I use the content is basically in customizer changeset and I can't access them using the normal Nav Menu API of WordPress.

What I can do in this case. Someone have some idea about it? Thanks!

0

1 Answer 1

0

I would start by making this part a plug-in for the theme. Then, look at all the code the source plugin provides. I am unfamiliar with this one but it looks to be ok. Find the actions and filters it introduces and use those to build your plugin. In fact I think on init you could do certainly add content.

4
  • None taken! The starter content is a theme support, I don't see reason that would be a plugin. What's the objective? The problem is which hook I should use. Being in the theme or in a plugin, it doesn't really matter. Commented Jun 15, 2019 at 1:55
  • Based on the fact that the content relies on another plugin this is the best approach. Commented Jun 15, 2019 at 2:32
  • 1
    Of course you could use the instruction you provided in your theme based on if that plugin exists. The instruction you provided is not vague. Maybe there is a more specific dilema I’m not seeing. Commented Jun 15, 2019 at 2:39
  • Thank you for the help, @NathanPowell! I think there's no native solution for this. Well. I understand your view for make a plugin. But I think I will do like storefront does, create a flag for theme to see if the starter content was applied, then select the menus and set the image using the normal WordPress API to does that. I think is a very specific thing I want (maybe it's too advanced) and I have to develop myself. If I dig something I post here. Thank you! Commented Jun 17, 2019 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.