Plugin development without Theme adjustments?

I’m an ambitious wordpress beginner and learner – this is my first question at Stackexchange – in case I’m wrong here, I’m grateful for anyone pointing in a better direction.

On my page http://www.project22.org

Read More
  • I started off with a childtheme of Twenty Twelve, because I thought this theme is particularly well prepared for anything that might come.
  • Next I created my own ‘base-functionality-plugin’, to do the programming that I (didn’t find in other plugins) and that I wanted to do myself.

Now, I have basically created the functionalities I wanted in my plugin, but to display my results I needed to some adjustments in the (child) theme files, e.g. the content.php to change the display of the “entry_meta” of posts.

This doesn’t feel right, wouldn’t it be best if my plugin remains independent of the theme itself?

So my beginner questions are these:

  • How to avoid this?
  • What is the best practice regarding this?
  • What to do if your starting theme has no hooks or filters in the places you need?

Edit:
My use case – in the entry_meta of each post I want to display some data from custom fields.
The only solution I found was to make adjustments to the theme function twentytwelve_entry_meta(); – but this won’t work on a different theme, right?

Related posts

Leave a Reply

1 comment

  1. If your code requires themes changes it belongs to the theme, usually the functions.php. In a custom child theme this is not a problem, in a plugin for everyone, it will be much harder. 🙂

    The best option to get a theme more flexible: Ask the theme author to add a hook. Provide a real use case. If you don’t want t wait, add the hooks to your child theme. See also ticket #21506 Standard Theme Hooks.

    Update
    Your use case – changing twentytwelve_entry_meta() – cannot be cross-theme compatible for a simple reason: Not every theme comes with a similar function. Some themes use author name and associated terms in different locations, others don’t show this data at all.