This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper-function outputs the correct form element (input tag, select tag, checkbox tag) for the given item | |
* @param $aOptionKey string name of the option (un-prefixed) | |
* @param $aOptionMeta mixed meta-data for $aOptionKey (either a string display-name or an array(display-name, option1, option2, ...) | |
* @param $savedOptionValue string current value for $aOptionKey | |
* @return void | |
*/ | |
protected function createFormControl($aOptionKey, $aOptionMeta, $savedOptionValue, $aOptionFormat = 'select') { | |
if (is_array($aOptionMeta) && count($aOptionMeta) >= 2) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$page_id = $wp_query->post->id; // using global var to reference current post/page outside of loop in wordpress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function process_form($entry_id, $form_id) { | |
global $frmdb, $wpdb; | |
$created_post_id = $wpdb->get_var("SELECT post_id FROM $frmdb->entries WHERE id=".$entry_id.""); | |
// whatever else this function is supposed to do | |
} | |
add_action('frm_after_create_entry', 'process_form', 50, 2); | |
// low priority to ensure that the post has actually been created - careful not to fire too soon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('input:submit').click(function(){ | |
jQuery('input:submit').val("Form submiting....."); | |
jQuery('input:submit').attr("disabled", true); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body, html {background:#444; text-align:center; padding:50px 0;} | |
/* The CSS */ | |
select { | |
padding:3px; | |
margin: 0; | |
-webkit-border-radius:4px; | |
-moz-border-radius:4px; | |
border-radius:4px; | |
-webkit-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function disable_wpautop() { | |
if (get_post_type() == 'frm_display') // replace with slug of your desired post type | |
remove_filter('the_content', 'wpautop'); | |
} | |
add_action('wp_head', 'disable_wpautop'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- place styles and jQuery somewhere in the page containing the form, or in the form's "Customize HTML" after the submit button --> | |
<style> | |
/*** | |
* styles for tabs | |
***/ | |
.tab_heading { | |
background-color: #ddd; | |
color: #aaa; | |
font-size: 13px; | |
display: inline-block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var string_to_slug = function (str) | |
{ | |
str = str.replace(/^\s+|\s+$/g, ''); // trim | |
str = str.toLowerCase(); | |
// remove accents, swap ñ for n, etc | |
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; | |
var to = "aaaaeeeeiiiioooouuuunc------"; | |
for (var i=0, l=from.length ; i<l ; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function string_to_slug(str) { | |
str = str.replace(/^\s+|\s+$/g, ''); // trim | |
str = str.toLowerCase(); | |
// remove accents, swap ñ for n, etc | |
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; | |
var to = "aaaaeeeeiiiioooouuuunc------"; | |
for (var i=0, l=from.length ; i<l ; i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cleanup () { | |
var textContent = jQuery('.wp-editor-area').val(); | |
textContent = textContent | |
.replace(/(\<center\>)(["a-z,.!?':;@£$%=\[\]{}^&*()_”“–—‘’\-\+0-9 \n]*)(\<\/center\>)/ig, "<blockquote>$2</blockquote>") | |
.replace(/(\<img.+\/\>)/g, "\n\n") | |
.replace(/(\<i\>)(.*)(\<\/i\>)/g, "<em>$2</em>") | |
.replace(/(\<b\>)(.*)(\<\/b\>)/g, "<strong>$2</strong>"); | |
jQuery('.wp-editor-area').val(textContent); | |
}; |
OlderNewer