• I don’t know this is still the case but a few months back I realized that you can’t generate a clickable link with a shortcode using s2Members. The [s2File] displays url only.

    I searched the old forums and found a confirmation there.

    It turns out that it is actually quite easy to mend that hole. I have written the following shortcode using s2File as a base:

    function eskeinet_s2Link_shortcode($atts,  $content = null){
        extract(shortcode_atts(
            array('download' => false,
                'download_key' => 0),
            $atts
        ));
    
        $return_string = '';
        if(!$content){
            $content = "Download File";
        }
        if($download && $download_key){
            $return_string = '<a href="'.do_shortcode('[s2File download="'.$download.'" download_key="true" /]').'">'.$content.'</a>';
        }elseif($download){
            $return_string = '<a href="'.do_shortcode('[s2File download="'.$download.'" /]').'">'.$content.'</a>';
        }
        return $return_string;
    }
    add_shortcode('s2Link', 'eskeinet_s2Link_shortcode');

    You can check my blog for more details.

    https://ww.wp.xz.cn/plugins/s2member/

The topic ‘s2File link shortcode’ is closed to new replies.