I love coffee, but I typically only drink it as a fun drink once in a while. I drink water 99% of the time though. I keep my energy levels high by eating a variety of plant foods, getting adequate rest, and keeping a regular exercise routine.
This is probably a bit more than what you wanted, but here’s a breakdown of all the things you need to fix other than what’s already been mentioned.
For the wpt_events_date() function:
I’m assuming you’re properly adding the meta box via add_meta_box(). Doing so will pass the $post object directly to your function as the first parameter, so there’s no need for the global $post.
You should use the wp_nonce_field() function to create your nonce input instead of hardcoding the HTML for it.
You need to escape the $month and $date variables before adding them as an attribute for your input boxes.
I’d also prefix your name attributes instead of using eventmeta_nonce, _month, and _date in the inputs. Use a unique prefix like wpt_. I’d make sure all things going to $_POST are prefixed so there’s less risk of conflicts with anyone else’s code.
For the wpt_save_events_meta() function:
Use $post_id instead of $post->ID. No biggie, but you already have the data there in variable form.
You should check the edit_post_meta, add_post_meta, and/or delete_post_meta capabilities rather than the edit_post capability. Plus, a hardcoded edit_post is technically wrong; you’d need to use the post type object to check the actual capability, which might be different. But, you don’t need that cap. You need the post meta caps.
All $_POST data should be sanitized/validated before sending it to the database. The month should be sanitized to make sure it’s a one-/two-number value. The date should go through the same process to make sure it’s both the type of data you want and in the correct format.
There’s no need for worrying if the data is an array because a user won’t be passing you an array through a text input box. Nevertheless, with proper validation/sanitization, you wouldn’t need to worry about that anyway.
If you’re going to check if the post type is a revision, it should be done before your foreach loop.
Your if/else and if checks in your foreach loop should be if/elseif/elseif instead.
templattica said
greenshady saidYeah, because authors live in future and they just come here to make themes for 5 versions in advance…
Message to buyers: If you get an error when updating your theme, it most likely means your theme author done something wrong. You should not need to get confirmation from your theme author that it’s okay to update your copy of WordPress.Seriously, if something is made to work on 3.4 and when you bought it, it never said it’ll work with future versions, you don’t come here crying and go all-caps rage on authors because your template doesn’t work after you updated WP without even bothering to find out whether the template is compatible with latest version of WP or not. Though I don’t know how goes this whole migration thing with WP, but this was generally speaking…
I’ve coded themes for WordPress 2.3 that still work to this day with WordPress 3.5. I’ve been doing this thing a lot longer than most people here, so don’t feed me some line about not living in the future.
WordPress builds in backwards compatibility for everything. It also properly deprecates functions so that authors have many, many versions to update their code.
If your theme is properly coded, it will not break when WordPress updates. That’s why we have standards set in place to avoid this sort of problem.
neruda said
I was just wondering what kind of conflicts might arise so I know what to look for in case I run into trouble?
You shouldn’t run into any conflicts if your theme was properly coded.
Message to buyers: If you get an error when updating your theme, it most likely means your theme author done something wrong. You should not need to get confirmation from your theme author that it’s okay to update your copy of WordPress.
There aren’t 10 companies that offer true development frameworks. There’s a bunch of companies with themes that they call frameworks though.
Here’s one for you that you most definitely can use commercially: http://themehybrid.com/hybrid-core Also, check out this page: http://codex.wordpress.org/Theme_FrameworksI could’ve sworn I posted this earlier. I guess it didn’t go through.
But, here’s my framework, which is used by many theme companies and freelancers: http://themehybrid.com/hybrid-coreThe one and only theme I’ve uploaded here doesn’t support IE8 . It may work, but I’m not sure how it looks in IE8 because I’ve never checked it. I personally only support two versions of IE at any given time with my themes and those are currently IE9 and IE10 .
What’s the point of the checkboxes of supported browsers if support is required when uploading a theme here on TF?
Also, the stats the OP posted earlier are way off based on other stats I’ve seen.
Yeah, there’s nothing that says the user must have the plugin activated. That wouldn’t make sense.
I wouldn’t take the route you’re taking at all. I’d build the theme and integrate with the plugin if it is installed. Make it clear in your documentation that the user must install and activate the plugin to have that specific feature. This way, you’re not having to worry about any weird license issues and having to package an entire class for activating a plugin. That’s how I’d do it anyway.
It is unacceptable for a theme to not function correctly without a specific plugin. Themes should stand on their own regardless of what plugins are active.
Can your theme integrate with a certain plugin or plugins? Absolutely.
I’m not sure what ThemeForest’s policy is on this, but I hope they’re not allowing themes with plugin dependencies on their marketplace.
I’m assuming you’re referring to WordPress since you said “plugins” and “themes”.
My Members plugin (free) will give you a place to start in that regard: http://themehybrid.com/plugins/members
It doesn’t offer the exact functionality you’re after, but you could achieve it with roles rather than users. But, you’d probably still need a freelancer to customize some things for you if you don’t know your way around WordPress code.
Your question isn’t detailed enough for us to offer much more advice though.

Seriously, if something is made to work on 3.4 and when you bought it, it never said it’ll work with future versions, you don’t come here crying and go all-caps rage on authors because your template doesn’t work after you updated WP without even bothering to find out whether the template is compatible with latest version of WP or not. Though I don’t know how goes this whole migration thing with WP, but this was generally speaking…