Contact Form 7 Lightbox

Files to edit using WP code editor (Appearance > Editor):-

  1. header.php
  2. single_property.php

New Contact Form 7 also need to be created

header.php

Original (about line 47-74)

<link media="screen" rel="stylesheet" href="<?php bloginfo('template_url'); ?>/includes/colorbox/style1/colorbox.css" />
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/includes/colorbox/jquery.colorbox.js"></script>
<script type="text/javascript">
		$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$("a[rel='example1']").colorbox();
			$("a[rel='example2']").colorbox({transition:"fade"});
			$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
			$("a[rel='slideshow']").colorbox({slideshow:true});
			$(".example5").colorbox();
			$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
			$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
			$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
			$(".example9").colorbox({
				onOpen:function(){ alert('onOpen: colorbox is about to open'); },
				onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
				onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
				onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
				onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
			});

			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
		});
	</script>

 

Changed to …

<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/includes/colorbox/jquery.colorbox.js"></script>
<script type="text/javascript">
		$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$("a[rel='example1']").colorbox();
			$("a[rel='example2']").colorbox({transition:"fade"});
			$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
			$("a[rel='slideshow']").colorbox({slideshow:true});
			$(".example5").colorbox();
			$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
			$(".post-edit-link").colorbox({
				width:"80%",
				height:"80%",
				iframe:true,
				onClosed:function(){ location.reload(); },
				overlayClose:false
			});
			$(".edit-form").colorbox({
				width:"80%",
				height:"80%",
				iframe:true,
				onClosed:function(){ location.reload(); },
				overlayClose:false
			});
			$(".callup").colorbox({width:"50%", inline:true, href:"#cflightbox"});
			$(".example9").colorbox({
				onOpen:function(){ alert('onOpen: colorbox is about to open'); },
				onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
				onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
				onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
				onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
			});

			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
		});
	</script>

… and So now, new jquery colorbox hook now can be used with a tag by class (post-edit-link, edit-form & callup) attribute. Moved to second file..

single_property.php

3 links will be created as follow:-

i – Edit Post link ( about line 18 – 20)

<a title="<?php the_permalink(); ?>" href="<?php the_permalink(); ?>" rel="bookmark"><span class="singletitle"><?php the_title();echo '&nbsp;&nbsp;'; ?></span></a><br/><br/>

</div>

changed to …

<a title="<?php the_permalink(); ?>" href="<?php the_permalink(); ?>" rel="bookmark"><span class="singletitle"><?php the_title();echo '&nbsp;&nbsp;'; ?></span></a><br/><br/>
	<p><?php edit_post_link('Edit Post','',''); ?></p>
</div>

ii – Contact Form 7 popup and Edit Form link (about line 55 – 59)

 

<?php foreach (get_more_fields($post->ID) as $field) {
	echo '<strong>'.$field->label.'</strong>: ' . ' ' . $field->value. '<br/>';
}?>
</div>
<div style="clear:both;"></div>

changed to

 

<?php foreach (get_more_fields($post->ID) as $field) {
	echo '<strong>'.$field->label.'</strong>: ' . ' ' . $field->value. '<br/>';
}?>
<p>
	<a class='callup' href="#">Contact Now</a>
	<?php if ( current_user_can( 'edit_plugins' ) ){ ?>
	 | <a class='edit-form' href="<?php bloginfo('wpurl') ?>/wp-admin/admin.php?contactform=7&page=wpcf7">Edit Form</a>
	<?php } ?>
</p>
</div>
<div style="clear:both;"></div>

iii – Contact Form box and auto select dropdown (about line 81-83)

	</div>

<?php get_footer();?>

changed to … (make sure the number(7) in shortcode matched to form no created in next step

 

			</div>

<?php if ( function_exists('do_shortcode') ) : ?>
	<div style='display:none'>
		<div id='cflightbox' style='margin:0 auto; padding:10px; background:#fff;'>
			<h2 style="text-align:center">Boat Request Form</h2>
				<div class="textwidget">
				<?php echo do_shortcode( '[contact-form-7 404 "Not Found"]' ); ?>
				</div>
				<div style="clear:both;"></div>
		</div>
	</div>
<script type="text/javascript">
$(document).ready(function(){
	$("#boatname option").each(function()
	{
	   if($(this).val()=='<?php echo $gv2; ?>'){
	   	$("select#boatname").val('<?php echo $gv2; ?>');
	   }
	    // add $(this).val() to your list
	});
});
</script>
<?php endif; ?>

<?php get_footer();?>

 

Create new Contact Form 7

i – Create new contact form ‘Lightbox’ name. Insert all code below to form textarea field

 

<div style="margin:20px;">
<table width="95%" style="margin: 0 auto;" cellpadding="5">
	<tr>
		<td>First Name (required)<br />
    		[text* your-first-name class:half_input] </td>
		<td>Last Name (required)<br />
    		[text* your-last-name class:half_input] </td>
    </tr>
	<tr>
    	<td>Your Email (required)<br />
    		[email* your-email class:half_input]</td>
		<td>Area code and Phone Number (required)<br />
    		[text* your-phone class:half_input] </td>
    </tr>
    <tr>
    	<td>Country <br />
    [select your-country class:half_input include_blank "United States" "United Kingdom" "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antarctica" "Antigua and Barbuda" "Argentina" "Armenia" "Aruba" "Australia" "Austria" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bosnia and Herzegovina" "Botswana" "Bouvet Island" "Brazil" "British Indian Ocean Territory" "Brunei" "Bulgaria" "Burkina Faso" "Burundi" "Cambodia" "Cameroon" "Canada" "Cape Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos (Keeling) Islands" "Colombia	" "Comoros" "Congo" "Congo, The Democratic Republic of the" "Cook Islands" "Costa Rica" "Côte d’Ivoire" "Croatia" "Cuba" "Cyprus" "Czech Republic" "Denmark" "Djibouti" "Dominica" "Dominican Republic" "East Timor" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Eritrea" "Estonia" "Ethiopia" "Falkland Islands" "Faroe Islands" "Fiji Islands" "Finland" "France" "French Guiana" "French Polynesia" "French Southern territories" "Gabon" "Gambia" "Georgia" "Germany" "Ghana" "Gibraltar" "Greece" "Greenland" "Grenada" "Guadeloupe" "Guam" "Guatemala" "Guinea" "Guinea-Bissau" "Guyana" "Haiti" "Heard Island and McDonald Islands" "Holy See (Vatican City State)" "Honduras" "Hong Kong" "Hungary" "Iceland" "India" "Indonesia" "Iran" "Iraq" "Ireland" "Israel" "Italy" "Jamaica" "Japan" "Jordan" "Kazakstan" "Kenya" "Kiribati" "Kuwait" "Kyrgyzstan" "Laos" "Latvia" "Lebanon" "Lesotho" "Liberia" "Libyan Arab Jamahiriya" "Liechtenstein" "Lithuania" "Luxembourg" "Macao" "Macedonia" "Madagascar" "Malawi" "Malaysia" "Maldives" "Mali" "Malta" "Marshall Islands" "Martinique" "Mauritania" "Mauritius" "Mayotte" "Mexico" "Micronesia, Federated States of" "Moldova" "Monaco" "Mongolia	" "Montserrat" "Morocco	Mozambique" "Myanmar" "Namibia" "Nauru" "Nepal" "Netherlands" "Netherlands Antilles" "New Caledonia" "New Zealand" "Nicaragua" "Niger" "Nigeria" "Niue" "Norfolk Island" "North Korea" "Northern Mariana Islands" "Norway" "Oman" "Pakistan" "Palau" "Palestine" "Panama" "Papua New Guinea" "Paraguay" "Peru" "Philippines" "Pitcairn" "Poland" "Portugal" "Puerto Rico" "Qatar" "Réunion" "Romania" "Russian" "Federation" "Rwanda" "Saint Helena" "Saint Kitts and Nevis" "Saint Lucia" "Saint Pierre and Miquelon" "Saint Vincent and the Grenadines" "Samoa" "San Marino" "Sao Tome and Principe" "Saudi Arabia" "Senegal" "Seychelles" "Sierra Leone" "Singapore" "Slovakia" "Slovenia" "Solomon Islands" "Somalia" "South Africa" "South Georgia and the South Sandwich Islands" "South Korea" "Spain" "Sri Lanka" "Sudan" "Suriname" "Svalbard and Jan Mayen" "Swaziland" "Sweden" "Switzerland" "Syria" "Taiwan" "Tajikistan" "Tanzania" "Thailand" "Togo" "Tokelau" "Tonga" "Trinidad and Tobago" "Tunisia" "Turkey" "Turkmenistan" "Turks and Caicos Islands" "Tuvalu" "Uganda" "Ukraine" "United Arab Emirates" "United Kingdom" "United States" "United States Minor Outlying Islands" "Uruguay" "Uzbekistan" "Vanuatu" "Venezuela" "Vietnam" "Virgin Islands, British" "Virgin Islands, U.S." "Wallis and Futuna" "Western Sahara" "Yemen" "Yugoslavia" "Zambia" "Zimbabwe"] </td>
    	<td>State<br />
    [text your-state class:half_input] </td>
	</tr>
    <tr>
    	<td colspan="2">Company<br />
    [text your-company class:full_input 94/] </td>
	</tr>
    <tr>
    	<td>New Or Used<br />
    [select your-condition class:half_input include_blank "New Built (12-14months to build)" "Used Boat (immediate delivery)"] </td>

    	<td>Boat Interested<br />
    [select your-boat id:boatname class:half_input include_blank "OBYO-33M PAK" "ESMG-44" "ESMG-50 Barb" "ESMG-50 Coastal" "ESMG-60" "52 Ghost Patrol" "13.5 GRP Patrol" "OBDUN-1160" "OBSA-6016" "OB-Patrol" "Helicopter / Crew / Patrol" "OBZO-11F-CAB" "OBZO-1010 ME RIB" "ESZO 2100 Enforcer" "53 Patrol with Rib" "OBZO-700JA Aluminium Rib" "11m Aluminium Assault Rib" "Eastern Sea King Patrol" "42m Passenger Ferry Boat" "ES32 RHIB" "Eastern Sea T70 Trawler" "53ft New Security Patrol Boat" "Firestorm 39" "Firestorm 43" "65 Research Vessel" "31 Enforcer" "ESZO 2800 Police Rib" "Yacht Fisherman" "50 Azimut 3 Stateroom" "80 Azimut Carat" "50 Azimut Flybridge" "46 Azimut Motor Yacht" "Mother Ship with 2 Ribs" "26 Dive Special" "ESNEW-50"] </td>
    </tr>
    <tr>
		<td colspan="2">Your Message<br />
    [textarea your-message class:full_input 72x10] </td>
    </tr>
    <tr>
		<td colspan="2">[captchac captcha-803 size:l]</td>
    </tr>
    <tr>
		<td colspan="2">Enter Code<br />
    [captchar captcha-803 class:half_input]</td>
    </tr>
    <tr>
		<td>[submit "Send"]</td>
    </tr>
    </table>
</div>

 

ii- Insert code to 1st mail textarea box and also change to, from and subject accordingly – this will set mail content send to admin

Hi Admin!

New form submitted via patrolboatforsale.org online form services as follow:

=========== Online Form Message =========

From: [your-first-name] [your-last-name] <[your-email]>
Subject: [your-subject]

Country : [your-country]
State : [your-state]
Company : [your-company]
Area code and Phone Number : [your-phone]
Boat Interested: [your-boat], [your-condition]

Message Body:

[your-message]

--
This mail is sent via contact form on http://patrolboatforsale.org

ii- Insert code to 2nd mail textarea box and also change to, from and subject field accordingly – this will set mail content send to user

 

Hi [your-first-name] [your-last-name],

We have received your submitted form and will contact you again later.

====== Your Message =====

Subject: [your-subject]

Country : [your-country]
State : [your-state]
Company : [your-company]
Area code and Phone Number : [your-phone]
Boat Interested: [your-boat]

Message Body:

[your-message]

--
This mail is sent via contact form on http://patrolboatforsale.org

 

Save the form and check the individual page…

Make sure inline editor or front end editor deactivated if Edit Post Link not worked

Related Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2011 - myPHPmaster. All rights reserved.
top

This is sample for Menu caller


Related Posts:

false

Related Posts: