Example #1
1
function zgm_flexible_content()
{
    global $post;
    global $postid;
    global $pagetemplateclass;
    global $template;
    $postid = $post->ID;
    // get the global post and set the post id for use in get field calls and get_the_title()
    $template = explode('.', basename(get_page_template()))[0];
    // get template base name minus extension
    $pagetemplateclass = '';
    // set default for section class
    $showAlways = false;
    // set default for always show based on pre-existing setup incase felx content isnt set
    $gracefull = true;
    // check if the flexible content field has rows of data
    ob_start();
    if (have_rows('page_builder', $postid)) {
        $gracefull = false;
        // loop through the rows of data
        while (have_rows('page_builder', $postid)) {
            the_row();
            // locate and insert templates for layouts
            locate_template('templates/flexible/' . get_row_layout() . '.php', true, false);
        }
    }
    ob_end_flush();
    // end flex content
}
function page_testimonials()
{
    ?>

	<div class="container-fluid section-spacing background-color-dark-blue">

		<div class="container wrap">

			<div class="row">

				<?php 
    if (have_rows('reviews')) {
        while (have_rows('reviews')) {
            the_row();
            // Testimonial
            $review = get_sub_field('review');
            $author = get_sub_field('author');
            $content_out = sprintf('
			        		<blockquote class="text-italic col-md-8 col-md-offset-2">
										<div class="quote-content"><p>“%s”</p></div>
										<div class="quote-author text-left">%s</div>
									</blockquote>', $review, $author);
            echo $content_out;
        }
    }
    ?>

			</div>

		</div>

	</div>

	<?php 
}
 function byadr_layout_builder()
 {
     $lb = get_field('activar_layout_builder');
     if ($lb) {
         if (have_rows('layout_builder')) {
             while (have_rows('layout_builder')) {
                 the_row();
                 // TEXT BLOCK
                 require get_template_directory() . '/inc/acf/lb-text-block.php';
                 // QUOTE
                 require get_template_directory() . '/inc/acf/lb-quote.php';
                 // GALLERY
                 require get_template_directory() . '/inc/acf/lb-gallery.php';
                 // VIDEO
                 require get_template_directory() . '/inc/acf/lb-video.php';
                 // IMAGE
                 require get_template_directory() . '/inc/acf/lb-image.php';
                 // MOSAICO
                 require get_template_directory() . '/inc/acf/lb-grid.php';
                 // SLIDER PRECIOS
                 require get_template_directory() . '/inc/acf/lb-slider.php';
                 // GRILLA DE IMAGENES
                 require get_template_directory() . '/inc/acf/lb-grilla.php';
                 // ZONAS DEPILACION
                 require get_template_directory() . '/inc/acf/lb-zonas.php';
                 // LISTADO DE ICONOS
                 require get_template_directory() . '/inc/acf/lb-icon-list.php';
                 // LISTADO DE PRECIOS
                 require get_template_directory() . '/inc/acf/lb-price-list.php';
             }
         }
     } else {
         echo get_template_part('template-part/content', 'default');
     }
 }
function ss_include_slick_carousel()
{
    if (have_rows('slick_carousel_slider')) {
        // repeater field: Slick Carousel Repeater
        echo '<div class="wrap carousel-slider">';
        echo '<div id="slider" class="carousel responsive-carousel">';
        while (have_rows('slick_carousel_slider')) {
            the_row();
            // loop through the repeater field
            $image = get_sub_field('image');
            // get image from repeater
            echo '<div>';
            echo '<a rel="lightbox" class="fancybox-ss" href="';
            echo $image['url'];
            echo '"><img src="';
            echo $image['url'];
            echo '" alt="" /></a>';
            echo '</div>';
        }
        // end loop
        echo '</div>';
        echo '</div>';
    }
    // End Carousel repeater
}
 function byadr_layout_builder()
 {
     $lb = get_field('activar_layout_builder');
     if ($lb) {
         if (have_rows('layout_builder')) {
             while (have_rows('layout_builder')) {
                 the_row();
                 // TEXT BLOCK
                 require get_template_directory() . '/inc/acf/lb-text-block.php';
                 // QUOTE
                 require get_template_directory() . '/inc/acf/lb-quote.php';
                 // GALLERY
                 require get_template_directory() . '/inc/acf/lb-gallery.php';
                 // VIDEO
                 require get_template_directory() . '/inc/acf/lb-video.php';
                 // IMAGE
                 require get_template_directory() . '/inc/acf/lb-image.php';
                 // MOSAICO
                 require get_template_directory() . '/inc/acf/lb-grid.php';
             }
         }
     } else {
         echo get_template_part('template-part/content', 'default');
     }
 }
 public function render()
 {
     if (have_rows('carousel_items')) {
         //acf
         $otpt = '<div class="featured-carousel carousel cf">';
         while (have_rows('carousel_items')) {
             the_row();
             $item_image = get_sub_field('item_image');
             $description = get_sub_field('above_line');
             $link_to = get_sub_field('link_to');
             $button_text = get_sub_field('below_line');
             $otpt .= '<div class="carousel-item">';
             $imgDir = '\\Library\\php\\picture';
             $imgObj = new $imgDir();
             $imgObj->add_images_array(array($item_image['sizes']['full'], $item_image['sizes']['desktop'], $item_image['sizes']['tablet'], $item_image['sizes']['mobile']));
             $imgObj->setClass('carousel-image');
             $otpt .= $imgObj->templateBackground();
             $otpt .= '<div class="carousel-text">';
             $otpt .= '<a class="block " href="' . $link_to . '"><div class="carousel-description carousel-underline f-size-big">' . $description . '</div>';
             $otpt .= '<div class="carousel-description f-size-big">' . $button_text . '</div></a>';
             $otpt .= '</div>';
             $otpt .= '</div>';
         }
         $otpt .= '</div>';
     } else {
         $otpt = 'repeat has no rows';
     }
     return $otpt;
 }
 function __construct()
 {
     if (get_sub_field('wrap') != null) {
         $this->wrap = get_sub_field('wrap');
     }
     $i = 0;
     if (have_rows('tours')) {
         while (have_rows('tours')) {
             the_row();
             if (get_sub_field('title') != null) {
                 $this->tours[$i]['title'] = get_sub_field('title');
             }
             if (get_sub_field('description') != null) {
                 $this->tours[$i]['description'] = get_sub_field('description');
             }
             if (get_sub_field('price') != null) {
                 $this->tours[$i]['price'] = get_sub_field('price');
             }
             if (get_sub_field('duration') != null) {
                 $this->tours[$i]['duration'] = get_sub_field('duration');
             }
             if (get_sub_field('link_button') != null) {
                 $this->tours[$i]['link_button'] = get_sub_field('link_button');
             }
             $i++;
         }
     }
 }
 public function build_scoreset()
 {
     $this->elp_content = '<section class="elp-content">';
     foreach ($this->elp_categories as $category) {
         //we'll need these strings to call fields from within loops
         $field_base_name = strtolower(preg_replace('/\\s+/', '', $category));
         $repeater_field_title = $field_base_name . '_scores';
         $score_field_title = $field_base_name . '_score';
         $note_field_title = $field_base_name . '_score_additional_text_and_images';
         $date_field_title = $field_base_name . '_score_date';
         //catgory heading for each category
         $this->elp_content .= '<div class="elp-category cat-' . $field_base_name . '">';
         $this->elp_content .= '<h3>' . $category . '</h3>';
         //for each repeater row, three fields
         while (have_rows($repeater_field_title)) {
             the_row();
             if (get_sub_field('show_on_front') == true) {
                 $this->elp_content .= '<div class="elp-date elp-' . $field_base_name . '">' . get_sub_field($date_field_title) . '</div>';
                 $this->elp_content .= '<div class="elp-score elp-' . $field_base_name . '">' . get_sub_field($score_field_title) . '</div>';
                 $this->elp_content .= '<div class="elp-score-notes elp-' . $field_base_name . '">' . get_sub_field($note_field_title) . '</div>';
             }
         }
         //end repeater instance(s)
         $this->elp_content .= '</div>';
     }
     $this->elp_content .= '</section>';
 }
 /**
  * Retrieves all the section HTML 
  * @param  String $name The slug used for the sections. Is 'sections' by default
  * @return String       The final HTML
  */
 public function getSectionsHTML($name, $post_id)
 {
     if (!$this->acf_active) {
         return '';
     }
     if (have_rows($name, $post_id)) {
         $s = 1;
         $this->html = '<div id="acfpb_sections">';
         while (have_rows($name, $post_id)) {
             the_row();
             $layout = get_row_layout();
             if (method_exists(get_class(), 'getSection_' . $layout)) {
                 $id = 'section_' . $s;
                 $class = 'acfpb_section section-' . $layout;
                 $style = get_sub_field('bg') ? 'background-color:' . get_sub_field('bg') : '';
                 $contained = (bool) get_sub_field('contained', false);
                 if (!$this->use_bs && $contained) {
                     $contained = false;
                 }
                 $wrapper = get_sub_field('wrapper_class');
                 $this->html .= '<div id="' . $id . '" class="' . $class . '" style="' . $style . '">';
                 if ($contained) {
                     $this->html .= '<div class="container">';
                 }
                 if ($contained) {
                     $this->html .= '<div class="row">';
                 }
                 if ($wrapper !== '') {
                     $this->html .= '<div class="' . $wrapper . '">';
                 }
                 $this->html .= $this->{'getSection_' . $layout}();
                 if ($wrapper !== '') {
                     $this->html .= '</div>';
                 }
                 // Wrapper finish
                 if ($this->use_bs) {
                     $this->html .= '<div class="clearfix"></div>';
                 }
                 if ($contained) {
                     $this->html .= '</div>';
                 }
                 // Row finish
                 if ($contained) {
                     $this->html .= '</div>';
                 }
                 // Container finish
                 $this->html .= '</div>';
                 // Section finish
                 $s++;
             }
         }
         $this->html .= '</div>';
         // Main Wrapper finish
         return $this->html;
     } else {
         return '';
     }
 }
Example #10
0
 private function getAlternateLanguages()
 {
     if (have_rows('quan_meta_hreflang')) {
         while (have_rows('quan_meta_hreflang')) {
             the_row();
             echo sprintf('<link rel="alternate" href="%s" hreflang="%s" />', get_permalink(get_sub_field('quan_meta_hreflang_url')), get_sub_field('quan_meta_hreflang_code'));
         }
     }
 }
 public function get_new_report_count($repeater_field)
 {
     $report_with_new_status = array();
     while (have_rows($repeater_field)) {
         the_row();
         if (get_sub_field('report_status') == 'New') {
             array_push($report_with_new_status, get_sub_field('report_status'));
         }
     }
     return count($report_with_new_status);
 }
 public function fill_slides()
 {
     if (have_rows('slides')) {
         while (have_rows('slides')) {
             the_row();
             $image = get_sub_field('image');
             $title = get_sub_field('slide_title');
             $desc = get_sub_field('slide_description');
             $this->add_slide($image, esc_js($title), trim(preg_replace('/\\s+/', ' ', $desc)), $image);
         }
     }
 }
Example #13
0
function uf_slider_output($sliderSlug = 'default')
{
    $output = '';
    if (have_rows('sliders', 'options')) {
        while (have_rows('sliders', 'options')) {
            the_row();
            $currentSlider = get_sub_field('slider_slug', 'options');
            if (get_sub_field('slider_slug', 'options') == $sliderSlug) {
                while (have_rows('slides', 'options')) {
                    the_row();
                    // echo get_sub_field('caption', 'options');
                }
                $activeClass = 'active';
                $sliderCount = 0;
                $output .= '<div id="uf-slider-' . $sliderSlug . '" class="carousel slide round" data-ride="carousel">';
                $output .= '<ol class="carousel-indicators">';
                while (have_rows('slides', 'options')) {
                    the_row();
                    // echo get_sub_field('caption', 'options');
                    $output .= '<li data-target="#uf-slider-' . $sliderSlug . '" data-slide-to="' . $sliderCount . '" class="' . $activeClass . '"></li>';
                    $activeClass = '';
                    $sliderCount++;
                }
                $output .= '</ol>';
                $activeClass = 'active';
                $output .= '<div class="carousel-inner round" role="listbox">';
                while (have_rows('slides', 'options')) {
                    the_row();
                    $output .= '<div class="item round ' . $activeClass . '">';
                    $output .= '<img src="' . acf_image_slider(get_sub_field('image', 'options'), $sliderSlug) . '" class="round">';
                    // $output .= print_r(get_sub_field('image', 'options'));
                    $output .= '<div class="carousel-caption">';
                    $output .= get_sub_field('caption', 'options');
                    $output .= '</div>';
                    $output .= '</div>';
                    $activeClass = '';
                }
                $output .= '</div>';
                $output .= '<!-- Controls -->';
                $output .= '<a class="left carousel-control" href="#uf-slider-' . $sliderSlug . '" role="button" data-slide="prev">';
                $output .= '<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>';
                $output .= '<span class="sr-only">Previous</span>';
                $output .= '</a>';
                $output .= '<a class="right carousel-control" href="#uf-slider-' . $sliderSlug . '" role="button" data-slide="next">';
                $output .= '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>';
                $output .= '<span class="sr-only">Next</span>';
                $output .= '</a>';
                $output .= '</div>';
            }
        }
    }
    return $output;
}
function get_features($language)
{
    if (have_rows('feature_content')) {
        while (have_rows('feature_content')) {
            the_row();
            //all features
            feature_full($language);
            feature_grid_2_2_editor($language);
        }
        wp_reset_query();
    }
}
Example #15
0
 function acf_load_goole_fonts($field)
 {
     $fonts = get_field('db_fonts', 'options');
     $field['choices'] = array();
     if (have_rows('db_fonts', 'option')) {
         while (have_rows('db_fonts', 'option')) {
             the_row();
             $font = get_sub_field('db_font');
             $value = $font['font'];
             $field['choices'][$value] = $value;
         }
     }
     return $field;
 }
Example #16
0
function the_pc_jumbotron()
{
    if (is_singular()) {
        if (have_rows('jumbotron_slides')) {
            get_template_part('parts/jumbotron');
            return;
        }
        if (get_field('main_heading')) {
            get_template_part('parts/main-heading');
            return;
        }
    }
    get_template_part('parts/main-heading-default');
}
function get_box_content($language)
{
    if (have_rows('content')) {
        while (have_rows('content')) {
            the_row();
            //all girds
            grid_full($language);
            grid_1_2_editor($language);
            grid_1_2_input($language);
        }
    } else {
        echo 'Error: content mismatch!';
    }
}
function related_content_related_links($object, $field_name, $request)
{
    // check if the repeater field has rows of data
    if (have_rows('related_links')) {
        $related_links_link_text_array = array();
        // loop through the rows of data
        while (have_rows('related_links')) {
            the_row();
            // display a sub field value
            $related_links_link_text_array[] = array('url' => get_sub_field('link_url'), 'text' => get_sub_field('link_text'));
        }
    }
    return $related_links_link_text_array;
}
Example #19
0
/**
 * Social Icons shortcode
 */
function socialicons_func($atts, $content = null)
{
    $atts = shortcode_atts(array(), $atts);
    $output = '';
    if (have_rows('social_icons', 'options')) {
        $output .= '<ul class="socialicons">';
        while (have_rows('social_icons', 'options')) {
            the_row();
            $output .= '<li><a href="' . get_sub_field('url') . '" class="' . get_sub_field('slug') . '-dark" target="_blank">' . get_sub_field('name') . '</a></li>';
        }
        $output .= '</ul>';
    }
    return $output;
}
Example #20
0
 public function pageWithSections()
 {
     $result = '<section class="subtemplate-container">';
     global $post;
     $id = $post->ID;
     if (have_rows('page_section', $id)) {
         while (have_rows('page_section', $id)) {
             the_row();
             $image = get_sub_field('image', $id);
             $rightContent = get_sub_field('right_content', $id);
             $email = get_sub_field('email', $id);
             $facebook = get_sub_field('facebook_url', $id);
             $twitter = get_sub_field('twitter_url', $id);
             $instagram = get_sub_field('intagram_url', $id);
             $logo = get_sub_field('logo', $id);
             $imageMarkup = '';
             if ($image) {
                 $imageMarkup = "<img src='{$image["sizes"]["tall-images"]}' alt='{$image["alt"]}' class='side-image'>";
             }
             $emailMarkup = '';
             if ($email) {
                 $imageUrl = BACKYARD_TEMPLATE_URL . "/images/social/mail-sm.png";
                 $emailMarkup = "<li><a href='mailto:{$email}' class='email'><img src='{$imageUrl}' alt='Mail'></a></li>";
             }
             $facebookMarkup = '';
             if ($facebook) {
                 $imageUrl = BACKYARD_TEMPLATE_URL . "/images/social/facebook-sm.png";
                 $facebookMarkup = "<li><a href='{$facebook}' class='facebook' target='_blank'><img src='{$imageUrl}' alt='Mail'></a></li>";
             }
             $twitterMarkup = '';
             if ($twitter) {
                 $imageUrl = BACKYARD_TEMPLATE_URL . "/images/social/twitter-sm.png";
                 $twitterMarkup = "<li><a href='{$twitter}' class='twitter' target='_blank'><img src='{$imageUrl}' alt='Mail'></a></li>";
             }
             $instagramMarkup = '';
             if ($instagram) {
                 $imageUrl = BACKYARD_TEMPLATE_URL . "/images/social/insta-sm.png";
                 $instagramMarkup = "<li><a href='{$instagram}' class='instagram' target='_blank'><img src='{$imageUrl}' alt='Mail'></a></li>";
             }
             $logoMarkup = '';
             if ($logo) {
                 $logoMarkup = "<img src='{$logo["url"]}' alt='{$logo["alt"]}' class='other-logo'>";
             }
             $result .= "\n\t\t\t\t\t<div class='subtemplate'>\n\t\t\t\t\t\t{$imageMarkup}\n\t\t\t\t\t\t<div class='side-content'>\n\t\t\t\t\t\t\t{$logoMarkup}\n\t\t\t\t\t\t\t{$rightContent}\n\t\t\t\t\t\t\t<ul class='contact-points'>\n\t\t\t\t\t\t\t{$emailMarkup}\n\t\t\t\t\t\t\t{$facebookMarkup}\n\t\t\t\t\t\t\t{$twitterMarkup}\n\t\t\t\t\t\t\t{$instagramMarkup}\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t";
         }
     }
     $result .= "</section>";
     return $result;
 }
 public function pre_save_post($post_id)
 {
     $post = get_post($post_id);
     if ($post_id == 'options' || !isset($post->post_type) || $post->post_type !== 'poll' || isset($_POST['acf']) === false) {
         return;
     }
     //Both user and secret set in the WP settings.
     $userId = get_field('agreable_poll_plugin_settings_senti_user_id', 'options');
     $secret = get_field('agreable_poll_plugin_settings_firebase_secret', 'options');
     if (empty($secret) || empty($userId)) {
         return false;
     }
     $firebase = new \Firebase\FirebaseLib('https://senti.firebaseio.com/', $secret);
     $path = 'polls';
     $firebasePollId = get_field('agreable_poll_definition_firebase_id', $post_id);
     // Update votes from Firebase before saving post.
     $firebase_answers = json_decode($firebase->get($path . '/' . $userId . '/' . $firebasePollId . '/answers'));
     if (!$firebase_answers) {
         return;
     }
     $rows = [];
     if (have_rows('poll_answers', $post_id)) {
         while (have_rows('poll_answers', $post_id)) {
             array_push($rows, the_row());
         }
     }
     // Modifying $_POST using previous index and values recently extracted from
     // firebase.
     $post_answers = $_POST['acf']['agreable_poll_definition_answers'];
     for ($i = 0; $i < count($post_answers); $i++) {
         if ($i < count($rows)) {
             // Get previous index from DB.
             $previous_index = $rows[$i]['agreable_poll_definition_answers_answer_index'];
             if ($previous_index == "") {
                 $previous_index = $i;
             }
             $votes = isset($firebase_answers[$previous_index]->votes) ? $firebase_answers[$previous_index]->votes : 0;
             // Update post using old index to get correct votes from firebase answers.
             $_POST['acf']['agreable_poll_definition_answers'][$i]['agreable_poll_definition_answers_answer_votes'] = $votes;
             // Update DB to new index for next time but remove from post.
             unset($_POST['acf']['agreable_poll_definition_answers'][$i]['agreable_poll_definition_answers_answer_index']);
             update_post_meta($post_id, "poll_answers_{$i}_answer_index", $i);
         }
     }
     // Update number of entries.
     $firebase_entries = $firebase->get($path . '/' . $userId . '/' . $firebasePollId . '/entries');
     $_POST['acf']['agreable_poll_definition_entries'] = $firebase_entries;
 }
Example #22
0
 /**
  * Build an array from an ACF repeater's data
  *
  * @param string $repeater The name of the repeater
  * @param array $mapping  And array mapping out the structure of the data
  */
 public static function loadRepeater($repeater, $itemId, $mapping)
 {
     if (have_rows($repeater, $itemId)) {
         $data = [];
         $n = 0;
         while (have_rows($repeater, $itemId)) {
             the_row();
             $data[$n] = [];
             foreach ($mapping as $key => $value) {
                 $data[$n][$key] = get_sub_field($value);
             }
             $n++;
         }
         return $data;
     }
     return false;
 }
Example #23
0
function acfmod_modules_icon_blocks()
{
    $output = '';
    $css_class = trim(get_sub_field('css_class'));
    $count = count(get_sub_field('icons'));
    if (have_rows('icons')) {
        wp_enqueue_style('acfmod-icon-blocks');
        $output .= '<ul class="icon-blocks count-' . $count . ' ' . esc_attr($css_class) . '">';
        while (have_rows('icons')) {
            the_row();
            $image = get_sub_field('icon');
            $link = acfmod_get_the_link();
            $target = get_sub_field('link_target');
            // i don't know why, but for some reason it may return an array.
            if (is_array($target) && count($target) > 0) {
                $target = reset($target);
            }
            $target = $target ? ' target="' . $target . '"' : '';
            $output .= '<li>';
            if ($link) {
                $output .= '<a href="' . $link . '"' . $target . '>';
            }
            if ($image) {
                $output .= '<span class="icon" style="background-image:url(\'' . esc_attr($image['url']) . '\');"></span>';
            }
            if ($heading = get_sub_field('heading')) {
                $heading_color = get_sub_field('heading_color') ? ' style="color:' . get_sub_field('heading_color') . ';"' : '';
                $output .= '<span class="heading"' . $heading_color . '>' . $heading . '</span>';
            }
            if ($text = get_sub_field('text')) {
                $output .= '<span class="text">' . $text . '</span>';
            }
            if ($cta_text = get_sub_field('cta_text')) {
                $output .= '<span class="cta">' . $cta_text . '</span>';
            }
            if ($link) {
                $output .= '</a>';
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
    }
    return $output;
}
 public function post_type_init()
 {
     $post_types = array('venue-category' => array('post_type' => array('venue'), 'args' => array('hierarchical' => true, 'labels' => array('name' => _x('Categories', 'taxonomy general name'), 'singular_name' => _x('Category', 'taxonomy singular name'), 'search_items' => __('Search Categories'), 'all_items' => __('All Categories'), 'parent_item' => __('Parent Category'), 'parent_item_colon' => __('Parent Category:'), 'edit_item' => __('Edit Category'), 'update_item' => __('Update Category'), 'add_new_item' => __('Add New Category'), 'new_item_name' => __('New Category Name'), 'menu_name' => __('Categories')), 'show_in_quick_edit' => false, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => 'venue-cat'))));
     foreach ($post_types as $type => $args) {
         register_taxonomy($type, $args['post_type'], $args['args']);
     }
     if (function_exists('have_rows')) {
         if (have_rows('cities', 'option')) {
             while (have_rows('cities', 'option')) {
                 the_row();
                 $name = sanitize_title(get_sub_field('city_name'));
                 $label = esc_html(get_sub_field('city_label'));
                 $slug = $name;
                 //get_sub_field( 'region_slug' ) ? sanitize_title( get_sub_field( 'region_slug' ) ) : $name;
                 register_taxonomy($name, array('vendor'), array('public' => true, 'labels' => array('name' => __($label . ' Categories'), 'singular_name' => __($label . ' Category'), 'menu_name' => $label, 'search_items' => __('Search ' . $label . ' Categories'), 'popular_items' => __('Popular ' . $label . ' Categories'), 'all_items' => __('All ' . $label . ' Categories'), 'edit_item' => __('Edit ' . $label . ' Category'), 'update_item' => __('Update ' . $label . ' Category'), 'add_new_item' => __('Add New ' . $label . ' Category'), 'new_item_name' => __('New Group ' . $label . ' Name'), 'separate_items_with_commas' => __('Separate ' . $label . ' categories with commas'), 'add_or_remove_items' => __('Add or remove ' . $label . ' category'), 'choose_from_most_used' => __('Choose from the most popular ' . $label . ' categories')), 'hierarchical' => true, 'show_ui' => false, 'show_admin_column' => true, 'query_var' => true, 'show_in_nav_menus' => false, 'rewrite' => array('hierarchical' => true)));
             }
         }
     }
 }
function ml_slideshow()
{
    //THIS SLIDESHOW FUNCTION CAN BE USED FOR BOTH SLIDESHOWS
    //THAT NEED TO LIVE ON THE OPTIONS PAGE OR SINGLE PAGE
    $ss = 'field_simple_slideshow';
    $content = 'content';
    $img = 'image';
    $options = false;
    ?>


<section id = "hero" class="hero">
  <div class="slider_img cycle-slideshow" 
       data-cycle-swipe=true
       data-cycle-pager-template="<span class = 'icon pager-icon'></span>"
       data-cycle-slides="> div.slide"
       >

  <div class="cycle-pager"></div>
  <?php 
    if (have_rows($ss)) {
        while (have_rows($ss)) {
            the_row();
            ?>
      <div class = "slide">
	<?php 
            the_sub_field($content);
            ?>
	<img src="<?php 
            the_sub_field($img);
            ?>
" />
      </div>
  <?php 
        }
    }
    ?>
  </div><!--cycle-->
</section>

<?php 
}
Example #26
0
function finest_history()
{
    ?>

		<div class="container wrap">

			<div class="row section-spacing">

				<?php 
    if (have_rows('history_content')) {
        while (have_rows('history_content')) {
            the_row();
            $title = get_sub_field('title');
            $content = get_sub_field('content');
            //Title
            if ($title != '') {
                $title_out = sprintf('<h2>%s</h2>', $title);
            } else {
                $title_out = '';
            }
            //Content
            if ($content != '') {
                $content_out = sprintf('<p>%s</p>', $content);
            } else {
                $content_out = '';
            }
            $about_out = sprintf('
				        	<div class="col-md-6">
							  		%s
							  		%s
							  	</div>', $title_out, $content_out);
            echo $about_out;
        }
    }
    ?>

			</div>

		</div>

	<?php 
}
 /**
  * Create a new point node in the database.
  * This does not create any custom fields, use {@link update_graph_data} afterwards.
  * @param array $data The new node data
  * @return int The ID of the inserted WordPress node
  */
 public function create($data)
 {
     $id = -1;
     $choices = get_field_object($this->_fields['node_type']['key'])['choices'];
     $post_title = $choices[$data['type']];
     $post_content = '';
     while (have_rows('point_nodes', 'option')) {
         the_row();
         while (have_rows('post_content')) {
             the_row();
             $post_content = get_sub_field($data['type']);
         }
     }
     $id = wp_insert_post(array('post_type' => $this->_postTypeName, 'post_title' => $post_title, 'post_content' => $post_content, 'post_status' => 'publish'));
     // Create stub graph_data repeater row so it will be ready for update_graph_data,
     // since that function can't handle creating new rows
     // @see http://www.advancedcustomfields.com/resources/update_sub_field/
     add_row($this->_fields['graph_data']['key'], array('x' => 0, 'y' => 0, 'links' => array()), $id);
     return $id;
 }
 /**
  * Create the actual widget
  * @param  $args
  * @param  $instance
  * @return string
  */
 function widget($args, $instance)
 {
     // widget sidebar output
     extract($args, EXTR_SKIP);
     $title = apply_filters('widget_title', $instance['title']);
     // Begin front-end widget output
     $widget = $before_widget;
     $widget .= $title ? $before_title . $title . $after_title : '';
     $widget .= '<address>';
     if (have_rows('social_accounts', 'option')) {
         $widget .= '<ul class="list-social-accounts">';
         while (have_rows('social_accounts', 'option')) {
             the_row();
             $widget .= '<li>
                                 <a class="social-media-link muted" style="color: ' . get_sub_field('color') . '" href="' . get_sub_field('link') . '">
                                     <span class="fa-stack fa-lg">
                                         <i class="fa fa-square fa-stack-2x fa-inverse"></i>
                                         <i class="fa ' . get_sub_field('icon') . ' fa-stack-1x"></i>
                                     </span>
                                     <span class="account-name">' . get_sub_field('account_name') . '</span>
                                 </a>
                             </li>';
         }
         $widget .= '</ul>';
     }
     $widget .= '</address>';
     $widget .= $after_widget;
     echo $widget;
     // Output the widget
 }
    function byadr_social()
    {
        if (have_rows('social', 'option')) {
            ?>
			<ul class="social-links">
			<?php 
            while (have_rows('social', 'option')) {
                the_row();
                ?>
				<?php 
                $red = get_sub_field('red_theme');
                $url = get_sub_field('url_theme');
                ?>

				<li class="<?php 
                echo 'social-' . $red;
                ?>
">
					<a href="<?php 
                echo $url;
                ?>
"></a>
				</li>

			<?php 
            }
            ?>
			</ul>
		<?php 
        }
    }
Example #30
-1
function show_team()
{
    $teamID = get_the_ID();
    if (have_rows('team_members', $teamID)) {
        $teamLength = count(get_field('team_members', $teamID));
        if ($teamLength <= 2) {
            $gridSize = '6';
        } elseif ($teamLength == 3) {
            $gridSize = '4';
        } else {
            $gridSize = '3';
        }
        $team = '<div id="team">';
        $team .= '  <div class="row">';
        while (have_rows('team_members')) {
            the_row();
            // vars
            $name = get_sub_field('name');
            $link = get_sub_field('link');
            $photo = get_sub_field('photo');
            $team .= '<div class="member sm-col sm-col-' . $gridSize . '">';
            $team .= '  <a href="' . $link . '">';
            $team .= '    <img src="' . $photo['sizes']['project_thumb'] . '" alt="' . $photo['alt'] . '">';
            $team .= '    <div class="overlay"></div>';
            $team .= '    <div class="title"><h3>' . $name . '</h3></div>';
            $team .= '  </a>';
            $team .= '</div>';
        }
        $team .= '  </div>';
        $team .= '</div>';
        return $team;
    }
}