Contact Form 7 fields in Wordpress Posts/Pages - wordpress

How can I use Contact Form 7 form tags or shortcodes in WordPress Posts and Pages.
Any ideas would be appreciated.
Thanks in advance!

I believe you're looking for "how to add new fields and on submit button in contact form 7. "
The syntax for the form is like something below.
Here's a demo working code for you.
<div class="row clearfix">
<div class="form-group col-md-4 col-sm-6 col-xs-12">
<div class="form-group-inner">
<div class="icon-box">
<label for="your-name">
<span class="icon flaticon-user168"></span>
</label>
</div>
<div class="field-outer">
[text* your-name name:username id:your-name placeholder "Your Name"]
</div>
</div>
</div>
<div class="form-group col-md-4 col-sm-6 col-xs-12">
<div class="form-group-inner"><div class="icon-box">
<label for="your-email">
<span class="icon flaticon-new100"></span>
</label>
</div>
<div class="field-outer">
[email* name:email id:your-email placeholder "Email"]
</div>
</div>
</div>
<div class="form-group col-md-4 col-sm-12 col-xs-12">
<div class="form-group-inner">
<div class="icon-box">
<label for="your-subject">
<span class="icon flaticon-edition2"></span>
</label>
</div>
<div class="field-outer">
[text* name:subject id:your-subject placeholder "Subject"]
</div>
</div>
</div>
<div class="form-group col-md-12 col-sm-12 col-xs-12">
<div class="form-group-inner">
[textarea name:message placeholder "Your Message"]
</div>
</div>
<div class="form-group col-md-12 col-sm-12 col-xs-12 text-right">
[submit class:input-submit class:hvr-bounce-to-right name:submit-form "Send Message"]</div>
</div>
Paste the above code into your new contact form and it should create a new form with name, subject, email and message fields. You can call this form by using shortcode either in page or in your ".php" file. I used this in a php file like below:
<?php echo do_shortcode( "[contact-form-7 id='184' title='Contact form 1']", $ignore_html = false ); ?>
You can also post the shortcode from the contact form 7 into the page directly. Here is a small tutorial for you.

Related

CSS Contact Form 7 Spacing

I can't for the life of me figure out the spacing on my form.
As you'll see the checkboxes are all bunched up and look rubbish... can you league of coding legends help?
http://200620.co.uk/
This is the layout...
<div class="wpcf7-wrap">
<div class="col-sm-6">
[text* your-name placeholder "Name:"]
</div>
<div class="col-sm-6">
[text* your-email placeholder "Email:"]
</div>
<div class="col-sm-6">
[select* menu-383 placeholder "Are you coming?" "I'm there" "No, sorry"]
</div>
<div class="col-sm-6">
[select* menu-384 placeholder "Transport there & back?" "There" "Back" "Both"]
</div>
<div class="col-sm-6">
[text your-text-1 placeholder "Dietary Requirements:"]
</div>
<div class="col-sm-6">What do you drink?
[checkbox checkbox-133 label_first use_label_element "Gin" "Vodka" "Whiskey" "Rum" "Prosecco" "Soft Drinks"]
</div>
<div class="col-sm-6">
[text your-text-3 placeholder "What do you want to hear?"]
</div>
<div class="col-sm-12">
[textarea your-text-4 placeholder "Any Special Message for us?"]
</div>
<div class="col-xs-12 wpcf7-button-wrap">
[submit "RSVP Baby"]
</div>
</div>
Hopefully this puts you on the right track. I would move your checkboxes to after the other 2x2 columns so that it's all the way across. Also.. Wrap the whole thing in a div. Be careful not to add extra line breaks on your form, as Contact Form 7 uses the "Auto-P" function.
/*this should make the row stand on it's own*/
.checkbox-row {
margin: 1.5rem 0 .5rem 0;
}
<div class="wpcf7-wrap">
<div class="col-sm-6"> [text* your-name placeholder "Name:"] </div>
<div class="col-sm-6"> [text* your-email placeholder "Email:"] </div>
<div class="col-sm-6"> [select* menu-383 placeholder "Are you coming?" "I'm there" "No, sorry"] </div>
<div class="col-sm-6"> [select* menu-384 placeholder "Transport there & back?" "There" "Back" "Both"] </div>
<div class="col-sm-6"> [text your-text-1 placeholder "Dietary Requirements:"] </div>
<div class="col-sm-6"> [text your-text-3 placeholder "What do you want to hear?"] </div>
<div class="col-sm-12 checkbox-row"><div>What do you drink? [checkbox checkbox-133 label_first use_label_element "Gin" "Vodka" "Whiskey" "Rum" "Prosecco" "Soft Drinks"]</div></div>
<div class="col-sm-12"> [textarea your-text-4 placeholder "Any Special Message for us?"] </div>
<div class="col-xs-12 wpcf7-button-wrap"> [submit "RSVP Baby"] </div>
</div>
Just add below CSS code. Hope this help you.
.wpcf7-form-control.wpcf7-checkbox{
float: left;
width: 100%;
margin: 0;
padding: 0;
}

Press enter to send message to chat

i got a template site when i bought a package and it has a built in chat function, however you need to press a "send" button each time to send chat messages, this is the script used, i guess it is kinda easy to do it but in not good at scripting :/
<div class="col-lg-4 border-left affix-items scrollbar" id="room-items">
<div id="dropboxy">
<?php
?>
</div>
</div>
<div class="col-lg-6 affix-players" style="padding:10px;">
<div id="playersdropboxy">
<?php include_once("players.php"); ?>
</div>
<div id="affix-players" class="scrollbar">
<div id="rooms"></div> </div> </div> <div class="col-lg-5 affix-right">
<div class="col-xs-24 chat"> <div class="row chat-container">
<div class="row chat-buttons"> <div class="col-xs-24"> <div class="media-body"> <div class="input-group">
<input type="text" class="form-control chat-message" id="text-massage" style="margin-left:6px;" maxlength="300"> <span class="input-group-btn">
<?php if(isset($_SESSION['steamid'])) { ?>
<button class="btn btn-primary" type="submit" data-loading-text="<i class='fa fa-spinner fa-spin'></i> WAIT..." id="send_massage" style="margin-right:6px;">SEND</button>
<div class="sml-bnt" id="smile"></div>
<? }
else { ?>
<form method="get" action="index.php"><input type="hidden" name="login" value=""/><input type="submit" class="btn btn-primary" value="Log in to chat" style="margin-right:6px;"/></form>
<?php }
?>
</span> </div> </div> </div> </div>
<div class="col-xs-24 messages messages-img" style="width:250px;">
<?php if(isadmin($_SESSION['steamid'])){
echo'Admin tools: [clear chat], [turn '. (chaton() ? 'off' : 'on').']';
} ?>
<? include ('mini-chat.php'); ?>
</div> </div>
</div>
<div id="raffle"><div class="col-xs-24 raffle"> <div class="cont"> <div class="circle"> <img id="raffle-img"> </div> <h4 class="name" id="raffle-name"></h4>
<h4 id="countdown-raffle-timer" data-countdown="2020-08-08"></h4>
<a class="btn btn-default" href="?login">LOG IN</a> </div> </div> </div> </div> </div>
Try change method="get" to method="post"

ASP MVC Bootstrap-project - activate email-button

I've just implemented a bootstrap-theme in an empty ASP MVC-project. In the bootstrap there is an email-form. I want to activate the "send"-button and make it send an e-mail to me. I've seen different kind of sollutions when I've read about it:
Just use:
<a href="mailto:EMAILADDRESS">
or
form method="post" action="mailto:youremail#youremail.com" >
<input type="submit" value="Send Email" />
</form>
Or the more complicated way, to use jQuery and write things in both the model and controller.
So my question is: Why should I use the (to me) more complicated way?
Here is the code that came with the bootstrap:
<!-- Contact Section -->
#*<section id="contact">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Contact Me</h2>
<hr class="star-primary">
</div>
</div>
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<!-- To configure the contact form email address, go to mail/contact_me.php and update the email address in the PHP file on line 19. -->
<!-- The form should work on most web servers, but if the form is not working you may need to configure your web server differently. -->
<form name="sentMessage" id="contactForm" novalidate>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Name</label>
<input type="text" class="form-control" placeholder="Name" id="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Email Address</label>
<input type="email" class="form-control" placeholder="Email Address" id="email" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Phone Number</label>
<input type="tel" class="form-control" placeholder="Phone Number" id="phone" required data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Message</label>
<textarea rows="5" class="form-control" placeholder="Message" id="message" required data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<br>
<div id="success"></div>
<div class="row">
<div class="form-group col-xs-12">
<button type="submit" class="btn btn-success btn-lg">Send</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>*#
<!-- Footer -->
Assuming you plan to add more to your email-sending app in the future, you should prefer the seemingly complicated way because in the long run, it will actually make things simpler. This complicated way is based on a concept called 'Separation of Concerns'.
In short, breaking your code into a model and controller is more complicated if you only want a button that sends you an email. But as your program grows in complexity and you add more to it, this technique will make it easier to reuse or update particular aspects of your program.

How to align with the input in a bootstrap inline form?

Here is the link to my Plunker: link
The goal is to align the Sample Parking Ticket link with the textbox.
Please note the leading label has no class like col-xs-1 or something.
How can I achieve that?
You can use a bootstrap horizontal form.
Here is a plunkr:
<h1>Citation Form</h1>
<form name="citationSearchForm" class="form-horizontal" role="form">
<div class="form-group">
<label for="citationNumber" class="col-sm-3 control-label">Citation Number:</label>
<div class="col-sm-6">
<input type="text" name="citationNumber" class="form-control" id="citationNumber" placeholder="#" required="">
</div>
<div class="col-sm-3">
<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i>Search</button>
</div>
</div>
<div class="form-group">
<div class="col-sm-3 text-right">
<a id="lnkSample" href="#">Sample Parking Ticket</a>
</div>
</div>
</form>

Align checkboxes within modal popup

I'm using Twitter Bootstrap which has been mostly painless. However, I just ran into the following problem when using inline checkboxes in a modal popup:
The first row of the checkboxes are not aligned correctly.
Note that if I remove the inline property, this continues:
The offending code is as follows:
<div class="modal-body">
<form class="form-horizontal">
<div class="row-fluid">
<div class="span4">
<h4 style="display:inline !important;">Client: </h4>
</div>
<div class="span4">
<h4 style="display:inline !important;">Start Date: </h4>
</div>
<div class="span4">
<h4 style="display:inline !important;">End Date: </h4>
</div>
</div>
<br />
<div class="row-fluid">
<div class="span12">
<h4 style="display:inline !important;">Industry: </h4> TBA
</div>
</div>
<br />
<div class="row-fluid">
<h4>Role: </h4>
<label class="checkbox inline">
<input type="checkbox" value="2"> .NET Developer
</label>
<label class="checkbox inline">
<input type="checkbox" value="1"> Business Analyst
</label>
<label class="checkbox inline">
<input type="checkbox" value="14"> Change Manager
</label>
*SNIP*
</div>
<br />
<div class="row-fluid">
<div class="span12">
<h4>Scope of Work (max. 150 words): </h4>
<textarea class="bdBox" rows="3"></textarea>
</div>
</div>
<br />
<div class="row-fluid">
<div class="span12">
<h4>Deliverables (max. 150 words): </h4>
<textarea class="bdBox" rows="3"></textarea>
</div>
</div>
</form>
</div>
Shortened for brevity.
Does anyone have any ideas on this, or should I take it to the Bootstrap issue list?
Figured this out.
There are two lines in the bootstrap.css file:
.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle;}
.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px;}
The bottom line only applies the margin-left to checkboxes other than the first, meaning the first was not pushed across messing up the line.
If I move margin-left:10px into the first checkbox selector everything lines up. Mac's CSS was perfect for lining my checkboxes up too:
Here is something that I have tried and I suppose that is what you wanted
http://jsfiddle.net/xgKP4/

Resources