Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added play button to the front of each article #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading