antwal

Forum Replies Created

Viewing 1 post (of 1 total)
in reply to: Displaying download links without button or box #6074

antwal
Member

Hello,

I had the same problem, I solved it like this:

theme: functions.php

remove_shortcode(‘wpdm_file’,’wpdm_downloadable_nsc’);

function link_wpdm_downloadable_nsc($params) {
global $wpdb;
extract($params);

$home = home_url(‘/’);

$sap = count($_GET) > 0 ? ‘&’ : ‘?’;

$data = $wpdb->get_row(“select * from ahm_files where id=’$id'”, ARRAY_A);

if ($title == ‘true’) {
$title = “” . $data[‘title’] . “”;
} else {
$title = ”;
}

if ($desc == ‘true’) {
$desc = $data[‘description’] . “”;
} else {
$desc = ”;
$desc = stripslashes($desc);
}

if ($data[‘show_counter’] != 0) {
$hc = ‘has-counter’;
}

if ($template == ”) {
$template = ‘wpdm-only-button’;
}

$wpdm_login_msg = get_option(‘wpdm_login_msg’) ? get_option(‘wpdm_login_msg’) : ‘Login Required’;
$link_label = $data[‘link_label’] ? $data[‘link_label’] : ‘Download’;

if ($data[‘access’] == ‘member’ && !is_user_logged_in()) {
$url = get_option(‘siteurl’) . “/wp-login.php?redirect_to=” . $_SERVER[‘REQUEST_URI’];
$uuid = uniqid();

$html = “$link_label“;
} else {

if ($data[‘password’] == ”) {
$url = home_url(‘/?wpdmact=process&did=’ . base64_encode($id . ‘.hotlink’));
$classrel = “”;
} else {
$classrel = ‘haspass’;
$url = home_url(‘/’);
$password_field = “Enter password”;
}

$html = “$link_label“;
}
return $html;
}

add_shortcode(‘wpdm_file’,’link_wpdm_downloadable_nsc’);

I also had the need to capture only the link for two pdf in multi language, I created two separate files in the plugin with two different id, then I created a page for each language by entering the appropriate code in the shortcode and added dell’footer this:


$page = get_page_by_path(“info-page”); // Slug Path

if ($page) {
$post = get_page($page->ID);
$content_link = apply_filters(‘the_content’, $post->post_content);
$content_link = preg_replace(“//”, “$1”, $content_link);
$content_link = str_replace(“”, “”, $content_link);
} else {
$content_link = “”;
}

I hope I have solved your problem.

Viewing 1 post (of 1 total)