Instantly share code, notes, and snippets.
Last active
January 21, 2019 13:41
-
Save woodwardtw/668f3c94803e764dce6393e7fb7e0b9c to your computer and use it in GitHub Desktop.
author page template for https://hhk3.kau.se/servitization/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The author template file. | |
* | |
* This is the most generic template file in a WordPress theme | |
* and one of the two required files for a theme (the other being style.css). | |
* It is used to display a page when nothing more specific matches a query. | |
* E.g., it puts together the home page when no home.php file exists. | |
* Learn more: http://codex.wordpress.org/Template_Hierarchy | |
* | |
* @package KAU | |
*/ | |
get_header(); ?> | |
<div id="pageheading"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-12"> | |
<?php | |
$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); | |
echo '<h2>' . $curauth->display_name . '</h2>'; | |
$id = $curauth->ID; | |
?> | |
</div> | |
</div><!-- /row --> | |
</div> <!-- /container --> | |
</div><!-- /blue --> | |
<div class="container mtb"> | |
<?php echo get_avatar( $id, 128 ); ?> | |
<div class="author-details"> | |
<?php | |
//get challenge submissions from gravity forms | |
function get_profile_info($email){ | |
$search_criteria = array( | |
'status' => 'active', | |
'field_filters' => array( | |
'mode' => 'any', | |
array( | |
'key' => '3', | |
'value' => $email | |
), | |
) | |
); | |
//'key' => '1', 'operator' => 'contains', 'value' => 'Steve' | |
$entries = GFAPI::get_entries( 1, $search_criteria ); | |
if ( !empty($entries) ){ | |
// var_dump($entries); | |
echo '<div class="author-profile"><h3>Details</h3><ul>'; | |
foreach ($entries as $entry) { | |
$twitter = $entry['5']; | |
$age = $entry['6']; | |
$company = $entry['11']; | |
$nationality = $entry['8']; | |
$education = $entry['9']; | |
$experience = $entry['10']; | |
$participant = $entry['15']; | |
if ($twitter){ | |
echo '<li>Twitter: ' . $twitter .'</li>'; | |
} | |
if($age){ | |
echo '<li>Age: ' . $age .'</li>'; | |
} | |
if ($company){ | |
echo '<li>Company: ' . $company .'</li>'; | |
} | |
if ($nationality){ | |
echo '<li>Nationality: ' . $nationality .'</li>'; | |
} | |
if ($education){ | |
echo '<li>Education: ' . $education .'</li>'; | |
} | |
if ($experience){ | |
echo '<li>Experience: ' . $experience .'</li>'; | |
} | |
if ($participant){ | |
echo '<li>Participant: ' . $participant .'</li>'; | |
} | |
} | |
echo '</ul></div>'; | |
} | |
} | |
$email = get_the_author_meta( 'user_email', $curauth->ID ); | |
get_profile_info($email); | |
?> | |
<?php | |
// $twitter = get_the_author_meta( 'twitter', $curauth->ID ); | |
// //echo '<i class="fa fa-twitter"></i><a href="http://twitter.com/'.$twitter.'">' . $twitter . '</a>'; | |
// echo '<div class="tweet-holder"><a class="twitter-timeline" href="https://twitter.com/' . $twitter . '?ref_src=twsrc%5Etfw">Tweets by ' . $twitter . '</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div>'; | |
?> | |
<?php /* Start the Loop */ ?> | |
<?php if ( have_posts() ) : ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<div class="post"> | |
<?php if ( has_post_thumbnail() ): | |
the_post_thumbnail('full', array( 'class'=>'img-responsive feat-img' ) ); | |
endif;?> | |
<a href="<?php the_permalink();?>"><h3 class="ctitle"><?php the_title();?></h3></a> | |
<p class="meta-info"><small class="date">Posted: <?php the_time('M d, Y');?></small> | <small class="author">By: <?php the_author(); comments_number( ' - 0 comments', ' - 1 comment', ' - % comments' ); ?> </small></p> | |
<p><?php the_excerpt();?></p> | |
<p><a class="read-more" href="<?php the_permalink();?>"><?php _e( 'Read More', 'kau');?></a></p> | |
<div class="hline"></div> | |
<div class="spacing"></div> | |
</div> | |
<?php endwhile; ?> | |
<?php the_posts_navigation(); ?> | |
</div> | |
<?php get_sidebar(); ?> | |
</div> | |
<div class="row"> | |
<!--POST FORM --> | |
<div id="write-content-form" class="col-md-8"> | |
<?php echo do_shortcode('[gravityform id="6" title="false" description="false"]');?> | |
</div> | |
<!--IDEA FORM --> | |
<div id="write-idea-form" class="col-md-8"> | |
<h3>Submit an Idea</h3> | |
<p>Your ideas should be based on the following challenge:</p> | |
<p>The challenge is: how would it be possible to use technological and social media advancements to foster sustainable environmental development?</p> | |
<?php echo do_shortcode('[gravityform id="2" title="false" description="false"]');?> | |
</div> | |
<div class="col-md-8"> | |
<!--previous loop home--> | |
</div> | |
<?php else : ?> | |
<?php //get_template_part( 'template-parts/content', 'none' ); ?> | |
<div class="col-md-8"><h2>No content yet but it'll be here soon.</h2></div> | |
<?php endif; ?> | |
</div><! --/row --> | |
</div><! --/container --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment