Advertisement
Guest User

frontend-edit

a guest
Jul 19th, 2017
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. <?php
  2.  
  3. // =============================================================================
  4. // VIEWS/INTEGRITY/WP-SINGLE.PHP
  5. // -----------------------------------------------------------------------------
  6. // Single artist post output for Integrity.
  7. // =============================================================================
  8.  
  9. $fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );
  10.  
  11. if ( ( is_user_logged_in() && $current_user->ID == $post->post_author ) ) { // Execute code if user is logged in or user is the author
  12. acf_form_head();
  13. wp_deregister_style( 'wp-admin' );
  14. }
  15. get_header();
  16.  
  17. ?>
  18.  
  19. <div class="x-container max width offset">
  20. <div class="<?php x_main_content_class(); ?>" role="main">
  21.  
  22. <?php while ( have_posts() ) : the_post(); ?>
  23. <?php x_get_view( 'ethos', 'artists', get_post_format() ); ?>
  24. <?php x_get_view( 'global', '_comments-template' ); ?>
  25. <?php endwhile; ?>
  26.  
  27. </div>
  28.  
  29. <div>
  30. <?php
  31. /* Show the edit button to the post author only */
  32. if ( ( is_user_logged_in() && $current_user->ID == $post->post_author ) ) { ?>
  33. <a class='post-edit-button' href="<?php echo get_permalink() ?>?action=edit">Edit Post</a>
  34. <?php }
  35.  
  36. <?php
  37. if (isset($_GET['action'])) {
  38. if($_GET['action'] == 'edit') { ?>
  39. <div class="acf-edit-post">
  40. <?php
  41. if ( ( is_user_logged_in() && $current_user->ID == $post->post_author ) ) {
  42. echo "<div class='acf-edit-post'>";
  43. acf_form (array(
  44. 'field_groups' => array(478,5977), // Same ID(s) used before
  45. 'form' => true,
  46. 'return' => '%post_url%',
  47. 'submit_value' => 'Save Changes',
  48. 'post_title' => true,
  49. 'post_content' => true,
  50. ));
  51. echo "</div>";
  52. }
  53. ?> </div>
  54. <?php }
  55. }
  56. ?>
  57. </div>
  58.  
  59. <div id="container">
  60.  
  61. <div id="left-col">
  62.  
  63. <div class="entry-featured"><br /><br />
  64. <?php the_post_thumbnail('thumbnail'); ?>
  65. </div><!--end entry featured div-->
  66.  
  67. <div class="profile-field"><strong>LOCATION:</strong>&nbsp;<?php echo get_post_meta( get_the_ID() , 'location', true ); ?>
  68. </div>
  69.  
  70. </div><!--end left column div-->
  71.  
  72.  
  73. <div id="right-col">
  74.  
  75. <h1><?php the_title(); ?></h1>
  76.  
  77. <div class="social-profile">
  78.  
  79. <?php if( get_field('website') ): ?><a href="<?php echo get_post_meta( get_the_ID() , 'website', true ); ?>" class="website" title="Website" target="_blank" style="outline: medium none;"><i class="fa fa-globe" aria-hidden="true"></i></a><?php endif; ?>
  80.  
  81. <?php if( get_field('instagram') ): ?><a href="<?php echo get_post_meta( get_the_ID() , 'instagram', true ); ?>" class="instagram" title="Instagram" target="_blank">
  82. <i class="x-icon-instagram-square" data-x-icon="" aria-hidden="true"></i></a><?php endif; ?>
  83.  
  84. <?php if( get_field('facebook') ): ?><a href="<?php echo get_post_meta( get_the_ID() , 'facebook', true ); ?>" class="facebook" title="Facebook" target="_blank" style="outline: medium none;"><i class="x-icon-facebook-square" data-x-icon="" aria-hidden="true"></i></a><?php endif; ?>
  85.  
  86. <?php if( get_field('twitter') ): ?><a href="<?php echo get_post_meta( get_the_ID() , 'twitter', true ); ?>" class="twitter" title="Twitter" target="_blank">
  87. <i class="x-icon-twitter-square" data-x-icon="" aria-hidden="true"></i></a><?php endif; ?>
  88.  
  89. <?php if( get_field('youtube') ): ?><a href="<?php echo get_post_meta( get_the_ID() , 'youtube', true ); ?>" class="youtube" title="Youtube" target="_blank">
  90. <i class="x-icon-youtube" data-x-icon="" aria-hidden="true"></i></a><?php endif; ?>&nbsp;&nbsp;
  91.  
  92. <br> <br>
  93.  
  94.  
  95. </div><!--end social profile div-->
  96.  
  97. <div class="bio">
  98. <?php if( get_field('bio') ): ?>
  99. <?php the_field('bio'); ?>
  100. <?php endif; ?>
  101. </div>
  102.  
  103. <div class="logo">
  104. <?php
  105.  
  106. $image = get_field('logo');
  107.  
  108. if( !empty($image) ): ?>
  109.  
  110. <a href="<?php echo $image['url']; ?>" rel="foobox"><img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" width="200" /></a>
  111. <br><br>
  112.  
  113. <?php endif; ?>
  114. </div>
  115.  
  116. </div><!--end right column div-->
  117. </div><!--end scontainer div-->
  118. <div id="container">
  119.  
  120. <div class="embed-container">
  121. <?php the_field('featured_video'); ?>
  122. </div>
  123. <style>
  124. .embed-container {
  125. position: relative;
  126. padding-bottom: 56.25%;
  127. height: 0;
  128. overflow: hidden;
  129. max-width: 100%;
  130. height: auto;
  131. }
  132.  
  133. .embed-container iframe,
  134. .embed-container object,
  135. .embed-container embed {
  136. position: absolute;
  137. top: 0;
  138. left: 0;
  139. width: 100%;
  140. height: 100%;
  141. }
  142. </style>
  143. <div class="gap"><br><br><br></div>
  144.  
  145. <div class="gallery"><br><br>
  146.  
  147. <?php
  148.  
  149. $images = get_field('gallery');
  150.  
  151. if( $images ): ?>
  152. <ul class="gallery">
  153. <?php foreach( $images as $image ): ?>
  154. <li>
  155. <a href="<?php echo $image['url']; ?>" rel="foobox">
  156. <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
  157. </a>
  158. <p><?php echo $image['caption']; ?></p>
  159. </li>
  160. <?php endforeach; ?>
  161. </ul>
  162. <?php endif; ?>
  163.  
  164.  
  165.  
  166. </div><!-- end gallery div -->
  167.  
  168.  
  169. </div>
  170.  
  171.  
  172.  
  173. <?php if ( $fullwidth != 'on' ) : ?>
  174. <?php //get_sidebar(); ?>
  175. <?php endif; ?>
  176. </div>
  177.  
  178.  
  179. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement