mc_pop_mm_insert_form_after_paragraph

The MailChimp Popup with Exit Support mc pop mm insert form after paragraph function.

Description

mc_pop_mm_insert_form_after_paragraph( $insertion, $paragraph_id, $content ); 

Parameters (3)

0. $insertion
The insertion.
1. $paragraph_id
The paragraph id.
2. $content
The content.

Usage

  1. if ( !function_exists( 'mc_pop_mm_insert_form_after_paragraph' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'mailchimp-popup-with-exit-support/mailchimp-popup-mailmunch.php'; 
  3.  
  4. // The insertion. 
  5. $insertion = null; 
  6.  
  7. // The paragraph id. 
  8. $paragraph_id = null; 
  9.  
  10. // The content. 
  11. $content = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = mc_pop_mm_insert_form_after_paragraph($insertion, $paragraph_id, $content); 
  15.  

Defined (1)

The function is defined in the following location(s).

/mailchimp-popup-mailmunch.php  
  1. function mc_pop_mm_insert_form_after_paragraph($insertion, $paragraph_id, $content) { 
  2. $closing_p = '</p>'; 
  3. $paragraphs = explode($closing_p, $content); 
  4. if ($paragraph_id == "middle") { 
  5. $paragraph_id = round(sizeof($paragraphs)/2); 
  6.  
  7. foreach ($paragraphs as $index => $paragraph) { 
  8. if (trim($paragraph)) { 
  9. $paragraphs[$index] .= $closing_p; 
  10.  
  11. if ($paragraph_id == $index + 1) { 
  12. $paragraphs[$index] .= $insertion; 
  13. return implode('', $paragraphs);