Hi all
I'm using Wordpress, I have three simple pages with the titles - Page One, Page Two, Page Three
Each page has a tag of 'content'.
For each page I would like to create an array with a name the same as that page so Page_One[], Page_Two[] etc.
I would like to then add and retrieve vales from this array.
In the example here the is_Array echo says it's and array.
The print_r and count show the array is empty.
Is it possible to create an associative array and name it dynamically here, then add and retrieve values.
<?php
$mt_test_args = array(
'post_type' => 'page',
'tag' => 'font',
'order' => 'ASC'
);
$mt_test_loop = new WP_Query($mt_test_args);
if($mt_test_loop->have_posts()):
while($mt_test_loop->have_posts()):
$mt_test_loop->the_post();
$weight = get_post_meta($post->ID,'weight',false);
// create array for each font
$arr_name = get_the_title();
$arr_name = str_replace(' ','_',$arr_name);
${$arr_name} = array();// The font array
echo is_Array($$arr_name) ? 'yes' : 'no';
// Add text and font size keys to array
$$arr_name[$text] = 'first text';
$$arr_name[$font_size] = '2';
?>
<option><?php the_title(); ?></option>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
<?php
print_r($Alber_New);
echo count($Alber_New);
echo $Alber_New[$text];
?>