Support » Plugin: Lana Downloads Manager » Hook to overwrite shortcode

  • Awesome Plugin, thanks a lot.

    But why all the unnecessary HTML in the shortcode? A div, p and an a-tag with bootstrap classes.

    A filter or hook to create custom HTML output would be awesome, as in my case I need inline links.

    Please consider this for upcoming updates, as it’s such a great plugin.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Lana Codes

    (@lanacodes)

    You can query the download URL with the following function:
    lana_downloads_manager_get_download_url($post_id)

    where post_id is the download post id.

    if you need more help, please feel free to contact us.

    Plugin Author Lana Codes

    (@lanacodes)

    Or at the download post type you see two values:
    Permalink: {url}
    Download Permalink: {download url}

    Use “Download permalink” at the link:
    <a href="{download url}">Download</a>

    Plugin Author Lana Codes

    (@lanacodes)

    Or if you need a custom shortcode, then we can create you.
    In this case, contact us by email at info@lana.codes and write us your requirements.

    Thanks a lot for the quick response.

    While this _get_download_url-function comes in handy, and creating a custom shortcode with it works flawless, I wouldn’t be able to use your “insert Shortcode” button in the editor anymore.

    I’d really appreciate a simple filter hook:
    return apply_filters('lana_download_shortcode', $output, $atts);

    Plugin Author Lana Codes

    (@lanacodes)

    For this case, there is a simpler solution:

    function lana_download_modified_shortcode( $atts ) {
    	// modified shortcode...
    }
    
    remove_shortcode( 'lana_download' );
    add_shortcode( 'lana_download', 'lana_download_modified_shortcode' );

    So remove default shortcode and add modified shortcode function.

    Note:
    The filter would not have too much use because you would overwrite the full shortcode anyway. The filter is useful if you want to rewrite part of the operation. Therefore removal and new addition are more logical in this case. But this is just a developer’s comment.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hook to overwrite shortcode’ is closed to new replies.