WordPress.org

Ready to get started?Download WordPress

Forums

Content Aware Sidebars
[resolved] Unable to recognize content by co-authors plus guest authors (3 posts)

  1. zwrodgers
    Member
    Posted 1 year ago #

    I'm unable to get the plugin to recognize guest authors (using the coauthors plus plugin). Any idea why this is happening?

    More info:
    I set specific sidebars to appear according to whom the guest author is and set it to show on singular posts. Nothing seems to work.

    My work around is to simply tag each post by the guest author, but that can get tedious.

    Any suggestions would be greatly appreciated!

    http://wordpress.org/extend/plugins/content-aware-sidebars/

  2. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for your feedback. The plugin currently does not support the mentioned plugin - it stores the co authors in a different place and Content Aware Sidebars does not recognize these.

    I might add official support sometime, but right now it can be solved by adding a hook in your theme functions. I will provide the code in this thread as soon as I get time to look into it.

  3. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 1 year ago #

    Try to insert this code in functions.php of your theme:

    add_filter("cas-db-where-authors", "cas_coauthors_filter");
    
    	function cas_coauthors_filter($where) {
    		global $post;
    		$author = (string)(is_singular() ? $post->post_author : get_query_var('author'));
    		$coauthors = coauthors_IDs($between = "','", null, null, null, false );
    		return "(authors.meta_value IS NULL OR authors.meta_value IN('authors','".$author."','".$coauthors."'))";
    	}

    It has not been tested so please give me feedback on it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic