Advertisement
marjwyatt

Genesis Custom Sidebar with Custom User Profile Fields

Sep 10th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.55 KB | None | 0 0
  1. <div id="PortfolioUpper">
  2. <?php
  3.     // ref link: http://wordpress.org/support/topic/access-author-data-outside-loop-in-sidebar
  4.     // ref link: http://wordpress.org/support/topic/custom-singlephp-for-specific-author
  5.     // ref link: http://codex.wordpress.org/Function_Reference/get_the_author_meta
  6.     // ref link: http://codex.wordpress.org/Function_Reference/get_the_category
  7.     // ref link: http://codex.wordpress.org/Function_Reference/get_the_category#Get_the_Post_Categories_From_Outside_the_Loop
  8.     // ref link: http://wordpress.org/support/topic/get-tags-outside-the-loop
  9.     genesis_structural_wrap( 'sidebar' );
  10.     global $post;
  11.     $thePostID = $posts[0]->ID;
  12.     $thePostCat = get_the_category($thePostID);
  13.     $posttags = get_the_tags($thePostID);
  14.     $authorID = $posts[0]->post_author;
  15.     $artist = get_the_author_meta('display_name',$authorID);
  16.     $artistWebSite = get_the_author_meta('url',$authorID);
  17.     $artistWebSite2 = get_the_author_meta('website2',$authorID);
  18.     $artistBio = get_the_author_meta('description',$authorID);
  19.     $artistBioWYSIWYG = get_the_author_meta('intro_text',$authorID);
  20.     $artistPhone = get_the_author_meta('business_phone',$authorID);
  21.     $artistCompany = get_the_author_meta('business_name',$authorID);
  22.     $artistAddress = get_the_author_meta('business_address',$authorID);
  23.     $artistLat = get_the_author_meta('business_latitude',$authorID);
  24.     $artistLong = get_the_author_meta('business_longitude',$authorID);
  25.     $artistTownship = get_the_author_meta('business_township',$authorID);
  26.     $artistGplus = get_the_author_meta('googleplus',$authorID);
  27.     $artistFacebook = get_the_author_meta('facebook',$authorID);
  28.     $artistTwitter = get_the_author_meta('twitter',$authorID);
  29.     $artistPinterest = get_the_author_meta('pinterest',$authorID);
  30.     $artistInstagram = get_the_author_meta('instagram',$authorID);
  31.     $artistYoutube = get_the_author_meta('youtube',$authorID);
  32.     $artistEmail = get_the_author_meta('user_email',$authorID);
  33.     do_action( 'genesis_before_sidebar_widget_area' );
  34.         echo '<div class="widget-wrap">';
  35.         //echo '<p>Author ID: '.$authorID.'</p>';
  36.         //echo '<p>Post ID: '.$thePostID.'</p>';
  37.         //echo '<p>Post Category: '.$thePostCat.'</p>';
  38.         //echo '<p>Post Category Name: '.$thePostCatName.'</p>';
  39.         //echo '<p>see what is what: '.var_dump($thePostCat).'</p>';
  40.         echo '<h4 class="widget-title widgettitle">'.$artist.'</h4>';
  41.         echo 'Category: <a href="'.get_category_link($thePostCat[0]->term_id ).'">'.$thePostCat[0]->cat_name.'</a>';
  42.         if ($posttags) {
  43.             echo '<p>Post Tags: <br>';
  44.             foreach($posttags as $tag) {
  45.                 echo '<p><a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a></p>';
  46.             }
  47.         }
  48.         echo ( wpautop($artistBio) );
  49.         //echo ( wpautop($artistBioWYSIWYG) );
  50.         echo '<p>'.$artistPhone.'</p>';
  51.         echo '<p><a rel="nofollow" href="'.$artistWebSite.'">'.$artistWebSite.'</a></p>';
  52.         echo '<p><a rel="nofollow" href="'.$artistWebSite2.'">'.$artistWebSite2.'</a></p>';
  53.         echo '<ul id=cpt-connections>';
  54.         if (!empty($artistGplus)) {
  55.             echo '<li class="cpt-googleplus"><a rel="nofollow" href="'.$artistGplus.'">'.$artistGplus.'</a></li>';
  56.         }
  57.         if (!empty($artistFacebook)) {
  58.             echo '<li class="cpt-facebook"><a rel="nofollow" href="'.$artistFacebook.'">'.$artistFacebook.'</a></li>';
  59.         }
  60.         if (!empty($artistTwitter)) {
  61.             echo '<li class="cpt-twitter"><a rel="nofollow" href="'.$artistTwitter.'">'.$artistTwitter.'</a></li>';
  62.         }
  63.         if (!empty($artistPinterest)) {
  64.             echo '<li class="cpt-pinterest"><a rel="nofollow" href="'.$artistPinterest.'">'.$artistPinterest.'</a></li>';
  65.         }
  66.         if (!empty($artistInstagram)) {
  67.             echo '<li class="cpt-instagram"><a rel="nofollow" href="'.$artistInstagram.'">'.$artistInstagram.'</a></li>';
  68.         }
  69.         if (!empty($artistYoutube)) {
  70.             echo '<li class="cpt-youtube"><a rel="nofollow" href="'.$artistYoutube.'">'.$artistYoutube.'</a></li>';
  71.         }
  72.         if (!empty($artistEmail)) {
  73.             echo '<li class="cpt-email"><a href="mailto:'.$artistEmail.'">'.$artistEmail.'</a></li>';
  74.         }
  75.         echo '</ul>';
  76.         echo '<p>'.$artistCompany.'</p>';
  77.         echo '<p>'.$artistTownship.'</p>';
  78.         echo '<p>'.$artistAddress.'</p>';
  79.         echo '</div>';
  80.     do_action( 'genesis_after_sidebar_widget_area' );
  81.     genesis_structural_wrap( 'sidebar', 'close' );
  82. ?>
  83. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement