Esempio n. 1
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function popper_posted_on()
 {
     $author_id = get_the_author_meta('ID');
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf(esc_html_x('Published %s', 'post date', 'popper'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html_x('by %s', 'post author', 'popper'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     // Display author avatar if author has a Gravatar
     if (validate_gravatar($author_id)) {
         echo '<div class="meta-content has-avatar">';
         echo '<div class="author-avatar">' . get_avatar($author_id) . '</div>';
     } else {
         echo '<div class="meta-content">';
     }
     echo '<span class="byline">' . $byline . ' </span><span class="posted-on">' . $posted_on . ' </span>';
     // WPCS: XSS OK.
     if (!post_password_required() && (comments_open() || get_comments_number())) {
         echo '<span class="comments-link">';
         comments_popup_link(esc_html__('Leave a comment', 'popper'), esc_html__('1 Comment', 'popper'), esc_html__('% Comments', 'popper'));
         echo '</span>';
     }
     echo '</div><!-- .meta-content -->';
 }
Esempio n. 2
0
<div class="comment-meta">
    <?php 
if (validate_gravatar($comment->comment_ID)) {
    echo get_avatar($comment, $size = '64');
} else {
    echo '<img src="' . avatar() . '" alt="Avatar" />';
}
?>

    <h4 class="media-heading"><?php 
echo get_comment_author_link();
?>
</h4>

    <time datetime="<?php 
echo get_comment_date('c');
?>
"><a href="<?php 
echo htmlspecialchars(get_comment_link($comment->comment_ID));
?>
"><?php 
printf(__('%1$s', 'roots'), get_comment_date(), get_comment_time());
?>
</a></time>

    <div class="comment-actions">
        <?php 
comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
?>

        <?php 
/**
	Function to list authors with important attributes (usermeta)
	Please change function to suit your needs
**/
function rt_list_authors()
{
    global $wpdb;
    $count = 0;
    // get all authors who has atleast one published post. Authors are sorted by number of posts
    foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' GROUP BY post_author ORDER BY count DESC") as $row) {
        $count++;
        //get author data (mostly from wp_users table)
        $author = get_userdata($row->post_author);
        //calculate gravatar
        $avatar = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($author->user_email))) . "?s=256";
        //do not edit spaces inside "    "
        echo "    " . $author->user_login . ":" . "\n";
        if ($author->first_name) {
            echo "      first_name: " . $author->first_name . "\n";
        }
        if ($author->last_name) {
            echo "      last_name: " . $author->last_name . "\n";
        }
        if ($author->display_name) {
            echo "      display_name: " . $author->display_name . "\n";
        }
        if (validate_gravatar($author->user_email)) {
            echo "      avatar: " . $avatar . "\n";
        }
        if ($author->user_url) {
            echo "      homepage: " . $author->user_url . "\n";
        }
        // for current author, fetch additioal metadata stored by rtCamp's user-info plugin.
        // Ignore empty meta_values
        $extra = $wpdb->get_results("SELECT meta_key, meta_value FROM {$wpdb->usermeta} WHERE user_id = " . $author->ID . " AND (meta_key LIKE 'rt_user_%' OR meta_key LIKE 'user_%' OR meta_key = 'wp_29_rtrs_users_details' OR meta_key = 'description') AND meta_value <> '' ", ARRAY_A);
        //loop thorugh keys as we want to print differnt key name
        foreach ($extra as $ex) {
            switch ($ex['meta_key']) {
                case 'rt_user_twitter':
                    echo "      twitter: " . $ex['meta_value'] . "\n";
                    break;
                case 'rt_user_facebook':
                    echo "      facebook: " . $ex['meta_value'] . "\n";
                    break;
                case 'rt_user_linkedin':
                    echo "      linkedin: " . $ex['meta_value'] . "\n";
                    break;
                case 'rt_user_gender':
                    echo "      gender: " . strtolower($ex['meta_value']) . "\n";
                    break;
                case 'rt_user_googleplus':
                    echo "      googleplus: " . $ex['meta_value'] . "\n";
                    break;
                case 'rt_user_github':
                    echo "      github: " . $ex['meta_value'] . "\n";
                    break;
                case 'rt_user_wordpress':
                    echo "      wordpress: " . $ex['meta_value'] . "\n";
                    break;
                case 'rt_user_stackexchange':
                    echo "      stackexchange: " . $ex['meta_value'] . "\n";
                    break;
                case 'rt_user_location':
                    echo "      location: " . $ex['meta_value'] . "\n";
                    break;
                case 'description':
                    echo "      bio: " . str_replace(array("\r", "\n"), ' ', strip_tags($ex['meta_value'])) . "\n";
                    break;
                    //devils workshop author-adsense plugin support
                //devils workshop author-adsense plugin support
                case 'wp_29_rtrs_users_details':
                    $adsense = unserialize($ex['meta_value']);
                    if ($adsense['rtrs_pub_id']) {
                        echo "      adsense_pub_id:  " . $adsense['rtrs_pub_id'] . "\n";
                    }
                    if ($adsense['rtrs_slot_id']) {
                        echo "      adsense_slot_id: " . $adsense['rtrs_slot_id'] . "\n";
                    }
                    break;
            }
            //end of switch
        }
        //end of inner for loop
    }
    //end of outer loop
    /* 	echo "\n\n Exported " . $count . " authors"; */
}
Esempio n. 4
0
function special_thanks()
{
    global $wpdb;
    $args = array();
    $args['fields'] = array('ID', 'display_name');
    $args['meta_key'] = 'special_thanks';
    $args['meta_value'] = 'yes';
    $specials = get_users($args);
    echo '<div id="specialthanks-box-wrapper">';
    echo '<div id="specialthanks-box">';
    echo '<div id="specialthanks-title">';
    echo '<h4 id="specialthanks-header">Special Thanks</h4>';
    echo '</div>';
    echo '<div id="specialthanks-content">';
    foreach ($specials as $special) {
        echo "<li>";
        echo '<div class="editor-img">';
        echo "<a href=\"";
        echo get_author_posts_url($special->ID);
        echo "\">";
        if (userphoto_exists($special->ID)) {
            echo userphoto($special);
        } elseif (validate_gravatar($special->user_email)) {
            echo get_avatar($special->ID, 120, 'blank');
        }
        echo "</a>";
        echo '</div>';
        echo '<div>';
        echo "<a href=\"";
        echo get_author_posts_url($special->ID);
        echo "\">";
        echo '<h4 class="specialthanks-name">';
        the_author_meta('display_name', $special->ID);
        echo '</h4>';
        echo '<h5>';
        the_author_meta('university', $special->ID);
        echo '</h5>';
        echo "</a>";
        echo '<div id="special-thanks-reason">';
        echo get_the_author_meta('special_thanks_reason', $special->ID);
        echo '</div>';
        echo '<div class="contact-links"><ul class="social-links">';
        if (get_the_author_meta('twitter', $special->ID) != '') {
            echo '<li><a href="http://twitter.com/';
            echo get_the_author_meta('twitter', $special->ID);
            echo '"><i class="fa fa-twitter"></i></a></li>';
        }
        if (get_the_author_meta('facebook', $special->ID) != '') {
            echo '<li><a href="http://';
            echo get_the_author_meta('facebook', $special->ID);
            echo '"><i class="fa fa-facebook"></i></a></li>';
        }
        if (get_the_author_meta('website', $special->ID) != '') {
            echo '<li><a href="http://';
            echo get_the_author_meta('website', $special->ID);
            echo '"><i class="fa fa-laptop"></i></a></li>';
        }
        if (get_the_author_meta('email', $special->ID) != '') {
            echo '<li><a href="mailto:';
            echo get_the_author_meta('email', $special->ID);
            echo '"><i class="fa fa-envelope-o"></i></a></li>';
        }
        echo '</ul></div>';
        echo "</div>";
        echo "</li>";
    }
    echo '</div>';
    echo '</div>';
    echo '</div>';
}