/** * Duplicate Post support * @param int $new_post_id * @param object $post * @since 2.0.0 */ function duplicate_post($new_post_id, $post) { $field_data = CFS()->get(false, $post->ID, array('format' => 'raw')); if (is_array($field_data)) { foreach ($field_data as $key => $value) { delete_post_meta($new_post_id, $key, $value); } } $post_data = array('ID' => $new_post_id); CFS()->save($field_data, $post_data); }
function options_html($key, $field) { ?> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Default Value', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'textarea', 'input_name' => "cfs[fields][{$key}][options][default_value]", 'value' => $this->get_option($field, 'default_value'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Formatting', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'select', 'input_name' => "cfs[fields][{$key}][options][formatting]", 'options' => array('choices' => array('none' => __('None', 'cfs'), 'auto_br' => __('Convert newlines to <br />', 'cfs')), 'force_single' => true), 'value' => $this->get_option($field, 'formatting', 'auto_br'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Validation', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'true_false', 'input_name' => "cfs[fields][{$key}][options][required]", 'input_class' => 'true_false', 'value' => $this->get_option($field, 'required'), 'options' => array('message' => __('This is a required field', 'cfs')))); ?> </td> </tr> <?php }
/** * @todo Filter value for each column * @global type $post * @param type $column * @param type $post_id */ function cpt_column($column) { global $post; switch ($column) { case 'cat_id': echo CFS()->get("category_id", $post->ID); break; case 'source': $source = CFS()->get("source", $post->ID); echo $source[0]; break; case 'post_status': echo $post->post_status; break; default: break; } }
function options_html($key, $field) { ?> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Message', 'cfs'); ?> </label> <p class="description"><?php _e('The text beside the checkbox', 'cfs'); ?> </p> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][message]", 'value' => $this->get_option($field, 'message'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Validation', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'true_false', 'input_name' => "cfs[fields][{$key}][options][required]", 'input_class' => 'true_false', 'value' => $this->get_option($field, 'required'), 'options' => array('message' => __('This is a required field', 'cfs')))); ?> </td> </tr> <?php }
function options_html($key, $field = null) { ?> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Output format', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'select', 'input_name' => "cfs[fields][{$key}][options][format]", 'options' => array('choices' => array('html' => __('HTML', 'cfs'), 'php' => __('PHP Array', 'cfs')), 'force_single' => true), 'value' => $this->get_option($field, 'format', 'html'))); ?> </td> </tr> <?php }
function options_html($key, $field) { ?> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Default Value', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][default_value]", 'value' => $this->get_option($field, 'default_value'))); ?> </td> </tr> <?php }
function options_html($key, $field) { ?> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Return Value', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'select', 'input_name' => "cfs[fields][{$key}][options][return_value]", 'options' => array('choices' => array('url' => __('File URL', 'cfs'), 'id' => __('Attachment ID', 'cfs')), 'force_single' => true), 'value' => $this->get_option($field, 'return_value', 'url'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Validation', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'true_false', 'input_name' => "cfs[fields][{$key}][options][required]", 'input_class' => 'true_false', 'value' => $this->get_option($field, 'required'), 'options' => array('message' => __('This is a required field', 'cfs')))); ?> </td> </tr> <?php }
?> <a href="<?php echo CFS()->get('catalogue_link'); ?> "><?php the_post_thumbnail(); ?> </a> <?php } ?> <p><a href="<?php echo CFS()->get('catalogue_link'); ?> "><?php the_title(); ?> </a></p> </div> <!-- end .vbox-box --> </div> <?php } ?> </div> <!-- end .g-row -->
<div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <h2> <?php echo CFS()->get('modal_formulario_title'); ?> </h2> <p> <?php echo CFS()->get('modal_formulario_text'); ?> </p> <?php echo do_shortcode('[contact-form-7 id="94" title="Formulario Afiliado"]'); ?> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <!-- this div is close in the [contact-form-7] --> <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> <!--/* END */--> <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> </div>
?> </section> <div class="clear"></div> </div> </main> <?php $values = CFS()->get('relaterte_saker'); if ($values != '') { ?> <div class="related"> <div class="head-container"><h3 class="head">Relaterte saker</h3></div> <main> <div class="thirds-container"> <?php $used_post_id = array(); $values = CFS()->get('relaterte_saker'); if ($values != '') { foreach ($values as $post_id) { echo '<div class="thirds">'; echo '<a href="' . get_permalink($post_id) . '">'; $relatertbilde = $cfs->get('artikkelbilde', $post_id); //echo '<div class="bilde">' . wp_get_attachment_image( $relatertbilde, 'medium' ) . '</div>'; $image = wp_get_attachment_url(get_post_thumbnail_id($post_id)); echo '<img class="thirds" src="' . $image . '" />'; echo '<h4>' . get_the_title($post_id) . '</h4'; echo '</a></div>'; array_push($used_post_id, $post_id); } } ?> </main>
/** * Restore revision custom fields * @see wp-includes/revision.php -> wp_restore_post_revision() */ function wp_restore_post_revision($post_id, $revision_id) { $field_data = CFS()->get(false, $revision_id, array('format' => 'raw')); CFS()->save($field_data, array('ID' => $post_id)); }
</div> <div class="header-news"> <a href="index.html" class="header-news_logo-link"> <img src="static/img/content/logo_108x1001.png" alt="" class="header-news_logo"> </a> </div> <div class="about"> <h2 class="main_title"><?php echo $post->post_title; ?> </h2> <div class="about_desc"> <?php echo CFS()->get('desc'); ?> </div> <div class="about_tasks"> <div class="about_tasks-row"> <div class="about_task"> <a href="mission.html" class="about_task-link"> <img src="static/img/content/Mission.jpg" alt="" class="about_task-img"> </a> <a href="mission.html" class="about_task-link">Наша миссия</a> </div> <div class="about_task"> <a href="team.html" class="about_task-link"> <img src="static/img/content/Team.jpg" alt="" class="about_task-img">
?> </p> </div> <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> <!--/* EVENTOS */--> <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> <div class="eventos spacing no-padding-top"> <div class="container text-center"> <h1 class="header black"><?php echo CFS()->get('eventos_title'); ?> </h1> <?php $arrayEventos = CFS()->get('eventos_array'); $arrayLength = count($arrayEventos); $arrayEnd = end($arrayEventos); foreach ($arrayEventos as $evento) { echo '<div class="row no-margin table-row">'; echo ' <div class="col-sm-4"> <h3 class="green2">' . $evento['evento_name'] . '</h3> <p class="gray">' . $evento['evento_date'] . '</p> </div> <div class="col-sm-8 black-bg"> <p class="text white"> ' . $evento['evento_text'] . ' </p> </div>'; echo '</div>';
} ?> </div> </div> <div class="main-container"> <div class="contentfield main"> <div class="parent-content"> <?php if (have_posts()) { while (have_posts()) { ?> <?php the_post(); echo '<div class="ingressteksten ingresscenter">'; $ingressteksten = CFS()->get('ingress'); if ($ingressteksten != '') { echo $ingressteksten; } echo '</div>'; $thispage = $post->ID; } } ?> </div> <!-- section --> <section class="kjerneside-l-2"> <div class="metainfo"> <span class="date"> <p>Elektroniske varer</p>
</tbody> </table> </div> </div> </div> <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> <!--/* CONSEJO OPERATIVO/VOLUNTARIOS */--> <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> <div class="operativo"> <div class="container"> <h1 class="header green text-center">EQUIPO OPERATIVO</h1> <table class="text"> <tbody> <?php $arrayOperativo = CFS()->get('operativo_array'); foreach ($arrayOperativo as $operativo) { echo '<tr>'; echo '<td class="text-right">' . $operativo['name'] . '</td>'; echo '<td class="text-left"><span>' . $operativo['job_position'] . '</span></td>'; echo '</tr>'; } ?> </tbody> </table> </div> </div> </div> <?php include 'footer.php';
{ if ('placement' == $column_name) { global $wpdb; $labels = array('post_types' => __('Post Types', 'cfs'), 'user_roles' => __('User Roles', 'cfs'), 'post_ids' => __('Post IDs', 'cfs'), 'term_ids' => __('Term IDs', 'cfs'), 'page_templates' => __('Page Templates', 'cfs'), 'post_formats' => __('Post Formats', 'cfs')); $results = $wpdb->get_var("SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = '{$post_id}' AND meta_key = 'cfs_rules' LIMIT 1"); $results = empty($results) ? array() : unserialize($results); foreach ($results as $criteria => $values) { $label = $labels[$criteria]; $operator = '==' == $values['operator'] ? '=' : '!='; echo "<div>{$label} " . $operator . ' [' . implode(' or ', $values['values']) . ']</div>'; } } } /** * Make sure that $cfs exists for template parts * @since 1.8.8 */ function parse_query($wp_query) { $wp_query->query_vars['cfs'] = $this; } } // Backwards-compatibility $cfs = CFS(); /** * Allow direct access to CFS classes */ function CFS() { return Custom_Field_Suite::instance(); }
</div> <div role="tabpanel" class="tab-pane fade" id="logo4"> <h1> <?php echo CFS()->get('cultura_title'); ?> </h1> <p> <?php echo CFS()->get('cultura_text'); ?> </p> </div> <div role="tabpanel" class="tab-pane fade" id="logo5"> <h1> <?php echo CFS()->get('estrategia_title'); ?> </h1> <p> <?php echo CFS()->get('estrategia_text'); ?> </p> </div> </div> </div> </div> </div> <?php include 'footer.php';
the_permalink(); ?> " class="post-title" itemprop="name headline url"> <?php the_title(); ?> </a> <?php Template::partial('meta.php'); ?> <div class="post-excerpt" itemprop="description"> <?php if ($lead = CFS()->get('list_lead')) { echo '<p class="lead">', $lead, '</p>'; } if ($img = CFS()->get('list_img')) { echo '<img src="', $img, '" class="full-width" alt="', get_the_title(), '" />'; } echo CFS()->get('list_copy') ?: the_excerpt(); ?> <a href="<?php the_permalink(); ?> " class="btn waves-effect"> Read more… </a> </div> </article>
</div> <div class="col-sm-6"> <img class="img-responsive center-block" src="<?php echo CFS()->get('sewa_img'); ?> " alt=""> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="NUTU4H2J8RSGG"> <input type="submit" class="gray-btn white center-block" border="0" name="submit" value="DONATE"> <img alt="" border="0" src="https://www.paypalobjects.com/es_XC/i/scr/pixel.gif" width="1" height="1"> </form> <p class="text text-left"> <strong>DEPOSIT OR TRANSFERENCE:</strong><br> <?php echo CFS()->get('deposito_sewa'); ?> </p> </div> </div> <p class="text formato"> If you require a tax verification receipt please fill out the following format and send to <a class="mail-to" href="mailto:contacto@promesaeducativa.org">contacto@promesaeducativa.org</a> </p> </div> <div class="container"> <div class="col-sm-12"><?php echo do_shortcode('[contact-form-7 id="172" title="Formulario para Donación"]'); ?> </div> </div> </div>
function recursive_html($group_id, $field_id, $parent_tag = '', $parent_weight = 0) { // Get loop field $loop_field = CFS()->api->get_input_fields(array('field_id' => $field_id)); // Get sub-fields $results = CFS()->api->get_input_fields(array('group_id' => $group_id, 'parent_id' => $field_id)); // Dynamically build the $values array $parent_tag = empty($parent_tag) ? "[{$field_id}]" : $parent_tag; eval("\$values = isset(\$this->values{$parent_tag} ) ? \$this->values{$parent_tag} : false;"); // Row options $row_display = $this->get_option($loop_field[$field_id], 'row_display', 0); $row_label = $this->get_option($loop_field[$field_id], 'row_label', __('Loop Row', 'cfs')); $button_label = $this->get_option($loop_field[$field_id], 'button_label', __('Add Row', 'cfs')); $css_class = 0 < (int) $row_display ? ' open' : ''; // Do the dirty work $row_offset = -1; if ($values) { foreach ($values as $i => $value) { $row_offset = max($i, $row_offset); ?> <div class="loop_wrapper"> <div class="cfs_loop_head<?php echo $css_class; ?> "> <a class="cfs_delete_field"></a> <a class="cfs_toggle_field"></a> <span class="label"><?php echo esc_attr($this->dynamic_label($row_label, $results, $values[$i])); ?> </span> </div> <div class="cfs_loop_body<?php echo $css_class; ?> "> <?php foreach ($results as $field) { ?> <label><?php echo $field->label; ?> </label> <?php if (!empty($field->notes)) { ?> <p class="notes"><?php echo $field->notes; ?> </p> <?php } ?> <div class="field field-<?php echo $field->name; ?> cfs_<?php echo $field->type; ?> "> <?php if ('loop' == $field->type) { ?> <?php $this->recursive_html($group_id, $field->id, "{$parent_tag}[{$i}][{$field->id}]", $i); ?> <?php } else { ?> <?php $args = array('type' => $field->type, 'input_name' => "cfs[input]{$parent_tag}[{$i}][{$field->id}][value][]", 'input_class' => $field->type, 'options' => $field->options); if (isset($values[$i][$field->id])) { $args['value'] = $values[$i][$field->id]; } elseif (isset($field->options['default_value'])) { $args['value'] = $field->options['default_value']; } CFS()->create_field($args); ?> <?php } ?> </div> <?php } ?> </div> </div> <?php } } ?> <div class="table_footer"> <input type="button" class="button-primary cfs_add_field" value="<?php echo esc_attr($button_label); ?> " data-loop-tag="<?php echo $parent_tag; ?> " data-rows="<?php echo $row_offset + 1; ?> " /> </div> <?php }
/** * Return an array of CFS field groups */ function get_field_groups() { global $wpdb; $field_groups = array(); $field_group_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'cfs' AND post_status = 'publish'"); $export = CFS()->field_group->export(array('field_groups' => $field_group_ids)); foreach ($export as $field_group) { $field_groups[$field_group['post_name']] = $field_group; } return $field_groups; }
echo wp_get_attachment_image(CFS()->get('headshot'), array(100, 100)); ?> <div class="review-content"> <?php echo CFS()->get('review_content'); ?> <p> <span class="reviewer-name">– <?php the_title(); ?> , </span> <span class="reviewer-creds"><?php echo esc_html(CFS()->get('job_title ')); ?> <span class="company-link"><?php echo CFS()->get('company_website'); ?> </span> </span> </p> </div> </li> <?php } wp_reset_postdata(); ?> </ul> </section> </div> </div>
<?php } wp_reset_postdata(); ?> </div> <div class="home-sidebar col span_9"> <h2 class="section-title"><svg class="icon icon-calendar"><use xlink:href="#icon-calendar"></use></svg> Upcoming Events</h2> <div class="events"> <?php $args = array('page_id' => 25); $loop = new WP_Query($args); while ($loop->have_posts()) { $loop->the_post(); $fields = CFS()->get('events'); $i = 0; foreach ($fields as $field) { $i++; if ($i <= 3) { $eventSlug = strtolower(str_replace(' ', '-', $field['title'])); ?> <div class="event"> <div class="row"> <div class="col span_8 event-date"> <span><?php echo $field['date']; ?> </span> </div> <div class="col span_16 event-info">
"> <?php the_post_thumbnail('medium'); ?> </a> <?php } ?> <div class="item-info"> <?php the_title('<span class="entry-title">', '</span>'); ?> <span class="filler">............................</span> <span class="price"><?php echo esc_html(CFS()->get('price')); ?> </span> </div> </div> <?php } ?> <?php the_posts_navigation(); ?> </div>
/** * Set up the HTML for the field options * * @param string $key * @param $field */ function options_html($key, $field) { if ($this->get_option($field, 'type') !== 'number') { $number_option_display = 'style="display: none;"'; } else { $number_option_display = ''; } ?> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Input Type', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'select', 'input_name' => "cfs[fields][{$key}][options][type]", 'options' => array('choices' => array('text' => 'text', 'email' => 'email', 'number' => 'number', 'tel' => 'tel', 'url' => 'url'), 'force_single' => true), 'value' => $this->get_option($field, 'type', 'text'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Cast Return Value', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'select', 'input_name' => "cfs[fields][{$key}][options][cast_to]", 'options' => array('choices' => array('string' => 'string', 'int' => 'int', 'float' => 'float', 'bool' => 'bool'), 'force_single' => true), 'value' => $this->get_option($field, 'cast_to', 'number'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Default Value', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][default_value]", 'value' => $this->get_option($field, 'default_value'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Placeholder', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][placeholder]", 'value' => $this->get_option($field, 'placeholder'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Required', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'true_false', 'input_name' => "cfs[fields][{$key}][options][required]", 'input_class' => 'true_false', 'value' => $this->get_option($field, 'required'), 'options' => array('message' => __('This is a required field', 'cfs')))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Validation Pattern', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][pattern]", 'value' => $this->get_option($field, 'pattern'))); ?> </td> </tr> <tr class="field_option field_option_<?php echo $this->name; ?> "> <td class="label"> <label><?php _e('Max Length', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][maxlength]", 'value' => $this->get_option($field, 'maxlength'))); ?> </td> </tr> <tr class="field_option field_option_cfsatf_number field_option_<?php echo $this->name; ?> " <?php echo $number_option_display; ?> > <td class="label"> <label><?php _e('<strong>Number:</strong> Min', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][min]", 'value' => $this->get_option($field, 'min'))); ?> </td> </tr> <tr class="field_option field_option_cfsatf_number field_option_<?php echo $this->name; ?> " <?php echo $number_option_display; ?> > <td class="label"> <label><?php _e('<strong>Number:</strong> Max', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][max]", 'value' => $this->get_option($field, 'max'))); ?> </td> </tr> <tr class="field_option field_option_cfsatf_number field_option_<?php echo $this->name; ?> " <?php echo $number_option_display; ?> > <td class="label"> <label><?php _e('<strong>Number:</strong> Step', 'cfs'); ?> </label> </td> <td> <?php CFS()->create_field(array('type' => 'text', 'input_name' => "cfs[fields][{$key}][options][step]", 'value' => $this->get_option($field, 'step'))); ?> </td> </tr> <?php }
echo CFS()->get('form_title_3', 10); ?> </a></li> </ul></p> <a class="btn" href="http://www5.njit.edu/humanresources/services/forms/">All Forms</a> </div><!-- /sidebar-forms --> <div class="sidebar-forms"><h1>Upcoming Events</h1> <h2><?php echo CFS()->get('event_title', 10); ?> </h2> <p><?php echo CFS()->get('event_text', 10); ?> </p> <a class="btn" href="<?php echo CFS()->get('event_link', 10); ?> ">Read more</a> </div><!-- /sidebar-forms --> </div><!-- /col-md-4 --> </div><!-- /.row --> </div><!-- /.container --> </div><!-- /page-content --> <?php get_template_part('parts/footer');
private function assemble_value_array(&$field_data, $hierarchy, $field, $field_value = false, $options = false) { $value =& $field_data; foreach (explode(':', $hierarchy) as $i) { $value =& $value[$i]; } if (false !== $field_value) { $value = (array) $value; $value[] = $field_value; } else { $value = CFS()->fields[$field->type]->prepare_value($value, $field); if ('api' == $options['format']) { $value = CFS()->fields[$field->type]->format_value_for_api($value, $field); } elseif ('input' == $options['format']) { $value = CFS()->fields[$field->type]->format_value_for_input($value, $field); } } }
// icon: image, title: 'Forbrukerrådet' }); } window.onload = initialize; </script> <div id="map-canvas"></div> </main> <main role="main" class="contentfield"> <div class="office"> <?php $innhold = CFS()->get('innhold'); if ($innhold != '') { echo '<p class="article-ingress">' . $innhold . '</p>'; } ?> </div> <div class="clear"></div> </main> <main role="main" class="contentfield wp-ansatte"> <div class="employees"> <h3>Ansatte</h3> <section class="pressebilder"> <?php $loop = $cfs->get('pressebilder'); foreach ($loop as $field) { ?>
/** * Render the HTML input form * @param array $params * @return string form HTML code * @since 1.8.5 */ public function render($params) { global $post; $defaults = array('post_id' => false, 'field_groups' => array(), 'post_title' => false, 'post_content' => false, 'post_status' => 'draft', 'post_type' => 'post', 'excluded_fields' => array(), 'confirmation_message' => '', 'confirmation_url' => '', 'submit_label' => __('Submit', 'cfs'), 'front_end' => true); $params = array_merge($defaults, $params); $input_fields = array(); $post_id = (int) $params['post_id']; if (0 < $post_id) { $post = get_post($post_id); } if (empty($params['field_groups'])) { $field_groups = CFS()->api->get_matching_groups($post_id, true); $field_groups = array_keys($field_groups); } else { $field_groups = $params['field_groups']; } if (!empty($field_groups)) { $input_fields = CFS()->api->get_input_fields(array('group_id' => $field_groups)); } // Hook to allow for overridden field settings $input_fields = apply_filters('cfs_pre_render_fields', $input_fields, $params); // The SESSION should contain all applicable field group IDs. Since add_meta_box only // passes 1 field group at a time, we use CFS()->group_ids from admin_head.php // to store all group IDs needed for the SESSION. $all_group_ids = false === $params['front_end'] ? CFS()->group_ids : $field_groups; $session_data = array('post_id' => $post_id, 'post_type' => $params['post_type'], 'post_status' => $params['post_status'], 'field_groups' => $all_group_ids, 'confirmation_message' => $params['confirmation_message'], 'confirmation_url' => $params['confirmation_url'], 'front_end' => $params['front_end']); // Set the SESSION $this->session->set($session_data); if (false !== $params['front_end']) { ?> <div class="cfs_input no_box"> <form id="post" method="post" action=""> <?php } if (false !== $params['post_title']) { ?> <div class="field" data-validator="required"> <label><?php echo $params['post_title']; ?> </label> <input type="text" name="cfs[post_title]" value="<?php echo empty($post_id) ? '' : esc_attr($post->post_title); ?> " /> </div> <?php } if (false !== $params['post_content']) { ?> <div class="field"> <label><?php echo $params['post_content']; ?> </label> <textarea name="cfs[post_content]"><?php echo empty($post_id) ? '' : esc_textarea($post->post_content); ?> </textarea> </div> <?php } // Detect tabs $tabs = array(); $is_first_tab = true; foreach ($input_fields as $key => $field) { if ('tab' == $field->type) { $tabs[] = $field; } } // Add any necessary head scripts foreach ($input_fields as $key => $field) { // Exclude fields if (in_array($field->name, (array) $params['excluded_fields'])) { continue; } // Skip missing field types if (!isset(CFS()->fields[$field->type])) { continue; } // Output tabs if ('tab' == $field->type && $is_first_tab) { echo '<div class="cfs-tabs">'; foreach ($tabs as $key => $tab) { echo '<div class="cfs-tab" rel="' . $tab->name . '">' . $tab->label . '</div>'; } echo '</div>'; $is_first_tab = false; } if (!isset($this->used_types[$field->type])) { CFS()->fields[$field->type]->input_head($field); $this->used_types[$field->type] = true; } // Ignore sub-fields if (1 > (int) $field->parent_id) { $validator = ''; if (in_array($field->type, array('relationship', 'user', 'loop'))) { $min = empty($field->options['limit_min']) ? 0 : (int) $field->options['limit_min']; $max = empty($field->options['limit_max']) ? 0 : (int) $field->options['limit_max']; $validator = "limit|{$min},{$max}"; } if (isset($field->options['required']) && 0 < (int) $field->options['required']) { if ('date' == $field->type) { $validator = 'valid_date'; } elseif ('color' == $field->type) { $validator = 'valid_color'; } else { $validator = 'required'; } } // Tab handling if ('tab' == $field->type) { // Close the previous tab if ($field->name != $tabs[0]->name) { echo '</div>'; } echo '<div class="cfs-tab-content cfs-tab-content-' . $field->name . '">'; } else { ?> <div class="field field-<?php echo $field->name; ?> " data-type="<?php echo $field->type; ?> " data-name="<?php echo $field->name; ?> " data-validator="<?php echo $validator; ?> "> <?php if ('loop' == $field->type) { ?> <span class="cfs_loop_toggle" title="<?php esc_html_e('Toggle row visibility', 'cfs'); ?> "></span> <?php } ?> <?php if (!empty($field->label)) { ?> <label><?php echo $field->label; ?> </label> <?php } ?> <?php if (!empty($field->notes)) { ?> <p class="notes"><?php echo $field->notes; ?> </p> <?php } ?> <div class="cfs_<?php echo $field->type; ?> "> <?php CFS()->create_field(array('id' => $field->id, 'group_id' => $field->group_id, 'type' => $field->type, 'input_name' => "cfs[input][{$field->id}][value]", 'input_class' => $field->type, 'options' => $field->options, 'value' => $field->value)); ?> </div> </div> <?php } } } // Make sure to close tabs if (!empty($tabs)) { echo '</div>'; } ?> <input type="hidden" name="cfs[save]" value="<?php echo wp_create_nonce('cfs_save_input'); ?> " /> <input type="hidden" name="cfs[session_id]" value="<?php echo $this->session->session_id; ?> " /> <?php if (false !== $params['front_end']) { ?> <input type="submit" value="<?php echo esc_attr($params['submit_label']); ?> " /> </form> </div> <?php } }
<?php } else { ?> <?php wp_redirect(get_bloginfo('siteurl') . '/404', 404); exit; ?> <?php } ?> <div class="benefits"> <div class="row"> <?php $fields = CFS()->get('benefits'); foreach ($fields as $field) { ?> <?php echo '<div class="col-md-3">'; ?> <?php echo '<a id="box" href="#' . $field['benefits_id'] . '" style="background-image:url(' . $field['benefits_image'] . ');" aria-controls="' . $field['benefits_id'] . '" role="tab" data-toggle="tab">'; ?> <?php echo '<h2>' . $field['benefits_header'] . '</h2>'; ?> <?php echo '<div id="overlay">'; ?>