View difference between Paste ID: GEUCebBi and 8u6bV018
SHOW: | | - or go back to the newest paste.
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
/* Start Paul's code */
7
8
<?php
9
// Check if User can Edit
10
// Set permission to false = 'not allowed'
11
$current_user_is_allowed_to_edit = false;
12-
 
12+
// Get the ID of the user who watches this post
13-
if ( current_user_can('delete_posts') || $post_author_ID == $user_ID ) {
13+
14-
	$current_user_is_allowed_to_edit = true;
14+
// Get the ID of the Post-Writer
15
$post_author_ID = the_author_meta('ID');
16
17
//   Check if User has role 'Editor' and higher  OR is the Post-Writer
18
if ( current_user_can('delete_posts') &&  get_post(filter_input(INPUT_POST, 'post_id'))->post_author == get_current_user_id() ) {
19
20
    // Set permission to true = 'allowed'
21
    $current_user_is_allowed_to_edit = true;
22
}
23
?>
24
/* End Paul's code */
25
26
<?php themify_post_before(); //hook ?>
27
<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'); } ?>>
28
	<?php themify_post_start(); //hook ?>
29
	
30
		<?php if ( $themify->hide_image != 'yes' ) : ?>
31
		
32
		<?php themify_before_post_image(); // Hook ?>
33
		
34
		<?php if ( themify_get( 'video_url' ) != '' ) : ?>
35
			
36
			<?php
37
				global $wp_embed;
38
				echo $wp_embed->run_shortcode('[embed]' . themify_get('video_url') . '[/embed]');
39
			?>
40
41
		<?php elseif( $post_image = themify_get_image($themify->auto_featured_image . $themify->image_setting . "w=".$themify->width."&h=".$themify->height) ) : ?>
42
			
43
			<figure class="post-image <?php echo $themify->image_align; ?>">
44
				<?php if( 'yes' == $themify->unlink_image): ?>
45
					<?php echo $post_image; ?>
46
				<?php else: ?>
47
					<a href="<?php echo themify_get_featured_image_link(); ?>"><?php echo $post_image; ?><?php themify_zoom_icon(); ?></a>
48
				<?php endif; // unlink image ?>
49
			</figure>
50
		
51
		<?php endif; // video else image ?>
52
		
53
		<?php themify_after_post_image(); // Hook ?>
54
55
	<?php endif; // hide image ?>
56
57
	<div class="post-inner">
58
		
59
		<span class="post-icon"></span>
60
		<!-- /post-icon -->
61
		
62
		<?php if($themify->hide_title != "yes"): ?>
63
			<?php themify_before_post_title(); // Hook ?>
64
			<?php if($themify->unlink_title == "yes"): ?>
65
				<h1 class="post-title"><?php the_title(); ?></h1>
66
			<?php else: ?>
67
				<h1 class="post-title"><a href="<?php echo themify_get_featured_image_link(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
68
			<?php endif; //unlink post title ?>
69
			<?php themify_after_post_title(); // Hook ?>
70
		<?php endif; //post title ?>
71
		<!-- / Title --> 
72
73
		<?php get_template_part('includes/loop-' . $themify->get_format_template()); ?>
74
		
75
		<?php if(is_single()): ?>
76
<div <?php if( function_exists("live_edit") && $current_user_is_allowed_to_edit ){ live_edit('post_title, myfield2'); }?>>
77
	<?php if( function_exists('the_field') ) the_field('myfield1'); ?> </div>
78
	<?php if( function_exists('the_field') ) the_field('myfield2');  ?>
79
</div>
80
			<?php wp_link_pages(array('before' => '<p><strong>' . __('Pages:', 'themify') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
81
82
			<?php get_template_part( 'includes/author-box', 'single'); ?>
83
			
84
			<?php get_template_part( 'includes/post-nav'); ?>
85
			
86
			<?php if(!themify_check('setting-comments_posts')): ?>
87
				<?php comments_template(); ?>
88
			<?php endif; ?>
89
		<?php endif; ?>
90
		
91
	</div>
92
	<!-- /.post-inner -->
93
	
94
    <?php themify_post_end(); //hook ?>
95
</article>
96
<!-- /.post -->
97
<?php themify_post_after(); //hook ?>