Skip to content

Commit

Permalink
Added play button to the front of each article
Browse files Browse the repository at this point in the history
  • Loading branch information
FilBlack committed Jan 28, 2024
1 parent c06ee66 commit 72f5408
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions assets/scss/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@
padding: 0;
border: none;
}
audio::-webkit-media-controls-panel {
background-color: #56AEFF;
}
.article-audio{
width: 800px;
}
audio[src*="empty"] {
display:none;
}
}

// style of file for download
Expand Down
14 changes: 14 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,20 @@ function smartwp_remove_wp_block_library_css(){
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );

/**
* Add a listen button to each post
*
* @author Filip Cerny
*/
function add_listen_btn($content){
if (is_single()) {
$listen_btn = "<audio id=\"play_button\"controls=\"true\" src=\"empty\" class= \"article-audio\"></audio>";
return $listen_btn . $content;
}
return $content;
}
add_filter('the_content', 'add_listen_btn', 20, 1);

/**
* Disable WordPress emojis
*
Expand Down
2 changes: 1 addition & 1 deletion style.css

Large diffs are not rendered by default.

0 comments on commit 72f5408

Please sign in to comment.