• Resolved thekrell

    (@thekrell)


    Hi there,

    I’d like to pull the current show’s ‘Avatar’ from the Radio Station plugin and post that Avatar elsewhere on the website …

    I’ve looked in the WordPress MySQL Database but I see no mention of Radio Station data in there … or I’m not looking in the right place …

    Obviously once I’ve achieved this I would probably like to pull the show time and remaining time as well ..

    Basically where is all the Radio Station data (the Show names & DJ Avatars that we inputted) kept? … is it all stored in the WordPress Database? … if not how can we access the data? …

    thanks for any help,

    Marty

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Tony Hayes

    (@majick)

    @thekrell Hi Marty,
    most of the Radio Station data for a Show is stored in the (prefixed)postmeta table for that post_id. So for example, show_avatar meta key stores the WordPress Media attachment ID of the Show Avatar, which you can get via get_post_meta( $show_id, 'show_avatar', true );, and then use that attachment ID to retrieve the Show Avatar image URL via wp_get_attachment_image_src. Or more expediently you can just use $url = radio_station_get_show_avatar_url( $show_id, $size ); which has already been written to achieve exactly this (you can see this function in includes/support-functions.php)

    Similarly, using the show_sched meta key you can retrieve an array of Show shifts for the passed $show_id, which you can then loop to pull show times etc. For calculating remaining times, I suggest either using the Current Show widget/shortcode, or looking at the code for that (in includes/shortcodes.php if you want to calculate it yourself – as there are a number of tricky bits and plugin functions that solve those, mostly around converting the Show Shift to the Station’s timezone into a universal timestamp and comparing that to the now timestamp in the same timezone.

    Hope that helps, Tony.

    • This reply was modified 3 years, 11 months ago by Tony Hayes.
    Thread Starter thekrell

    (@thekrell)

    Hi Majick/Tony,

    Thank you for the reply … that will help immensely for our project …

    On similar note, using [short-codes]:

    I cannot for the sake of me get ‘just’ the Avatar showing on its own … I’ve tried all combinations under the ‘Current Show Widget’ Doc page and I still get the ‘Title’ of the Show, along with the Avatar … this is the [short-code] I’m using:

    [current-show show_avatar=”1″ title=”0″ avatar_width=”50″ show_link=”0″ show_sched=”0″]

    Is it possible to show just the Avatar? … if so is this also true for all parts of the Widget? …

    Basically what I would like to do is this: Create a row showing the Widget data, instead of the data being stacked … this (for me) will look neater with our current setup … here’s a text visual of what I mean:

    Avatar | Show Title | Schedule Time | Remaining Time

    Thanks for the support,
    Marty

    P.S. Fantastic plugin by the way … can’t wait for the Pro version.

    Plugin Author Tony Zeoli

    (@tonyzeoli)

    @thekrell I’ll wait for @majick to come back through on this. Apologize for any delay. We’re working on PRO features at the moment. Tony should come back through to help.

    BTW, have you taken a look at the new layout options coming with PRO on the radiostationdemo.com site? We don’t specifically have a new row-based view for widgets, but it’s something we can consider, I think.

    Thread Starter thekrell

    (@thekrell)

    Hi Tony,

    Yes I did have a look … my favourites are the Table & Calendar layouts … the others are fine too but not for this project ?? …

    I’ve colour coded our (Table) Schedule, to the website colour theme … took a bit of CSS Kung Fu to get there … I think it looks great … very happy with it …

    https://vyparadio.co.uk/vypa-schedule/

    I quite like the Table layout, it’s good to see everything on one page, in one view … and it resizes perfectly on mobile devices …

    Thanks for the reply,

    Marty

    Plugin Author Tony Zeoli

    (@tonyzeoli)

    Thanks for sharing the URL of your schedule. Looks nice!

    @majick, can you answer the question about the show avatar in the hsort code from @thekrell. Thanks.

    Plugin Author Tony Zeoli

    (@tonyzeoli)

    @thekrell Actually, if Title is “0” in the shortcode, but the title displays, then this could simply be a bug in the code. Probably best ot carry this over to our Github repo where you can open an issue. Go to https://github.com/netmix/radio-station and issue your bug report there, where we can better pick it up and handle it through completion.

    Just curious – did you attempt to hide the title with CSS?

    Also, I can see if we can set a row layout for the widget, as well as a column that it is now.

    Plugin Author Tony Zeoli

    (@tonyzeoli)

    @thekrell sorry, I meant shortcode and not widget.

    Plugin Author Tony Zeoli

    (@tonyzeoli)

    @thekrell I set a Github issue here: https://github.com/netmix/radio-station/issues/356

    Basically set a Row style for the Current Show shortcode.

    Probably makes sense to add this for other widget shortcodes, as well. We’ll see.

    Plugin Author Tony Zeoli

    (@tonyzeoli)

    @thekrell After talking to Tony, there’s a filter to sort the section order that you can use in the shortcode/widget. And, you should be able to use CSS to display the sections as a row using display: inline-block;

    Hiding the title with “0” is a bug, but you can hide the Title with CSS anyway using .current.show.title display: none;"

    • This reply was modified 3 years, 9 months ago by Tony Zeoli.
    Plugin Contributor Tony Hayes

    (@majick)

    Just rechecking this one to add some more detail, the filter you can use for the widget section order is in includes/shortcodes.php and is radio_station_current_show_section_order.

    To hide the Show title would be: .current-show-title {display: none;} (and if you want this to work for a shortcode where there is a Current Show widget elsewhere on the page you would need .current-show-embedded .current-show-title {display: none;} to target just the shortcode not the widget.)

    The title attribute is actually for the overall Widget/Shortcode title, rather than toggling the display if the show title, sorry for the confusion – I will add a separate attribute for the show title as show_title to the development version so that can be used in future.

    We will look into the possible row display option for the widget/shortcode in the Github issue in the near future.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[MySQL] Pulling an avatar from Radio Station’ is closed to new replies.