[wp-hackers] Allowing theme to override plugin markup on data

John dailyrants at gmail.com
Thu Nov 7 18:17:17 UTC 2013


I've done this by checking if a template exists in the theme directory,
using locate_template( 'single-post-type.php' ), and if not loading
template parts from the plugin dir and/or filtering the_content. The
assumption being, if the theme isn't handling the custom post type template
stuff, my plugins needed to.

bbPress has a good example of modifying the template stack and loading them
from the plugin dir if they don't exist in the child or parent theme
directories. I think the function is named bbp_locate_template. See also
bbp_get_template_part.


On Thu, Nov 7, 2013 at 10:45 AM, Tom Barrett <tcbarrett at gmail.com> wrote:

> I'm writing a shortcode that is going to produce a list of items (oof!).
> It's a custom post type, with some meta. Pretty much a standard loop
> scenario.
>
> I'd like the shortcode to produce some basic output, and let the theme
> really jazz things up. Ideally I'd have the data available with no markup
> (for the theme) and then, if the theme doesn't do anything, let the plugin
> apply some simple markup of it's own.
>
> Any recommendations on how to engineer this the best?
>
> --
> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> http://twitter.com/tcbarrett
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list