monaya
12-29-2012, 09:54 PM
I'm trying to access the variables in the array below outside of the function. I've tried everything :confused:
The variables I'm trying to access are bold and in red in the code below.
These variables are just not accessible outside the function.
function GenerateSitemap($params = array()) {
// default parameters
extract(shortcode_atts(array(
'title' => 'Site map',
'id' => 'sitemap',
'depth' => 2
), $params));
// create sitemap
$sitemap = wp_list_pages("title_li=&depth=$depth&sort_column=menu_order&echo=0");
if ($sitemap != '') {
$sitemap =
($title == '' ? '' : "<h2>$title</h2>") .
'<ul' . ($id == '' ? '' : " id=\"$id\"") . ">$sitemap</ul>";
}
return $sitemap;
}
add_shortcode('sitemap', 'GenerateSitemap');
function GenerateSitemap($params = array()) {
// default parameters
extract(shortcode_atts(array(
'title' => 'Site map',
'id' => 'sitemap',
'depth' => 2
), $params));
// create sitemap
$sitemap = wp_list_pages("title_li=&depth=$depth&sort_column=menu_order&echo=0");
if ($sitemap != '') {
$sitemap =
($title == '' ? '' : "<h2>$title</h2>") .
'<ul' . ($id == '' ? '' : " id=\"$id\"") . ">$sitemap</ul>";
}
return $sitemap;
}
add_shortcode('sitemap', 'GenerateSitemap');
Thanks!
The variables I'm trying to access are bold and in red in the code below.
These variables are just not accessible outside the function.
function GenerateSitemap($params = array()) {
// default parameters
extract(shortcode_atts(array(
'title' => 'Site map',
'id' => 'sitemap',
'depth' => 2
), $params));
// create sitemap
$sitemap = wp_list_pages("title_li=&depth=$depth&sort_column=menu_order&echo=0");
if ($sitemap != '') {
$sitemap =
($title == '' ? '' : "<h2>$title</h2>") .
'<ul' . ($id == '' ? '' : " id=\"$id\"") . ">$sitemap</ul>";
}
return $sitemap;
}
add_shortcode('sitemap', 'GenerateSitemap');
function GenerateSitemap($params = array()) {
// default parameters
extract(shortcode_atts(array(
'title' => 'Site map',
'id' => 'sitemap',
'depth' => 2
), $params));
// create sitemap
$sitemap = wp_list_pages("title_li=&depth=$depth&sort_column=menu_order&echo=0");
if ($sitemap != '') {
$sitemap =
($title == '' ? '' : "<h2>$title</h2>") .
'<ul' . ($id == '' ? '' : " id=\"$id\"") . ">$sitemap</ul>";
}
return $sitemap;
}
add_shortcode('sitemap', 'GenerateSitemap');
Thanks!