Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Created January 20, 2019 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodwardtw/a1334398bf5ac4cf42f8e2afabfa89fd to your computer and use it in GitHub Desktop.
Save woodwardtw/a1334398bf5ac4cf42f8e2afabfa89fd to your computer and use it in GitHub Desktop.
author profile page template
<?php
/*
Template Name: User Profile
*/
get_header(); ?>
<div class="container">
<div class="row">
<div class="col-md-8">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
if (is_user_logged_in()){
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
$name = $current_user->display_name;
$twitter = get_user_meta($user_id, 'twitter', true);
$idea_experience = get_user_meta($user_id, 'idea_experience', true);
$company = get_user_meta($user_id, 'idea_company', true);
echo '<h2>Hi ' . $name . '!</h2>';
echo '<div class="user-data"><h4>Your Profile</h4>';
echo '<p>Twitter: <a href="http://twitter.com/' . $twitter . '">'.$twitter.'</a></p>';
echo '<p>Idea Experience: '. $idea_experience .' Years</p>';
echo '<p>Company: ' . $company . '</p>';
echo '</div>';
}
?>
<?php the_content(); ?>
</div><!-- .entry-content -->
<footer class="entry-footer">
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
<?php endwhile; // End of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
</div>
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment