Guest User

WP-LiveEdit with User Role

a guest
Dec 18th, 2013
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php if(!is_single()) { global $more; $more = 0; } //enable more link ?>
  2. <?php
  3. /** Themify Default Variables
  4.  *  @var object */
  5. global $themify; ?>
  6.  
  7. <?php
  8. // Check if User can Edit
  9. $current_user_is_allowed_to_edit = false;
  10. if ( current_user_can('delete_posts') ) {
  11.     $current_user_is_allowed_to_edit = true;
  12. }
  13. ?>
  14.  
  15. <?php themify_post_before(); //hook ?>
  16. <article id="post-<?php the_ID(); ?>" <?php post_class( 'post clearfix ' . $themify->get_categories_as_classes(get_the_ID()) . ' ' . $themify->get_post_color_class(get_the_ID()) ); if( function_exists("live_edit") && $current_user_is_allowed_to_edit ){ live_edit('post_title, post_content, field1'); } ?>>
  17.     <?php themify_post_start(); //hook ?>
  18.    
  19.         <?php if ( $themify->hide_image != 'yes' ) : ?>
  20.        
  21.         <?php themify_before_post_image(); // Hook ?>
  22.        
  23.         <?php if ( themify_get( 'video_url' ) != '' ) : ?>
  24.            
  25.             <?php
  26.                 global $wp_embed;
  27.                 echo $wp_embed->run_shortcode('[embed]' . themify_get('video_url') . '[/embed]');
  28.             ?>
  29.  
  30.         <?php elseif( $post_image = themify_get_image($themify->auto_featured_image . $themify->image_setting . "w=".$themify->width."&h=".$themify->height) ) : ?>
  31.            
  32.             <figure class="post-image <?php echo $themify->image_align; ?>">
  33.                 <?php if( 'yes' == $themify->unlink_image): ?>
  34.                     <?php echo $post_image; ?>
  35.                 <?php else: ?>
  36.                     <a href="<?php echo themify_get_featured_image_link(); ?>"><?php echo $post_image; ?><?php themify_zoom_icon(); ?></a>
  37.                 <?php endif; // unlink image ?>
  38.             </figure>
  39.        
  40.         <?php endif; // video else image ?>
  41.        
  42.         <?php themify_after_post_image(); // Hook ?>
  43.  
  44.     <?php endif; // hide image ?>
  45.  
  46.     <div class="post-inner">
  47.        
  48.         <span class="post-icon"></span>
  49.         <!-- /post-icon -->
  50.        
  51.         <?php if($themify->hide_title != "yes"): ?>
  52.             <?php themify_before_post_title(); // Hook ?>
  53.             <?php if($themify->unlink_title == "yes"): ?>
  54.                 <h1 class="post-title"><?php the_title(); ?></h1>
  55.             <?php else: ?>
  56.                 <h1 class="post-title"><a href="<?php echo themify_get_featured_image_link(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
  57.             <?php endif; //unlink post title ?>
  58.             <?php themify_after_post_title(); // Hook ?>
  59.         <?php endif; //post title ?>
  60.         <!-- / Title -->
  61.  
  62.         <?php get_template_part('includes/loop-' . $themify->get_format_template()); ?>
  63.        
  64.         <?php if(is_single()): ?>
  65. <div <?php if( function_exists("live_edit") && $current_user_is_allowed_to_edit ){ live_edit('post_title, myfield2'); }?>>
  66.     <?php if( function_exists('the_field') ) the_field('myfield1'); ?> </div>
  67.     <?php if( function_exists('the_field') ) the_field('myfield2');  ?>
  68. </div>
  69.             <?php wp_link_pages(array('before' => '<p><strong>' . __('Pages:', 'themify') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
  70.  
  71.             <?php get_template_part( 'includes/author-box', 'single'); ?>
  72.            
  73.             <?php get_template_part( 'includes/post-nav'); ?>
  74.            
  75.             <?php if(!themify_check('setting-comments_posts')): ?>
  76.                 <?php comments_template(); ?>
  77.             <?php endif; ?>
  78.         <?php endif; ?>
  79.        
  80.     </div>
  81.     <!-- /.post-inner -->
  82.    
  83.     <?php themify_post_end(); //hook ?>
  84. </article>
  85. <!-- /.post -->
  86. <?php themify_post_after(); //hook ?>
Add Comment
Please, Sign In to add comment