Code Snippet – Fitness type

<?php
$post_type = get_option('member_post_tracker_post_type');
	$button_image = get_option('member_post_tracker_button_image'); // Get button image URL
	if (!empty($post_type) && is_user_logged_in()) {
	    $post_id = get_the_id();
	    $user_id = get_current_user_id();
	    $read_posts = get_user_meta($user_id, 'read_posts', true);
	    // Check if the current post has been marked as read
	    if (is_array($read_posts) && in_array($post_id, $read_posts)) {
	        //button markup here with custom image
	        $button_markup = '<button class="mark-as-read-button post-tracker-button" data-post-id="' . $post_id . '"><img src="' . $button_image . '" alt="Marked as Read" /></button>';
	        echo $button_markup;
	    }
	}
	?>
«
»