The problem is that when I insert my shortcode into PageBuilder only the default value is excepted. The code is like this:
function Insert_Download($attr) {
$z = shortcode_atts(array(
'link_file' => 'xxxx',
'link_class' => 'e-countries__link',
'svg_path' => '#download',
'svg_class' => 'e-countries__link-svg'
), $attr);
$download = '<a class="'. esc_attr($z["link_class"]) . '" href="'. get_template_directory_uri(). '/' . esc_attr($z["link_file"]) . '" download>' . esc_html__('Download', 'fbstax-theme') . '<svg class="' . esc_attr($z["svg_class"]) .'" style="width:20px; height: 20px; margin-left: 20px"><use xlink:href=' . get_template_directory_uri(). '/img/svg/sprite.svg' . esc_attr($z["svg_path"]) . '></use></svg>'.'</a>';
return $download;
}
add_shortcode( 'InsertDownload', 'Insert_Download' );
So in my PageBuilder I insert this
[InsertDownload linkPath='downloads/poland/code_of_commercial_companies_in_poland.pdf']
But outcome attribute href looks like like this:
href="http://my.localclean.my/wp-content/themes/fbstax-theme/xxxx"
What is wrong?
You replace linkPath to link_file
[InsertDownload link_file='downloads/poland/code_of_commercial_companies_in_poland.pdf']