• Resolved pre20

    (@pre20)


    Hi,

    How can I get a link or a call of all listings published by an specefic user?

    The profiles link to the default /author with 0 results as the user didn’t write any post, but wrote many listings.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    There is a shortcode you can use, documented here: https://docs.businessdirectoryplugin.com/misc/shortcodes.html

    But that requires that you hard-code the username in it. We don’t yet have a shortcode to show the listings of a user when a name is entered.

    That’s something we can consider for future development, but not something the plugin allows for today.

    jomo

    (@jonathanmoorebcsorg)

    I suggest this, to add the listing to the standard author archive page:

    
    /**
     * Add CPTs to author archives
     * 
    * @param WP_Query &$this The WP_Query instance (passed by reference).
    */ 
    function custom_post_author_archive($query) {
        if ($query->is_author)
        {
            $query->set( 'post_type', array('wpbdp_listing', 'post') );
        }
        remove_action( 'pre_get_posts', 'custom_post_author_archive' );
    }
    add_action('pre_get_posts', 'custom_post_author_archive');
    
    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Great suggestion @jonathanmoorebcsorg! Thanks for posting it.

    Thread Starter pre20

    (@pre20)

    It works, thanks!

    It is possible to add it to a custom page, to not mix with the posts? Because some member plugins make a new profile page so the author page is no longer used and redirect it to the profile.

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Hi @pre20,

    I’m not sure I understand your question here–custom page for what? For the listings by a specific author?

    Or are you talking about replacing the profile page for the user on the admin dashboard here?

    Thread Starter pre20

    (@pre20)

    Yes, I’m talking about show the user listings (implement that code) in a custom page like /user-posts instead of the author page.

    Or in the user/name, because some plugin memberships replace the default author page by a custom profile page so to show them on it.

    • This reply was modified 7 years, 6 months ago by pre20.
    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    OK, we’ll definitely add that to the list for future development.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Get user listings’ is closed to new replies.