public static function frontend_display(array $args = [], $instance)
    {
        global $post;
        $instance = array_merge(['title' => ___('Author posts'), 'posts_per_page' => 12, 'orderby' => 'random', 'content_type' => 'img'], $instance);
        echo $args['before_title'];
        ?>
			<a href="<?php 
        echo class_exists('theme_custom_author_profile') ? theme_custom_author_profile::get_tabs('works', $post->post_author)['url'] : theme_cache::get_author_posts_url($post->post_author);
        ?>
" title="<?php 
        echo ___('Views more author posts.');
        ?>
">
				<i class="fa fa-file-text"></i> 
				<?php 
        echo sprintf($instance['title'], theme_cache::get_the_author_meta('display_name', $post->post_author));
        ?>
			</a>
			<?php 
        echo $args['after_title'];
        $query = new WP_Query(['posts_per_page' => (int) $instance['posts_per_page'], 'orderby' => $instance['orderby'], 'author' => $post->post_author, 'post_not__in' => [$post->ID], 'ignore_sticky_posts' => true]);
        ?>
		<div class="card-container">
			<?php 
        if ($query->have_posts()) {
            ?>
				<div class="row widget-author-post-<?php 
            echo $instance['orderby'];
            ?>
">
					<?php 
            foreach ($query->posts as $post) {
                setup_postdata($post);
                theme_functions::archive_card_xs(['classes' => 'g-phone-1-2']);
            }
            wp_reset_postdata();
            ?>
				</div>
			<?php 
        } else {
            ?>
				<div class="page-tip not-found">
					<?php 
            echo status_tip('info', ___('No data yet.'));
            ?>
				</div>
			<?php 
        }
        ?>
		</div>
		<?php 
        unset($query);
    }
Exemple #2
0
    /**
     * My statistics
     */
    public static function my_statistics()
    {
        $current_user_id = theme_cache::get_current_user_id();
        ?>
		<div class="panel">
			<div class="heading">
				<i class="fa fa-pie-chart"></i>
				<?php 
        echo ___('My statistics');
        ?>
			</div>
			<div class="content">
				<a class="media" href="<?php 
        echo theme_custom_user_settings::get_tabs('history')['url'];
        ?>
" title="<?php 
        echo ___('Views my histories');
        ?>
">
					<div class="media-left">
						<img class="media-object" src="<?php 
        echo theme_custom_point::get_point_img_url();
        ?>
" alt="">
					</div>
					<div class="media-body">
						<h4 class="media-heading"><strong class="total-point"><?php 
        echo number_format(theme_custom_point::get_point($current_user_id));
        ?>
</strong></h4>
					</div>
				</a>
				<div class="row">
					<!-- posts count -->
					<div class="g-phone-1-2">
						<?php 
        echo sprintf(___('My posts: %s'), '<a href="' . theme_cache::get_author_posts_url($current_user_id) . '">' . theme_custom_author_profile::get_count('works', $current_user_id) . '</a>');
        ?>
					</div>
					<!-- comments count -->
					<div class="g-phone-1-2">
						<?php 
        echo sprintf(___('My comments: %s'), '<a href="' . theme_custom_author_profile::get_tabs('comments', $current_user_id)['url'] . '">' . theme_custom_author_profile::get_count('comments', $current_user_id) . '</a>');
        ?>
					</div>
					<!-- followers count -->
					<div class="g-phone-1-2">
						<?php 
        echo sprintf(___('My followers: %s'), '<a href="' . theme_custom_author_profile::get_tabs('followers_count', $current_user_id)['url'] . '">' . theme_custom_author_profile::get_count('followers_count', $current_user_id) . '</a>');
        ?>
					</div>
					<!-- following count -->
					<div class="g-tablet-1-2 g-desktop-1-3">
						<?php 
        echo sprintf(___('My following: %s'), '<a href="' . theme_custom_author_profile::get_tabs('following_count', $current_user_id)['url'] . '">' . theme_custom_author_profile::get_count('following_count', $current_user_id) . '</a>');
        ?>
					</div>
				</div>
			</div>
		</div>
		<?php 
    }
Exemple #3
0
    /**
     * Echo the user list within loop
     *
     * @param array $args
     * @return 
     * @version 1.0.2
     */
    public static function the_user_list(array $args)
    {
        $args = array_merge(['classes' => 'g-phone-1-3', 'user_id' => null, 'extra_title' => '', 'extra' => 'point', 'target' => theme_functions::$link_target], $args);
        /**
         * extra point value
         */
        switch ($args['extra']) {
            /**
             * user point
             */
            case 'point':
                if (class_exists('theme_custom_point')) {
                    $point_value = theme_custom_point::get_point($args['user_id']);
                }
                break;
                /**
                 * user fav be_count
                 */
            /**
             * user fav be_count
             */
            case 'fav':
                if (class_exists('custom_post_fav')) {
                    $point_value = custom_post_fav::get_user_be_fav_count($args['user_id']);
                }
                break;
                /**
                 * user posts count
                 */
            /**
             * user posts count
             */
            case 'posts':
                if (class_exists('theme_custom_author_profile')) {
                    $point_value = theme_custom_author_profile::get_count('works', $args['user_id']);
                } else {
                    $point_value = count_user_posts($args['user_id']);
                }
                break;
            default:
                $point_value = null;
        }
        if (!empty($args['extra_title']) && $point_value) {
            $args['extra_title'] = str_replace('%', $point_value, $args['extra_title']);
        }
        $display_name = theme_cache::get_the_author_meta('display_name', $args['user_id']);
        $avatar_url = theme_cache::get_avatar_url($args['user_id']);
        ?>
		<div class="user-list <?php 
        echo $args['classes'];
        ?>
">
			<a 
				href="<?php 
        echo theme_cache::get_author_posts_url($args['user_id']);
        ?>
" 
				title="<?php 
        echo $display_name;
        ?>
" 
				target="<?php 
        echo $args['target'];
        ?>
" 
			>
				<div class="avatar-container">
					<img src="<?php 
        echo theme_functions::$avatar_placeholder;
        ?>
" data-src="<?php 
        echo $avatar_url;
        ?>
" alt="<?php 
        echo $display_name;
        ?>
" class="avatar">
				</div>
				<h3 class="author"><?php 
        echo $display_name;
        ?>
</h3>
				<?php 
        if ($args['extra']) {
            ?>
					<div class="extra">
						<span class="<?php 
            echo $args['extra'];
            ?>
" title="<?php 
            echo $args['extra_title'];
            ?>
">
							<?php 
            echo number_format($point_value);
            ?>
						</span>
					</div>
				<?php 
        }
        /** end args extra */
        ?>
			</a>
		</div>
		<?php 
    }
Exemple #4
0
?>
">
						<?php 
$author_posts_count = theme_custom_author_profile::get_count('works', $author);
echo (int) $author_posts_count !== 0 ? $author_posts_count : '-';
?>
					</a></td>
				</tr>
				<tr>
					<th><?php 
echo ___('Comments');
?>
</th>
					<td>
						<a href="<?php 
echo theme_custom_author_profile::get_tabs('comments', $author)['url'];
?>
">
						<?php 
$count_comments = theme_features::get_user_comments_count($author);
echo (int) $count_comments != 0 ? $count_comments : '-';
?>
						</a>
					</td>
				</tr>
				<?php 
if (class_exists('theme_custom_point')) {
    ?>
					<tr>
						<th><?php 
    echo theme_custom_point::get_point_name();
    function widget($args, $instance)
    {
        global $post;
        $author_id = $post->post_author;
        echo $args['before_widget'];
        /**
         * author profile page url
         */
        if (class_exists('theme_custom_author_profile')) {
            $author_url = theme_custom_author_profile::get_tabs('profile', $author_id)['url'];
        } else {
            $author_url = theme_cache::get_author_posts_url($author_id);
        }
        $description = theme_cache::get_the_author_meta('description', $author_id);
        ?>
	
		<div id="widget-author-card" class="widget-container content">
			<a href="<?php 
        echo $author_url;
        ?>
" class="author-link" title="<?php 
        echo ___('Views the author information detail');
        ?>
">
				<?php 
        echo theme_cache::get_avatar($author_id, 100);
        ?>
				
				<h3 class="author-card-name">
					<?php 
        echo theme_cache::get_the_author_meta('display_name', $author_id);
        ?>
				</h3>
				
				<?php 
        if (class_exists('theme_custom_author_profile')) {
            ?>
					<small class="label label-<?php 
            echo theme_custom_author_profile::get_roles($author_id)['label'];
            ?>
"><?php 
            echo theme_custom_author_profile::get_roles($author_id)['name'];
            ?>
</small>
				<?php 
        }
        ?>
			</a><!-- ./author-link -->
			
			<p class="author-card-description" title="<?php 
        echo $description;
        ?>
" >
				<?php 
        if (empty($description)) {
            echo ___('The author is lazy, nothing writes here.');
        } else {
            echo $description;
        }
        ?>
			</p>
			
			<?php 
        if (class_exists('theme_custom_author_profile')) {
            ?>
				<div class="author-card-meta-links">
					<!-- works count -->
					<a class="tooltip" href="<?php 
            echo theme_custom_author_profile::get_tabs('works', $author_id)['url'];
            ?>
" title="<?php 
            echo ___('Views author posts');
            ?>
" target="_blank">
						<span class="tx"><i class="fa fa-fw fa-<?php 
            echo theme_custom_author_profile::get_tabs('works', $author_id)['icon'];
            ?>
"></i></span>
						<span class="count"><?php 
            echo (int) theme_custom_author_profile::get_tabs('works', $author_id)['count'];
            ?>
</span>
					</a>
					<!-- comments count -->
					<a class="tooltip" href="<?php 
            echo theme_custom_author_profile::get_tabs('comments', $author_id)['url'];
            ?>
" title="<?php 
            echo ___('Views author comments');
            ?>
" target="_blank">
						<span class="tx"><i class="fa fa-fw fa-<?php 
            echo theme_custom_author_profile::get_tabs('comments', $author_id)['icon'];
            ?>
"></i></span>
						<span class="count"><?php 
            echo (int) theme_custom_author_profile::get_tabs('comments', $author_id)['count'];
            ?>
</span>
					</a>
					<!-- point -->
					<?php 
            if (class_exists('theme_custom_point_bomb')) {
                if (class_exists('number_user_nicename')) {
                    $target_id = number_user_nicename::$prefix_number + $author_id;
                } else {
                    $target_id = $author_id;
                }
                ?>
						<!-- followers count -->
						<a class="tooltip" href="<?php 
                echo theme_custom_point_bomb::get_tabs('bomb', $target_id)['url'];
                ?>
" rel="nofollow" title="<?php 
                echo ___('Bomb!');
                ?>
" target="_blank">
							<span class="tx"><i class="fa fa-fw fa-bomb"></i></span>
							<span class="count"><?php 
                echo theme_custom_point::get_point($author_id);
                ?>
</span>
						</a>
					<?php 
            }
            ?>
					
					<!-- pm -->
					<?php 
            if (class_exists('theme_custom_pm')) {
                ?>
						<a target="_blank" class="tooltip" href="<?php 
                echo theme_custom_pm::get_user_pm_url($author_id);
                ?>
" title="<?php 
                echo ___('Send a private message.');
                ?>
">
							<span class="tx"><i class="fa fa-<?php 
                echo theme_custom_pm::get_tabs('pm')['icon'];
                ?>
"></i></span><span class="count"><?php 
                echo __x('P.M.', 'Widget author card PM.');
                ?>
</span>
						</a>
					<?php 
            }
            ?>
				</div>
			<?php 
        }
        ?>
		</div>
		<?php 
        echo $args['after_widget'];
    }
Exemple #6
0
<?php

get_header();
global $author;
$tab_active = get_query_var('tab');
$tabs = theme_custom_author_profile::get_tabs(null, $author);
if (empty($tab_active) || !isset($tabs[$tab_active])) {
    $tab_active = 'profile';
}
?>
<div class="g">
	<h3 class="crumb-title">
		<?php 
echo theme_cache::get_avatar($author);
?>
		<?php 
echo theme_cache::get_the_author_meta('display_name', $author);
?>
 - <small><?php 
echo $tabs[$tab_active]['text'];
?>
</small>
	</h3>
	<nav class="nav">
		<?php 
foreach ($tabs as $k => $v) {
    $class_active = $tab_active === $k ? ' active ' : null;
    ?>
			<a class="<?php 
    echo $class_active;
    ?>