WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP-Table Reloaded] Inserting audio player into tables (14 posts)

  1. adamsmark
    Member
    Posted 4 years ago #

    I'd like to use tables reloaded to organize Audio Player tracks. When I insert [audio:your_mp3_file.mp3] into a table, I get [audio:your_mp3_file.mp3], not the player itself. Ideas?

    http://wordpress.org/extend/plugins/wp-table-reloaded/

  2. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    this happens because the Audio Player plugin does not use regular WordPress Shortcodes, but its own version - which do not work out of the box in tables.

    You can easily make them work by adding the following line of code to the file "functions.php" of your theme.

    add_filter( 'wp_table_reloaded_cell_content', 'insert_audio_player' );

    Best wishes,
    Tobias

  3. Ricardo
    Member
    Posted 3 years ago #

    Hi Tobias, i have the same problem, i'd add the filter to the file funtions.php but nothin' happens. Can you help me?
    My idea is to make a song list like a ranking but with the ability of play each song.
    Sorry 'bout my english, not my first.

  4. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    do you have the "Audio Player" plugin installed? That's necessary for the Shortcodes to work of course.

    If yes, can you provide a link to the page with the table?

    Thanks,
    Tobias

  5. Ricardo
    Member
    Posted 3 years ago #

    Thanks for the quick response!
    I'm running the site locally for testing pourposes, but i create a page in another site and the same thing happend here's the link http://www.nrgfm.cl/prueba/

    i created 2 table, the first with shortcode, the audio player apears but outside the table with all the data.

    The second without the shortcode but no data is shown

    and finally before filter install in functions.php, tables work fine with correct height, and showing all data, and when i copy the code in functions.php the tables look like this http://www.nrgfm.cl/prueba/

    I hope that you can help me and one more time sorry my english
    Thanks

  6. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    ok, it is very weird that your tables are totally empty...
    This let's me assume that the "insert_audio_player" function has somehow changed.
    I believe, instead of returning a value, it is echoing it. That would explain both of the issues.

    Can you post a link to the exact plugin you are using for the Audio Player (I want to be sure, because there are several different ones.)?

    Then I should be able to find the correct code for you.

    Best wishes,
    Tobias

    P.S.: And don't worry about your English! :-)

    P.P.S.: Also, I might not be able to answer again until Monday, because I will be on a small vacation.

  7. Ricardo
    Member
    Posted 3 years ago #

    This is the player's link http://wordpress.org/extend/plugins/audio-player/
    One thing, in the first table, the shortcode works, data is there but outside the table (all text above the table is part of it).

    Thanks and have nice vacations

  8. TobiasBg
    Member
    Posted 3 years ago #

    Hi Ricardo,

    good news: As you were so quick with your answer, I have not yet left for vacation :-)

    Here is the solution. Please try again with this code in the functions.php

    add_filter( 'wp_table_reloaded_cell_content', array( &$AudioPlayer, 'processContent' ), 2 );

    The code presented above is no longer correct (as I had assumed, the function echoed its return value instead of just returning it, which is necessary). The new code should behave correctly :-)

    Best wishes,
    Tobias

  9. Ricardo
    Member
    Posted 3 years ago #

    Now works perfectly!!
    check it out http://www.nrgfm.cl/prueba/

    Very very thanks, you help me a lot
    Ricardo

  10. Saronsongs
    Member
    Posted 3 years ago #

    Hi Tobias, I also want to do this, using the same audio player, but haven't edited a .php file before.

    This is the last few lines of my functions.php file.

    Where do I add the piece of code, and do I add 'function' before 'add_filter etc.' and do I need to add any { and } as well?

    Thank you in advance for your help!
    Clare

    ========
    function _wp_mysql_week( $column ) {
    switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
    default :
    case 0 :
    return "WEEK( $column, 0 )";
    case 1 :
    return "WEEK( $column, 1 )";
    case 2 :
    case 3 :
    case 4 :
    case 5 :
    case 6 :
    return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";
    }
    }

    ?>

  11. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    just put that one line from above right before the ?> at the end of the file. Nothing else, no function or any {}.

    Regards,
    Tobias

  12. Saronsongs
    Member
    Posted 3 years ago #

    Yes, marvellous!
    Thank you very much -- also for the great table plugin!
    Best wishes, Clare

  13. LGRD
    Member
    Posted 3 years ago #

    Hello Tobias and all,

    I am making a website for a friend. I used wp-table reloaded to organise his mp3 tracks and applied the code above to enable the audio player to load.

    My problem comes in later: when I'm logged into my wordpress dashboard and view the page, it works fine but if I am not logged in, the audioplayer doesn't appear.

    I don't know what I'm missing.
    Thanks!
    LG

    UPDATE: I was scrolling through the options for the table in question and noticed the "Cache Table Output" option. Disabled that and it did the trick. For some reason that was interfering. (I don't know if it's related to the browser cache but I had cleared mine and also tried from multiple computers and smartphones)

    Anyways, just thought I would contribute my findings.

  14. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    thanks for this! Yes, the "Cache Table Output" functionality might have something to do with this, so turning it off is a good step here.

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Topic