I want to do a specific action on current's episode span but I don't understand how this works. Let me explain in examples:
Marked span is the episode title.
Code responsible for listing these episode titles is:
if ( ! function_exists( 'masvideos_template_loop_episode_title' ) ) {
function masvideos_template_loop_episode_title() {
global $episode;
$episode_number = $episode->get_episode_number();
if( ! empty( $episode_number ) ) {
echo '<span class="masvideos-loop-episode__number episode__number">' . $episode_number . $keepchecked."<br />" . '</span>';
}
the_title( '<h3 class="masvideos-loop-episode__title episode__title">', '</h3>' );
}
I want to echo Yes or No next to this episode title based on row in database. I did it but I don't know how to put variable. When I just simply add my variable to this code it posts everywhere only one result f.e YES YES YES.
Getting value from DB:
$postID = get_queried_object_id();
$current_user = wp_get_current_user();
$current= $current_user->ID ;
$sql = "SELECT lastname FROM `$current` WHERE id = '$postID'";
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$keepchecked= $row['status'];
My main goal is to echo YES or NO next to separate episode title.