I try to print a text from a widget located in a sidebar, when I use the code below, I get an array that looks like the following: Array ([0] => text-2 [1] => text-3)
How can I print the text in text-2?
$siderbar = 'lank_i_header';
$the_sidebars = wp_get_sidebars_widgets();
print_r( $the_sidebars[$siderbar]);
I tried with the following code also but it just print "text-2"
print_r($the_sidebars[$siderbar][0] );
try
foreach ($the_sidebars[$siderbar] as $sidebar_data){
echo $sidebar_data.'<br>';
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.