Guest User

WP-LiveEdit with User Role

a guest
Dec 18th, 2013
65
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.  
  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. <?php themify_post_before(); //hook ?>
  15. <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'); } ?>>
  16.     <?php themify_post_start(); //hook ?>
  17.    
  18.         <?php if ( $themify->hide_image != 'yes' ) : ?>
  19.        
  20.         <?php themify_before_post_image(); // Hook ?>
  21.        
  22.         <?php if ( themify_get( 'video_url' ) != '' ) : ?>
  23.            
  24.             <?php
  25.                 global $wp_embed;
  26.                 echo $wp_embed->run_shortcode('[embed]' . themify_get('video_url') . '[/embed]');
  27.             ?>
  28.  
  29.         <?php elseif( $post_image = themify_get_image($themify->auto_featured_image . $themify->image_setting . "w=".$themify->width."&h=".$themify->height) ) : ?>
  30.            
  31.             <figure class="post-image <?php echo $themify->image_align; ?>">
  32.                 <?php if( 'yes' == $themify->unlink_image): ?>
  33.                     <?php echo $post_image; ?>
  34.                 <?php else: ?>
  35.                     <a href="<?php echo themify_get_featured_image_link(); ?>"><?php echo $post_image; ?><?php themify_zoom_icon(); ?></a>
  36.                 <?php endif; // unlink image ?>
  37.             </figure>
  38.        
  39.         <?php endif; // video else image ?>
  40.        
  41.         <?php themify_after_post_image(); // Hook ?>
  42.  
  43.     <?php endif; // hide image ?>
  44.  
  45.     <div class="post-inner">
  46.        
  47.         <span class="post-icon"></span>
  48.         <!-- /post-icon -->
  49.        
  50.         <?php if($themify->hide_title != "yes"): ?>
  51.             <?php themify_before_post_title(); // Hook ?>
  52.             <?php if($themify->unlink_title == "yes"): ?>
  53.                 <h1 class="post-title"><?php the_title(); ?></h1>
  54.             <?php else: ?>
  55.                 <h1 class="post-title"><a href="<?php echo themify_get_featured_image_link(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
  56.             <?php endif; //unlink post title ?>
  57.             <?php themify_after_post_title(); // Hook ?>
  58.         <?php endif; //post title ?>
  59.         <!-- / Title -->
  60.  
  61.         <?php get_template_part('includes/loop-' . $themify->get_format_template()); ?>
  62.        
  63.         <?php if(is_single()): ?>
  64. <div <?php if( function_exists("live_edit") && $current_user_is_allowed_to_edit ){ live_edit('post_title, myfield2'); }?>>
  65.     <?php if( function_exists('the_field') ) the_field('myfield1'); ?> </div>
  66.     <?php if( function_exists('the_field') ) the_field('myfield2');  ?>
  67. </div>
  68.             <?php wp_link_pages(array('before' => '<p><strong>' . __('Pages:', 'themify') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
  69.  
  70.             <?php get_template_part( 'includes/author-box', 'single'); ?>
  71.            
  72.             <?php get_template_part( 'includes/post-nav'); ?>
  73.            
  74.             <?php if(!themify_check('setting-comments_posts')): ?>
  75.                 <?php comments_template(); ?>
  76.             <?php endif; ?>
  77.         <?php endif; ?>
  78.        
  79.     </div>
  80.     <!-- /.post-inner -->
  81.    
  82.     <?php themify_post_end(); //hook ?>
  83. </article>
  84. <!-- /.post -->
  85. <?php themify_post_after(); //hook ?>
Add Comment
Please, Sign In to add comment