Jump to content

Archived

This topic is now archived and is closed to further replies.

jinfinite8

Text Section <p> tags

Recommended Posts

jinfinite8

HI,

 

I have a shortcode in use on a PageLines DMS site. When I use the shortcode in a text box section the form displays with <p> tags for hidden fields on my form. This creates a huge amount of white space in the form. This does not happen when the shortcode is used in post loop content.

 

Example test page:

http://www.foutsestatelaw.com/test-contact-page-clarke-2/

 

(First two forms are normal and placed using shortcodes in postloop. Last form is added to a text box section.

 

Is there something particular to text box sections in DMS that I need to factor in for use with shortcodes or hidden form fields?

 

Thanks

 

Running Dev PageLines DMS v116 with WP version 3.8.1

Share this post


Link to post
Share on other sites
greenfly

Hello @jinfinite8 

 

how are you generating the shortcodes? can you give us examples of the shortcode you are adding and the code used to generate the forms? are you achieving this via a plugin or bootstrap? 


The answer to many issues can be found by searching in the forum before posting as someone else  may very well have had the same problem before you have.  Also, reading the documentation can help you gain a good understanding of how everything works. 

 

Please do not send me private messages. Occam's razor - The principle states "Keep things simple!"

Share this post


Link to post
Share on other sites
jinfinite8

Hi Martin,

 

The shortcode is loaded by a php file in my DMS child theme, which in turn is loaded from functions.php in my child theme. I've pasted my functions.php and the form php file (foutsform.php) below.

 

functions.php

<?php 
//Setup the child theme.
require_once( dirname(__FILE__) . '/setup.php' );
//Get the theme's custom functions.
require_once( dirname(__FILE__) . '/lib/custom.php' );
require_once( dirname(__FILE__) . '/lib/types.php' );
require_once( dirname(__FILE__) . '/lib/shortcodes.php' );
require_once( dirname(__FILE__) . '/lib/taxes.php' );
 
//Get list of required/recommended plugins
//require_once dirname( __FILE__ ) . '/plugins/class-tgm-plugin-activation.php';
require_once dirname( __FILE__ ) . '/plugins/plugin-list.php';

// Force less

function theme_less(){
	?>
	<link rel="stylesheet/less" type="text/css" href="<?php echo dirname(__FILE__) . '/style.less'?>" />
	<?php;
}
add_action('wp_enqueue_scripts', 'theme_less');


// Loads the Fouts Form Short Code
include get_stylesheet_directory() . '/foutsform.php';

// Load the Session tracking on init()
add_action('init', 'myStartSession', 1);

function myStartSession() {
    if( !isset($_SESSION['tracking']) ) {
    	session_start();
		if( !empty($_GET) ) {
			//Get AdWords Tracking Data and Store in Session
			if ( isset( $_GET['utm_source'] ) ) {
				$_SESSION['utm_source'] =  $_GET['utm_source'];
				$_SESSION['tracking'] = true;
			}
			if ( isset( $_GET['utm_medium'] ) ) {
				$_SESSION['utm_medium'] =  $_GET['utm_medium'];
				$_SESSION['tracking'] = true;
			}
			if ( isset( $_GET['utm_term'] ) ) {
				$_SESSION['utm_term'] =  $_GET['utm_term'];
				$_SESSION['tracking'] = true;
			}
			if ( isset( $_GET['utm_adposition'] ) ) {
				$_SESSION['utm_adposition'] =  $_GET['utm_adposition'];
				$_SESSION['tracking'] = true;
			}
			if ( isset( $_GET['utm_placement'] ) ) {
				$_SESSION['utm_placement'] =  $_GET['utm_placement'];
				$_SESSION['tracking'] = true;
			}
			if ( isset( $_GET['utm_content'] ) ) {
				$_SESSION['utm_content'] =  $_GET['utm_content'];
				$_SESSION['tracking'] = true;
			}
			if ( isset( $_GET['utm_campaign'] ) ) {
				$_SESSION['utm_campaign'] =  $_GET['utm_campaign'];
				$_SESSION['tracking'] = true;
			}
			$_SESSION['full_query'] = $_SERVER['QUERY_STRING'];
		}
		if ( isset( $_GET['debug'] ) ) {
			echo 'myStartSession()<br />';
			echo session_id();
			echo '<hr /><h2>GET Dump</h2>';
			print_r($_GET);
			echo '<hr /><h2>SESSION Dump</h2>';
			print_r($_SESSION);
			echo '<hr /><h2>Link to Home Page</h2>';
			echo '<a href="' . home_url() . '?debug=true">Go Home</a>';
			//exit();
		}
    }
} 

and here's my form php file:

<?php

// Enqueue jQuery-Validate
function jq_validate() {
	//get_stylesheet_directory_uri() is required to find the javascript in the child themes directory
	wp_register_script( 'jquery.validate', get_stylesheet_directory_uri().'/js/jquery.validate.min.js', array('jquery'), '1.11.0' );
	wp_enqueue_script('jquery.validate');
}
add_action( 'wp_enqueue_scripts', 'jq_validate' );

// Enable Validation Script
function enable_validate() {
	//get_stylesheet_directory_uri() is required to find the javascript in the child themes directory
	wp_enqueue_script( 'enable-validate', get_stylesheet_directory_uri() . '/js/enable-validate.js', array(), '1.0.0', false );
}
add_action( 'wp_enqueue_scripts', 'enable_validate' );


// Add fouts_form short code
add_shortcode('fouts_form', 'fouts_form');

function fouts_form( $atts ) {
	$atts = shortcode_atts(
		array (
			'submit_label' => 'Submit',
			'form_css_class' => 'foutsform-container-form',
			'pagelocation_label' => 'Not Set',
			'action_label' => '',
			'form_version' => 'long',
			'form_label' => 'Email Jeff Fouts',
			'show_debug' => false
			), $atts );
		
	// Setup Shortcode Attributes
	$submit_label = $atts[ 'submit_label' ];
	$form_class = $atts[ 'form_css_class' ];
	$page_location = $atts[ 'pagelocation_label' ];
	$action_label = $atts[ 'action_label' ];
	$form_version = $atts[ 'form_version' ];
	$form_label = $atts[ 'form_label' ];
	$show_debug = $atts[ 'show_debug' ];
	
	//Setup Hidden Field Values
	//Get the current Page URL
	$page_source = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
	
	//Get the AdWords Tracking Data from Session
	$utm_source = isset($_SESSION['utm_source']) ? $_SESSION['utm_source'] : '';
	$utm_medium = isset($_SESSION['utm_medium']) ? $_SESSION['utm_medium'] : '';
	$utm_term = isset($_SESSION['utm_term']) ? $_SESSION['utm_term'] : '';
	$utm_adposition = isset($_SESSION['utm_adposition']) ? $_SESSION['utm_adposition'] : '';
	$utm_placement = isset($_SESSION['utm_placement']) ? $_SESSION['utm_placement'] : '';
	$utm_content = isset($_SESSION['utm_content']) ? $_SESSION['utm_content'] : '';
	$utm_campaign = isset($_SESSION['utm_campaign']) ? $_SESSION['utm_campaign'] : '';
	
	//Get Google Analytics Cookie Info for Organic Visitors
	$utm_z = isset($_COOKIE['__utmz']) ? $_COOKIE['__utmz'] : '';
	
	//Get the full query string for debug purposes
	$fullQuery = isset($_SESSION['full_query']) ? $_SESSION['full_query'] : '';	

	if( $show_debug ) {
		$debug_info = '<p>' . print_r(session_id(),true) . '</p><p>' . print_r($_SESSION,true) . '</p><p>' . print_r($atts,true) . '</p>';
	} else {
			$debug_info = '';		
	}

	$form_header = '
	<div class="foutsform-container">
		<div class="foutsformcenter">
	         <div id="call2action">
	            <h3>' . $form_label . '</h3>
	         </div>
	    </div>
		<div class="' . $form_class . '">

		<form action="https://foutslawfirm.infusionsoft.com/AddForms/processFormSecure.jsp" method="POST" class="validation">
		  <input  name="infusion_xid" value="ab0c4ca00de5c78970f729784296ff94" id="infusion_xid" type="hidden" />
		  <input name="infusion_type" value="CustomFormWeb"  id="infusion_type" type="hidden" />
		  <input name="infusion_name" value="Estate Planning Form"  id="infusion_name" type="hidden" />

		  <input name="Contact0_PageSource" id="Contact0_PageSource" type="hidden" value="' . $page_source . '" />
		  <input name="Contact0_PageLocation" id="Contact0_PageLocation" type="hidden" value="' . $page_location . '" />
		  <input name="Contact0_ActionLabel" id="Contact0_ActionLabel" type="hidden" value="' . $action_label . '" />

		  <input name="Contact0_UtmSource" id="Contact0_UtmSource" type="hidden" value="' . $utm_source . '" />
		  <input name="Contact0_UtmMedium" id="Contact0_UtmMedium" type="hidden" value="' . $utm_medium . '" />
		  <input name="Contact0_UtmTerm" id="Contact0_UtmTerm" type="hidden" value="' . $utm_term . '" />
		  <input name="Contact0_UtmCampaign" id="Contact0_UtmCampaign" type="hidden" value="' . $utm_campaign . '" />
		  <input name="Contact0_UtmAdPosition" id="Contact0_UtmAdPosition" type="hidden" value="' . $utm_adposition . '" />
		  <input name="Contact0_UtmPlacement" id="Contact0_UtmPlacement" type="hidden" value="' . $utm_placement . '" />
		  <input name="Contact0_UtmContent" id="Contact0_UtmContent" type="hidden" value="' . $utm_content . '" />
		  <input name="Contact0_utmZ" id="Contact0_utmZ" type="hidden" value="' . $utm_z . '" />
		  <input name="Contact0_FullQuery" id="Contact0_FullQuery" type="hidden" value="' . $fullQuery . '" />
		  ';

		  $form_long = '
		  <div class="form_block">
			<div class="fields">
			
			<label>*First Name</label>
				<input size="15" name="Contact0FirstName" id="Contact0FirstName" class="default-input required" type="text" />
				<span class="pf_hint_text"></span>
			</div>
			
			<div class="fields">
			<label>*Last Name</label>
				<input size="15" name="Contact0LastName" id="Contact0LastName" class="required" type="text" />
		        <span class="pf_hint_text"></span>
			</div>
			
			<div class="fields">
			<label>*Email</label>
				<input size="15" name="Contact0Email" id="Contact0Email" class="default-input required email" type="text" />
			</div>
		
			<div class="fields">
			<label>*Phone</label>
				<input size="15" name="Contact0Phone1" id="Contact0Phone1" class="default-input required phoneUS" type="text" />
			</div>

			<div class="fields">
			<label>Your Message</label>
				<textarea rows="5" class="default-input"  cols="24 " name="Contact0ContactNotes" id="Contact0ContactNotes" ></textarea>
			</div>
			';

		  $form_short = '
		  <div class="form_block">
			<div class="fields">
			
			<label>*First Name</label>
				<input size="15" name="Contact0FirstName" id="Contact0FirstName" class="default-input required" type="text" />
				<span class="pf_hint_text"></span>
			</div>
			
			<div class="fields">
			<label>*Email</label>
				<input size="15" name="Contact0Email" id="Contact0Email" class="default-input required email" type="text" />
			</div>
			';

			$form_footer = '
			<div class="fields">
			<label></label>
				<!-- <input value="' . $submit_label . '" name="Submit" id="Submit" class="button np inf-button" type="submit" /> -->
				<input type="image" src="/wp-content/uploads/2014/01/formbutton.png" input value="' . $submit_label . '" name="Submit" id="Submit"  type="submit" />
			</div>
		  </div>
		</form>
       </div>
	</div>
	'; //. $debug_info;

	if( $form_version == 'short' ) {
		return $form_header . $form_short . $form_footer;
	} else {
		return $form_header . $form_long . $form_footer;	
	}
	
} 

Share this post


Link to post
Share on other sites
jinfinite8

Forgot to show my actual shortcode:

 

This shortcode calls the short version of the form which has only first name and email address. The long version has more fields. 

 
[fouts_form submit_label="My Submit" form_css_class="MY-container-form" pagelocation_label="MY Label" action_label="MY Action Label" form_version="short" form_label="Signup for Newsletter"]

Share this post


Link to post
Share on other sites
James B

Hi there, the textbox uses wpautop - https://codex.wordpress.org/Function_Reference/wpautop which will automatically change the spaces to <p> tags or breaks.

 

Try using a text widget inside the wigetizer section instead.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
jinfinite8

Thank you - I'll give that a try! I appreciate your help.

Share this post


Link to post
Share on other sites
jinfinite8

That did the trick. Thanks again :-)

Share this post


Link to post
Share on other sites
James B

You're welcome, glad it worked. Have a great weekend.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites

×