Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects

There was an associated post to this one that shed light on this answer. When registering the post type, I was not setting enough fields in the ‘supports’ array of the register_post_type. Adding author, whatdayaknow, gives me the data I’m looking for. Thanks to @milo for being on the right path! register_post_type(self::POST_TYPE, array( ‘labels’ => … Read more

Recent comments on author page?

This function calls all comments by an author and strips every comment to a max-length. Adjust the comment excerpt length when calling the function in your template like wpse19316_author_comments( 100 );. function wpse19316_author_comments( $length ) { $final_length = (int) $length; $author_comments = get_comments( array( ‘ID’ => $GLOBALS[‘authordata’]->ID ) ); foreach ( $author_comments as $comment ) … Read more

Display the number of user comments

Got some idea from here. User’s comments have posted <?php function commentCount() { global $wpdb; $count = $wpdb->get_var(‘SELECT COUNT(comment_ID) FROM ‘ . $wpdb-comments. ‘ WHERE comment_author_email = “‘ . get_comment_author_email() . ‘”‘); echo $count . ‘ comments’; } commentCount(); ?> I don’t have any idea for comments that user got from their posts. Might be … Read more

Filter posts by author and category simultaneously

If you want your visitors to choose the category and author you can use the code below. If your loop in the template hasn’t been changed you should get away with adding a query to the URL like so: http://website.com/post-title/?author=1&cat=1 If you have a custom query you could do the following: $author = $_GET[‘author’]; //Get … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)