- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
This seems to be working except I get this error message…
“Notice: Undefined variable: template_url in /nas/content/live/agblogqa/wp-content/themes/agblog/functions.php on line 648”
My attempt at defining $template_url on the top row.
$template_url = "https://www.qa.apartmentguide.com";
function senior_func( $atts ){
print "<a href='{$template_url}/blog/wp-content/uploads/2018/05/Guide-Banner.jpg'>Link to Banner</a>";
}
add_shortcode( 'senior-guide', 'senior_func' );
I’m no backend developer but isn’t $atts
the function thats undefined. Your passing it into the function and it’s not assigned to anything.
use
$atts = shortcode_atts(
array(
'template_url' => 'https://www.default-url.com',
), $atts
);
and simply supplying a value. for example [template_url=’https://www.qa.apartmentguide.com’%5D
$template_url = "https://www.qa.apartmentguide.com";
function senior_func( $atts ){
$atts = shortcode_atts(
array(
'template_url' => 'https://www.default-url.com',
), $atts
);
print "<a href='{$template_url}/blog/wp-content/uploads/2018/05/Guide-Banner.jpg'>Link to Banner</a>";
}
add_shortcode( 'senior-guide', 'senior_func' );