I have a simple page structure like Page One, Page Two, Page Three.
Each page has tag of 'content'.
In the Wordpress loop how could I create an array for each page with the page title as the array name.
My code is like this.
<?php
$mt_test_args = array(
'post_type' => 'page',
'tag' => 'content',
'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();
//Trying to create array here from page title.
$arr_name = get_the_title();
$arr_name = str_replace(' ','_',$arr_name);
$arr_name = array();
?>
<option><?php the_title(); ?></option>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
This is demo code, the actual set up is a lot more complex