Forum Replies Created

Viewing 15 replies - 76 through 90 (of 121 total)
  • Thread Starter callender

    (@jimcallender)

    Hi the sweeper,

    if ( $tag_list ) {
    		$posted_in = __( 'Category: %1$s <hr />Tags: %2$s<hr /><strong>**COMMENT COUNT HERE**</strong>', 'twentyten' );

    Ideally to appear after the tags line, so in order – category, tags and comment count.

    Many thanks for your help!

    J

    Thread Starter callender

    (@jimcallender)

    <>Read more by <?php the_author_posts_link(); ?></p>

    Also this works – linking to the author page.

    Thread Starter callender

    (@jimcallender)

    to: truncates comment to 48 characters, and adds date in new line break, lose author ref

    <?php
      $pre_HTML ="";
      $post_HTML ="";
      global $wpdb;
      $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,48) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 10";
    
      $comments = $wpdb->get_results($sql);
      $output = $pre_HTML;
      $output .= "\n<ol>";
      foreach ($comments as $comment) {
        $output .= "\n<li>". "<a href=\"" . get_permalink($comment->ID)."#comment-" . $comment->comment_ID . "\" title=\"on ".$comment->post_title . "\">" . strip_tags($comment->com_excerpt)."...</a><br />" . strip_tags(mysql2date('jS F Y', $comment->comment_date_gmt)) ."</li>";
    					  }
    					  $output .= "\n</ol>";
    					  $output .= $post_HTML;
    					  echo $output;
    					?>
    Thread Starter callender

    (@jimcallender)

    I used this solution #7 , and rewrote it to include the date.

    <?php
      $pre_HTML ="";
      $post_HTML ="";
      global $wpdb;
      $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,30) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 10";
    
      $comments = $wpdb->get_results($sql);
      $output = $pre_HTML;
      $output .= "\n<ul>";
      foreach ($comments as $comment) {
        $output .= "\n<li>".strip_tags($comment->comment_author) .":" . "<a href=\"" . get_permalink($comment->ID)."#comment-" . $comment->comment_ID . "\" title=\"on ".$comment->post_title . "\">" . strip_tags($comment->com_excerpt)."</a></li>";
      }
      $output .= "\n</ul>";
      $output .= $post_HTML;
      echo $output;
    ?>
    Thread Starter callender

    (@jimcallender)

    FYI

    <a href="<?php comments_link(); ?>">

    – only links to the #comments div in the page where the comment widget shows, and not to the original comment/post.

    Thread Starter callender

    (@jimcallender)

    By the way the output with the above code is;

    1. this is great! Please can we have more…
    27th October 2010

    2. another comment, etc…
    28th October 2010

    Thread Starter callender

    (@jimcallender)

    Hi LonelySchnozz,

    Thanks, however as well as the author link i also need an avatar with each author and latest post..

    currently:

    <?php  $authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);
    		if($authors): foreach($authors as $author): ?>
    
    		  <div class="left">
    				<h2><?php the_author_meta('display_name', $author->post_author); ?></h2>
    				<?php echo get_avatar(get_the_author_meta('user_email', $author->post_author), 200); ?>
    			  <?php endif; ?>
    			</div>
    
    			<?php $recentPost = new WP_Query('author='.$author->post_author.'&showposts=1'); while($recentPost->have_posts()): $recentPost->the_post(); ?>
    
    			<div class="right">
    			<h2 class="entry-title"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>  </h2>
    			 <?php the_excerpt(); ?> 
    
    			 <p class="postmetadata">Posted on <?php the_time('jS F Y') ?></p>
    			 <h3><a href='<?php the_title();?>'><?php the_title(); ?> > </a></h3>
    			 <p class="postmetadata"><?php the_time('jS F Y') ?></p>
    			 <p><a href="<?php the_permalink() ?>" rel="bookmark" class="more-link-writer">Read more by <?php the_author_meta( 'nickname' ); ?></a></p>

    but i’m thinking this may be overkill, coudl you provide a way of building up your suggestion?

    currently i’ve started with:

    <h2><?php wp_list_authors('exclude_admin=1&hide_empty=1'); ?>
    </h2>

    many thanks for any help!

    Thread Starter callender

    (@jimcallender)

    I used this example in the end, thanks though

    http://wpsplash.com/how-to-create-a-wordpress-authors-page/

    Thread Starter callender

    (@jimcallender)

    Oh, just looking at the code, its not quite that easy as i’m using wpdb to show the code directly from the sql table into a custom page template.

    Can you advise what the code would be? as the php snippet you included doesnt work:

    <?php
    				global $wpdb;
    				$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
    				comment_post_ID, comment_author, comment_date_gmt, comment_approved,
    				comment_type,comment_author_url,
    				SUBSTRING(comment_content,1,100) AS com_excerpt
    				FROM $wpdb->comments
    				LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
    				$wpdb->posts.ID)
    				WHERE comment_approved = '1' AND comment_type = '' AND
    				post_password = ''
    				ORDER BY <strong>comment_date_gmt</strong> DESC
    				LIMIT 3";
    				$comments = $wpdb->get_results($sql);
    				$output = $pre_HTML;
    				$output .= "\n<ul>";
    				foreach ($comments as $comment) {
    				$output .= "\n<li>".strip_tags($comment->comment_author)
    				." commented on <br />" . "<a href=\"" . get_permalink($comment->ID) .
    				"#comment-" . $comment->comment_ID . "\" title=\"on " .
    				$comment->post_title . "\">" . strip_tags($comment->post_title, comment_date)
    				.
    				"<br />" . strip_tags($comment-><strong>comment_date_gmt</strong>) ."</li>";
    				"></a></li>";
    				}
    				$output .= "\n</ul>";
    				$output .= $post_HTML;
    				echo $output;?>
    Thread Starter callender

    (@jimcallender)

    thanks Esmi, you are the best!

    Thread Starter callender

    (@jimcallender)

    the best one i found was at sitepoint – http://articles.sitepoint.com/article/wordpress-in-the-cloud-with-ec2-and-wpi. however covers windows server, and wordpress is best suited on linux/ubuntu..

    Thread Starter callender

    (@jimcallender)

    I ended using – <?php echo get_avatar( get_the_author_email(), ’40’ ); ?>

    Thread Starter callender

    (@jimcallender)

    Perhaps query posts?

    <?php query_posts(‘caller_get_posts=1&author=16&orderby=title&order=ASC’); ?>

    Thread Starter callender

    (@jimcallender)

    Hi Esmi,

    thanks for the reply.

    To clarify – the latest or most recent post from a specific author will display on the homepage in a widget or in the main content.

    How do I show the latest post by author?

    Thanks again, J

    Thread Starter callender

    (@jimcallender)

    Fixed – used the code from this page – http://blog.fleischer.hu/wordpress/authors/

Viewing 15 replies - 76 through 90 (of 121 total)