How to Use a Library Item in Divi’s Mega Menu

How to Use a Library Item in Divi’s Mega Menu

In this webinar, we discuss ways to reverse engineer Divi’s features and use various Divi modules in places that they’re not typically used in. While most of Divi’s modules are somewhat restricted in their usage, the webinar shows you new ways that you can manipulate the modules for a truly unique web design.

In the webinar you’ll learn how to:

  • Use a Divi library item as mega menu
  • Encapsulate the comments section of a single post into a toggle


Watch the replay here:

Reverse Engineering Divi’s Mega Menu

For some reason, the PHP code for this tutorial does not display correctly as preformatted text. As a workaround, we’ve added the code as TextEdit documents in a .zip folder that you can download and use. Simply download and unzip the .zip file, copy the respective jQuery and PHP code from each of the TextEdit documents and proceed with the tutorial as instructed.

Creating a Comment Toggle

jQuery Code

$("#comment-wrap").wrap("<div class='comment-toggle-container et_pb_module et_pb_toggle et_pb_toggle_item et_pb_toggle_close'><div class='et_pb_toggle_content comment-toggle clearfix'></div></div>");

$("<h5 class='et_pb_toggle_title'>Click for Comments</h5>").insertBefore(".comment-toggle");


The Reverse Engineering Divi’s Features webinar was just a small taste of the incredible knowledge that SJ James has to offer! As one of the trailblazers in the Divi community, SJ James has years of experience with the Divi framework and certainly knows how to work well with it.

If you loved the content of the webinar and loved learning from SJ, then have a look at our online course!

Divi Space has recently launched the Transforming Divi with CSS & jQuery Course, and our students are loving the coursework! We had such an incredible response to the first round of the course, that we decided to open doors for a second enrollment. If you missed the first intake, you can enroll now!

  • Private Facebook Group
  • Introduction to CSS
  • Introduction to jQuery
  • Five real-world examples where custom CSS has been used to make Divi better
  • The jQuery Cheat Sheet
  • Moving & Replacing with jQuery
  • Preparing a child theme for jQuery & CSS
  • Testing assignments
  • Advanced quizzes
  • Bonus: Inserting Layouts in Template Pages
  • Bonus: Editing Modules

For more information about the Transforming Divi with CSS and jQuery course, read this blog post or sign up now!

Lisa-Robyn Keown

Lisa-Robyn is a qualified copywriter and brand strategist from Cape Town, South Africa.