Loop through MailPoet forms
-
Hello,
I need to show on my website a newsletter button for many countries, each one of them needs to be linked to a single newsletter form
My code right now looks like this:
$args = array( 'post_type' => 'countries', 'posts_per_page' => -1, 'order_by' => 'date', 'order' => 'ASC', 'post_status' => 'publish' ); $numberOfCountries = wp_count_posts('countries') -> publish; $loop = new WP_Query($args); if ($loop->have_posts()) { while ($loop->have_posts()) : $loop->the_post(); $form_widget = new Widget(); for ($j = 1; $j <= $numberOfCountries; $j++) { echo $form_widget->widget(array('form' => $j, 'form_type' => 'php')); }
but it seems inefficient since it shows for each countries every form created. How can I link each country to a single form inside my loop? Can someone help me?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Loop through MailPoet forms’ is closed to new replies.