How to Remove Projects from Extra by Elegant Themes

Hint: it IS just like doing it for Divi

By Josh Robbs
November 14, 2018
Filed under:
Skill level: Apprentice
Task: Remove "Project" post type from Extra Theme
You need:
  • A self-hosted WordPress website
  • The Extra theme
  • A child theme or custom plugin to house your code

Questions Answered

  1. How do you remove projects from the Divi theme?
  2. How do you remove projects from the Extra theme?
  3. Are projects removed from Extra the same way as from Divi?

I like the Extra theme from Elegant Themes, but it's not perfect. An example of something I don't love is that the Project post type is created automatically whether you want it or not. This tutorial will show you how to remove projects from Extra.

Why would you remove projects? If you aren't going to use, get rid of it. People are going to mess with it. If it's there, people are going to ask about it. Plus, it's extra clutter. Pun intended.

Existing solutions

You can easily find how to hide or remove the Projects post type from Divi. It just takes a quick trip over to Google. But I couldn't find a solution for the Extra theme. Why not? Here are some possibilities.

  1. There isn't 1.
  2. No one wrote it down.
  3. It's hard to find because the theme name, Extra, is a common word.
  4. The solution is the same for Extra as it is for Divi.

I'm guessing the answer is a combination of 2, 3, and 4. But I had to test the code to see if option 4 was true.

The original code for Divi

I found some code for removing the Project post type from Divi over at Mad Lemmings.

The code keys off a function named et_pb_register_posttypes. Sure enough, that function exists in Extra, too.

The test and results

I added the script to my child theme's functions.php file, saved it, and reloaded the site's admin section.

Poof! Projects were gone. I poked around the site and everything (well, everything except for projects) seemed to be working fine.

The standard edit your code at your own risk disclaimer

Whenever you edit your code, you risk breaking breaking something. That is why should never work on your live website.

Steps you can take to protect yourself in case something goes wrong:

  1. Back up the site.
  2. Make copies of the files you're editing.
  3. Test your work on a development/staging site.
  4. Theme customization should be done to a child theme.
  5. Edit via external text editor. If you are editing via WordPress and WordPress goes down, you can't fix your error.
  6. Put custom code in your own plugin. Do not make edits to existing plugins.
Learn more about adding code to your website safely.

The code


if ( ! function_exists( 'et_pb_register_posttypes' ) ) :
	function et_pb_register_posttypes() {
		global $wp_post_types;
		if ( isset( $wp_post_types[ $post_type ] ) ) {
			unset( $wp_post_types[ $post_type ] );
			return true;
		}
	return false;
	}
endif;

Where to put the code

This code is only useful if you're using the Divi or Extra themes. This code should be added to the functions file of your child theme or in a plugin you've created for Divi specific code.

Be sure to leave a comment if you have any questions or, well, comments.

Useful?

Useful? Wow, that's tragic. That might be the worst newsletter pitch headline I've ever written.

As unsexy as it may be, my goal for this site is to be simple and useful. If you'd like to know when I add a new article, get on the list.

It's an automated newsletter that will notify you when I make a new post - once a week at most. The closest you'll get to a sales pitch is when I announce webinars.

Josh started WP Master Builder to help small businesses get more done on their website in less time. He’s also a marketer and designer. There’s always a chance that he’s watching “Sky Captain and the World of Tomorrow” again or helping his wife build pipe lamps.

Submit a Comment

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Learn something?

Share it so others can use it too!