Support » Plugin: Custom Content Type Manager » [Plugin: Custom Content Type Manager] Display all 'posts' by author

Viewing 1 replies (of 1 total)
  • Plugin Contributor fireproofsocks


    They are all “true” posts: the CCTM plugin builds post-types in exactly the same way WordPress does (see the readme description: no artificial ingredients here — I don’t waste my time with unnatural perversions of the model), but keep in mind WP itself is sorta hodge-podge code, often made up of contributions from amateur coders, so your mileage may vary.

    The the_author_posts_link() function takes no arguments, so that’s a smoking gun that it relies on global variables, which in my mind, makes that function practically useless, victim to short-sighted architecture because global variables are @!%!@ retarded. (yes, I’m very outspoken about that sort of stuff)

    You could do a database query to search by author. WP has its own ways to do this, but I’ve found more than a handful of WP “solutions” to be as short-sighted as the the_author_posts_link() function, i.e. they have weird caveats and don’t work well. If you were writing a raw database query, it’d look something like this:

    SELECT * FROM wp_posts WHERE post_author='1';

    (assuming an author ID of 1). Very simple.

    So if you can get ahold of your author ID (i.e. the post_author), you could do something like this using the GetPostsQuery class (bundled in the CCTM):

    global $post;
    print $post->post_author; /* <-- better make sure you can actually get the author ID before you go any further.  Depending on where you try to do this, the author ID may be stored elsewhere. */
    // In your template file somewhere
    $Q = new GetPostsQuery();
    $args = array(); // initialize
    $args['post_author'] = $post->post_author;
    $posts = $Q->get_posts($args);
    // Iterate over your results.
    foreach ($posts as $p) {
        print $p['post_title'] . '<br/>';

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Custom Content Type Manager] Display all 'posts' by author’ is closed to new replies.