I am just toying around with wordpress and php and am stuck.
In a functions.php file in wordpress, I'm creating two basic example shortcodes using this
<?php
add_shortcode('addAudioFile', 'addAudioFile');
function addAudioFile( $atts, $content = null )
{
return '<li class="audio_file">' . $content . '</li>';
}
add_shortcode('addAudioPlayer', 'addAudioPlayer');
function addAudioFile()
{
return '<audio preload></audio>';
}
The first one just turns the user content into a list item, and the second just calls an instance of the plugin audio.js. As it is written,the admin panel breaks and I assume I am missing something to my syntax.
What is it??? Thanks!!!
PS one shortcode in the php file works fine, but when I add them both, it doesn't work. This is all that is in the functions file.
PHP does not allow to overwrite functions, so you can't have two functions with the same name. You need to rename the second one.