New WordPress Theme Submission Requirement?

Even builder by themes Dojo, uses shortcodes which are part of a plugin

To create the shortcodes in a plugin, put the function which holds the shortcodes into a new files, name it themename_shortcodes.php, put in a folder called themename_shortcodes and then add the plugin header

By putting Custom post types and shortcodes in a plugin you are future proofing your theme for your buyers, making it easy for them to switch themes.

The shortcodes don’t need to be styled when not in your theme, but they have to still work.

1 Like

That seems to be the main gripe, there isn’t a definitive list from Envato on what the requirements are, it’s a bit of a lottery to get an item accepted as it depends on who is reviewing.

2 Likes

I understand what you say @Gareth_Gillman . I think we need a feedback from Envato about this idea with shortcodes into a plugin .
And if I have a prefix like “thz_” I did not used it in other themes, is unique, I could have problems?
I think it’s a stupid idea to have a prefix like “mytheme_mycompany_” … plus it’ll kill a lot of time to change.
Thank you,

For those thinking about frameworking prefixing - solution to have the framework as a separate plugin?

seen some authors do this, using TGMPA you can make a plugin a “must install” so that would probably work for buyers and authors.

This theme appeared today in ThemeForest Market. They have a video installation. As you can see there is not shortcode plugin. All it’s very abstract. I’ll try my luck without plugin. :smile:

Not all themes are using shortcodes, some put the theme features in page templates instead… you won’t get accepted with shortcodes in the theme… I can guarantee that as it will also fail the WordPress.org theme check, which Themeforest reviewers check

@Gareth_Gillman, I bought one of the last themes right now, I checked with the “theme check” and has this message : " WARNING: The theme uses the add_shortcode() function. Custom post-content shortcodes are plugin-territory functionality. "Envato probably not consider this as an error.

Wierd, they shouldn’t be passing the review… hmmmm - unless Envato haven’t started using the second stage guidelines yet.

I still wouldn’t put them in the theme, put them in the plugin, it’s just much easier to manage them and it’s better for your buyers.

Now I’ll try to put them in a plugin I hope not see errors :-S …

Update : shortcodes.css put it in plugin? Or I can leave in theme … However there are many other .js files for shortcodes styles. I still did not understand the logic if they have no design without my theme.

You don’t have too put the css and js in the plugin but I would do it so the content keeps working and looking similar if the user changes the theme.

The logic is this, if they have shortcodes in their content and they are tied to the theme, they then decide to change theme, the content will have [my_shortcode] all over the place, ruining the website content. By adding shortcodes into plugins, when they do this the content will still look the same, then it’s upto them to style the shortcode content (if it’s not provided in the plugin).

It also means, if the buyer doesn’t want to use your shortcodes, they just don’t install the plugin, which means the theme is “lighter”.

I think the end goal is to take WordPress themes back to being themes, any functionality for the theme is added via a plugin.

1 Like

Seems like we need to comply to all themecheck requirements - regardless of the themeforest extension and the stuff on requirements page.

That’s been my experience anyway. Except one reviewer said the exceptions on the requirement page is ok another not.

So seems best to comply with the highest bar in order to pass the review - of cause a high bar is not a bad thing - just so long as we know what that is :slight_smile:

And sometimes we need some resources on certain topics as I can’t always find much information - just see the amount of confusion on the forums.

Okay I made this plugin.
I hope everyone will be happy and those from Envato and customers. :joy:
Thanks for all answers @Gareth_Gillman

good job :smile:

1 Like

Anyone know about the using fopen? The requirements allow it, but I’ve been rejected for it. Problem is, this is what he wordpress importer uses that so many of us use in themes. It will have to be rewritten…

You can use wp_remote_get() for getting contents of file.

// File path
$file_name = get_template_directory_uri() . '/includes/your-file.json';

// Get remote file
$response = wp_remote_get( $file_name );

// Check for error
if ( is_wp_error( $response ) ) {
	return;
}

// Parse remote file
$data = wp_remote_retrieve_body( $response );

// Check for error
if ( is_wp_error( $data ) ) {
	return;
}

// Do stuff with data
// E.g. parse a json file
$foo = json_decode( $data, true );

Also check WP Filesystem API for more file/folder operations: https://codex.wordpress.org/Filesystem_API

Thanks very much for your reply. However I’m ok with how to use these functions. The problem is I don’t know how to convert the parser.php file for the wordpress-importer.

In particular:

	$fp = $this->fopen( $file, 'r' );
	if ( $fp ) {
		while ( ! $this->feof( $fp ) ) {
			$importline = rtrim( $this->fgets( $fp ) ); 

I’m sure I can figure something out with some research but If someone has figured this out already then… :slight_smile:

function fopen( $filename, $mode = 'r' ) {
	if ( $this->has_gzip ) {
		return gzopen( $filename, $mode );
	}

	return fopen( $filename, $mode );
}

For those interested - remove the fallback and refer users to use the Wordpress Importer plugin instead

@ThemeSphere +1

@mad_dog , have you heard back about the prefixing?