Support » Plugin: Radio Station » Remove link to automatic show page

  • Resolved mj187

    (@mj187)


    Is there a way to link show-title to an existing page.

    So not use the automatic show page?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Tony Zeoli

    (@tonyzeoli)

    There may be a filter for this. I’ll ask @majick to respond and he will when he can get to this. Sorry for the delay.

    Plugin Contributor majick

    (@majick)

    @mj187 Yes there is a filter for the show link URL on schedule displays: radio_station_schedule_show_link

    So for example, you could add a filter that would return false for the Tabs view and this would remove links to all Show’s page on the schedule:

    add_filter( 'radio_station_schedule_show_link', 'custom_show_link' );
    function custom_show_link( $url, $show_id, $view ) {
        if ( 'tabs' == $view ) {return false;}
        return $url;
    }

    But if you want to link the show to an existing page, you may need extra code to get the page URL for that Show ID. Probably the easiest way would be to get that from a post meta field for example:

    add_filter( 'radio_station_schedule_show_link', 'custom_show_link' );
    function custom_show_link( $url, $show_id, $view ) {
        if ( 'tabs' == $view ) {return get_post_meta( $show_id, 'page_url', true );}
        return $url;
    }
    Thread Starter mj187

    (@mj187)

    Thank you @majick – I just want to check as I am not an expert on plugins just yet 🙂 – did you change the function name in 2.3.1.4 – as when I add a filter to the theme functions, based on your advice – nothing is returned so I think there is a mismatch somewhere?

    Thread Starter mj187

    (@mj187)

    @majick If you get a chance can you double check this please – when I add to functions.php to remove the link, the whole master schedule disappears?

    Thread Starter mj187

    (@mj187)

    @majick Any help would be appreciated, I tried variations of the function to use a custom post type for the link but everything I have tried still just removes everything from the page?

    Plugin Contributor majick

    (@majick)

    @mj187 In those second example on that page referenced, you would need to add a custom field with key page_url to the Show in the Custom Fields metabox.

    This is a simple filter, I can’t see anything in the code that would make the whole schedule disappear, perhaps there is a syntax error but I don’t see one.

    Try adding the code to a single PHP file in /wp-content/mu-plugins/ instead of in your child theme functions.php

    • This reply was modified 7 months, 1 week ago by majick.
    Thread Starter mj187

    (@mj187)

    Thanks, I did try the must use plugin option but the same issue happens in that the whole page disappears beyond the H1. I’ll keep trying to debug as there must be a conflict somewhere as you’re right, the filter content doesn’t have any errors!

    Thread Starter mj187

    (@mj187)

    @majick Thanks again for the help with this. I’ve been unable to find the root of the issue, even with just this plugin on a clean install the problem still exists with both filters. When I move this to live from staging may have to just use 301s as a temporary fix.

    I wonder if a future enhancement could include the ability to change this URL as part of the plugin?

    Cheers!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Remove link to automatic show page’ is closed to new replies.