Unlocking Premium Elements in GeneratePress: A Simple WordPress Hack

Estimated Reading Time: 2 min

Rate this post

If you’re using the GeneratePress theme and want to ensure the premium elements section remains open in your WordPress admin panel, a small tweak to your functions.php file can do the trick!

By default, the GeneratePress Premium Elements section may collapse, requiring you to expand it every time. However, with the following snippet, you can force it to stay open:

How to Implement This Fix

  1. Log into your WordPress dashboard.
  2. Navigate to Appearance > Theme Editor (or use an FTP client).
  3. Open your functions.php file.
  4. Add the following code snippet at the bottom:
add_action( 'admin_head', function() {
	echo '<style>#generate_premium_elements.closed .inside {display: block;}</style>';
} );
  1. Click Update File to save the changes.

How This Works

This code snippet hooks into admin_head, which allows us to inject CSS into the WordPress admin panel. The added CSS ensures that the .inside section of #generate_premium_elements remains visible even if it was previously collapsed.

Final Thoughts

This is a simple but effective tweak to improve your workflow inside the WordPress admin panel. If you want to revert the change, just remove the snippet from your functions.php file.

Update Improved Version ! 🚀

Your code snippet is using add_action( 'admin_head', function() {...} ); to inject a small CSS rule into the WordPress admin panel. However, if your goal is to ensure the #generate_premium_elements section remains open in the WordPress admin panel, then your CSS is slightly incorrect.

🔹 Fix & Improved Version

Here’s an improved version of your code:

add_action( 'admin_head', function() {
    ?>
    <style>
        #generate_premium_elements.closed .inside {
            display: block !important;
            height: auto !important;
            overflow: visible !important;
        }
    </style>
    <?php
} );

🔹 Explanation & Fixes

Added !important to Ensure Priority

  • WordPress admin styles might override your CSS. Using !important ensures it applies correctly.

Ensured Visibility with height and overflow

  • height: auto !important; allows the content to expand naturally.
  • overflow: visible !important; ensures no hidden content.

Maintains WordPress Standards

  • Wrapped CSS inside a proper PHP function with add_action('admin_head', function() { ... }); to keep it clean.

🎯 Result

This will force open the #generate_premium_elements section in the WordPress admin panel, preventing it from being collapsed.

✅ Let me know in the comments if you need further modifications! 🚀🔥

Photo of author

Flora

Unlocking Premium Elements in GeneratePress: A Simple WordPress Hack

Published

I am Flora, the publisher and founder of *Be-Smart*, a platform dedicated to sharing insights and inspiration for living a fulfilling life. With a strong background in the web, my goal is to empower people to genuinely recognize and celebrate admirable actions big or small in themselves and others.

Leave a Comment