WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] Is it possible to use Co-Authors Plus without modifying theme? (7 posts)

  1. Number 6
    Member
    Posted 2 years ago #

    Hi Daniel,
    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?

    Many thanks,
    Mark

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Yep, it should be. Can you point me to where I can look at code for the NomNom theme?

  3. Number 6
    Member
    Posted 1 year ago #

    Hi Daniel,
    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.

    Thanks,
    Mark

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    I'll try to take a swing at this sometime this week. Apologies for the wait

  5. Number 6
    Member
    Posted 1 year ago #

    No worries about the wait, thanks for taking a look :-)

  6. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    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.

  7. Number 6
    Member
    Posted 1 year ago #

    Ahh I see, thanks Daniel. Ta for looking in to it, I appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic