Thanks for the plugin, it’s very useful.
I was wondering if there’s any way I can modify the plugin code so that I don’t need to modify my site’s theme?
Normally I would just create a child-theme and modify the templates as outlined in the plugin’s instructions, however I’ve recently switched to the NomNom theme, which is a child-theme of TwentyEleven.
Since it’s not possible to create a child-of-a-child-theme, this means that when NomNom is updated, the changes to the template files are wiped out.
One of the things NomNom provides is a file called custom-functions.php which is left intact after a theme upgrade, and is where you’d normally place anything that would go in functions.php, so I thought I might try adding filters in custom-functions.php to catch anything author related and output the Co-Author Plus equivalents instead.
I’ve tried adding a filter to return coauthors() when get_the_author() is called, however it had no effect. When I added the filter to the_author() instead, I ended up in recursive loops.
I’m still pretty new to WordPress, though not to PHP, so I think it’s possible I’m adding the filter to the wrong hook.
Is it possible to use Co-Authors Plus via filters?
Yep, it should be. Can you point me to where I can look at code for the NomNom theme?
Thanks for the reply 🙂
The theme is available at http://zeaks.org/nomnom-twenty-eleven-child-theme/ (the download link is just below the screenshots)
The site I’m using it on is on a local dev box behind firewalls but if you need to see it in use let me know and I’ll upload it to somewhere more accessible.
I’ll try to take a swing at this sometime this week. Apologies for the wait
I took a look at adding automatic support today and it’s unfortunately not going to be as easy as I’d like.
When a theme uses the_author() and related functions, it’s easy to add a filter and change the value. In fact, I’ve added code in Co-Authors Plus that will be available in the next release to do just that. However, all of the twenty_* themes create their own posted_on function that isn’t filter-able.
If you duplicate twentyeleven_posted_on() and add it to your custom-functions.php file, you should be able to add the template tags.
- The topic ‘Is it possible to use Co-Authors Plus without modifying theme?’ is closed to new replies.