public function get_frontend_data($post_id)
 {
     $collector = array();
     $meta = fw_get_db_post_option($post_id);
     $post_status = get_post_status($post_id);
     if ('publish' === $post_status and isset($meta['populated'])) {
         $slider_name = $meta['slider']['selected'];
         $population_method = $meta['slider'][$slider_name]['population-method'];
         $number_of_images = (int) $meta['number_of_images'];
         $collector = array('slides' => array(), 'settings' => array('title' => $meta['title'], 'slider_type' => $slider_name, 'population_method' => $population_method, 'post_id' => $post_id, 'extra' => isset($meta['custom-settings']) ? $meta['custom-settings'] : array()));
         $query_data = array();
         $post_type = $meta['tags']['selected'];
         $terms = $meta['tags'][$post_type]['terms'];
         $tax_query = array('tax_query' => array('relation' => 'OR'));
         foreach ($terms as $term) {
             $decoded_data = json_decode($term, true);
             $query_data[$decoded_data['taxonomy']][] = $decoded_data['term_id'];
         }
         foreach ($query_data as $taxonomy => $terms) {
             $tax_query['tax_query'][] = array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => $terms);
         }
         $final_query = array_merge(array('post_status' => 'publish', 'posts_per_page' => $number_of_images, 'post_type' => $post_type, 'meta_key' => '_thumbnail_id'), $tax_query);
         global $post;
         $original_post = $post;
         $the_query = new WP_Query($final_query);
         while ($the_query->have_posts()) {
             $the_query->the_post();
             array_push($collector['slides'], array('title' => get_the_title(), 'multimedia_type' => $this->multimedia_types[0], 'src' => wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())), 'desc' => get_the_excerpt(), 'extra' => array('post_id' => $post->ID)));
         }
         wp_reset_postdata();
         $post = $original_post;
         unset($original_post);
     }
     return $collector;
 }
Exemple #2
0
 function fw_ext_events_render_map($post_id = 0)
 {
     if (0 === $post_id && null === ($post_id = get_the_ID())) {
         return null;
     }
     $fw_ext_events = fw()->extensions->get('events');
     if (empty($fw_ext_events)) {
         return null;
     }
     $post = get_post($post_id);
     if ($post->post_type !== $fw_ext_events->get_post_type_name()) {
         return null;
     }
     $shortcode_ext = fw()->extensions->get('shortcodes');
     if (empty($shortcode_ext)) {
         return null;
     }
     $shortcode_map = $shortcode_ext->get_shortcode('map');
     if (empty($shortcode_map)) {
         return null;
     }
     $options = fw_get_db_post_option($post->ID, $fw_ext_events->get_event_option_id());
     if (empty($options['event_location']['location']) or empty($options['event_location']['coordinates']['lat']) or empty($options['event_location']['coordinates']['lng'])) {
         return null;
     }
     return $shortcode_map->render_custom(array(array('title' => $post->post_title, 'url' => get_permalink($post->ID), 'description' => $options['event_location']['location'], 'thumb' => array('attachment_id' => get_post_thumbnail_id($post->ID)), 'location' => array('coordinates' => array('lat' => $options['event_location']['coordinates']['lat'], 'lng' => $options['event_location']['coordinates']['lng'])))), array('map_height' => false, 'map_type' => false));
 }
Exemple #3
0
function fw_ext_portfolio_get_gallery_images($post_id = 0)
{
    if (0 === $post_id && null === ($post_id = get_the_ID())) {
        return array();
    }
    return fw_get_db_post_option($post_id, 'project-gallery', array());
}
 /**
  * Removes the autop filter if the post was created via the layout builder
  *
  * @internal
  */
 public function _theme_filter_remove_autop($content)
 {
     global $post;
     if (in_array($post->post_type, $this->get_config('supported_post_types'))) {
         $builder_meta = fw_get_db_post_option($post->ID, $this->builder_option_key);
         if ($builder_meta['builder_active']) {
             remove_filter('the_content', 'wpautop');
         }
     }
     return $content;
 }
 public function get_frontend_data($post_id)
 {
     $selected = fw_get_db_post_option($post_id, 'slider/selected');
     $population_method = fw_get_db_post_option($post_id, 'slider/' . $selected . '/population-method');
     $population_method_instance = $this->get_child('population-method-' . $population_method);
     if ($population_method_instance) {
         return $population_method_instance->get_frontend_data($post_id);
     } else {
         return array();
     }
 }
 public function get_frontend_data($post_id)
 {
     $meta = fw_get_db_post_option($post_id);
     $post_status = get_post_status($post_id);
     $collector = array();
     if ('publish' === $post_status and isset($meta['populated'])) {
         $slider_name = $meta['slider']['selected'];
         $population_method = $meta['slider'][$slider_name]['population-method'];
         $collector = array('slides' => array(), 'settings' => array('title' => $meta['title'], 'slider_type' => $slider_name, 'population_method' => $population_method, 'post_id' => $post_id, 'extra' => isset($meta['custom-settings']) ? $meta['custom-settings'] : array()));
         foreach ($meta['custom-slides'] as $slide) {
             array_push($collector['slides'], array('title' => !empty($slide['title']) ? $slide['title'] : '', 'multimedia_type' => $slide['multimedia']['selected'], 'src' => $slide['multimedia']['selected'] === 'video' ? $slide['multimedia'][$slide['multimedia']['selected']]['src'] : $slide['multimedia'][$slide['multimedia']['selected']]['src']['url'], 'attachment_id' => $slide['multimedia']['selected'] === 'image' ? $slide['multimedia'][$slide['multimedia']['selected']]['src']['attachment_id'] : '', 'desc' => !empty($slide['desc']) ? $slide['desc'] : '', 'extra' => isset($slide['extra-options']) ? $slide['extra-options'] : array()));
         }
     }
     return $collector;
 }
 public function get_frontend_data($post_id)
 {
     $collector = array();
     $meta = fw_get_db_post_option($post_id);
     $post_status = get_post_status($post_id);
     if ('publish' === $post_status and isset($meta['populated'])) {
         $slider_name = $meta['slider']['selected'];
         $population_method = $meta['slider'][$slider_name]['population-method'];
         $posts_id = $meta['post_types'][$meta['post_types']['selected']]['posts_id'];
         $collector = array('slides' => array(), 'settings' => array('title' => $meta['title'], 'slider_type' => $slider_name, 'population_method' => $population_method, 'post_id' => $post_id, 'extra' => array()));
         $posts = get_posts(array('post_in' => $posts_id));
         foreach ($posts as $post) {
             setup_postdata($post);
             array_push($collector['slides'], array('title' => get_the_title(), 'src' => wp_get_attachment_url(get_post_thumbnail_id($post->ID)), 'desc' => get_the_excerpt(), 'extra' => array('post_id' => $post->ID)));
         }
         wp_reset_postdata();
     }
     return $collector;
 }
/**
 * STARRY HEADER
 * @internal
 */
function starry_header()
{
    if (!is_front_page()) {
        if (is_singular('portfolio')) {
            $projecttopfeatured = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'projecttopfeatured') : '';
        }
        if (is_singular('post')) {
            $posttopfeatured = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'posttopfeatured') : '';
        }
        echo '<!-- HEADER SLIDER -->';
        echo '<div class="flexslider" id="header-slider">';
        echo '<ul class="slides">';
        // IF HAS FEATURED IMAGE
        if (has_post_thumbnail() && is_page()) {
            $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumbnail');
            echo '<li><img src="' . esc_url($image[0]) . '" alt="SLider Image"></li>';
        } elseif (is_singular('portfolio') && !empty($projecttopfeatured)) {
            echo '<li><img src="' . $projecttopfeatured['url'] . '" alt="SLider Image"></li>';
        } elseif (is_singular('post') && !empty($posttopfeatured)) {
            echo '<li><img src="' . $posttopfeatured['url'] . '" alt="SLider Image"></li>';
        } else {
            // GET DEFAULT ONE
            $defaultimage = function_exists('fw_get_db_settings_option') ? fw_get_db_settings_option('defaultimage') : '';
            if (!empty($defaultimage)) {
                echo '<li><img src="' . esc_url($defaultimage['url']) . '" alt="SLider Image"></li>';
            } else {
                echo '<li><img src="' . get_template_directory_uri() . '/images/dummy/bg1.jpg" alt="SLider Image"></li>';
            }
        }
        echo '</ul>';
        echo '</div>';
        // IF IT IS THE HOME PAGE, THERE IS 3 DIFFERENT CHOICES
    } else {
        $homerevslider = function_exists('fw_get_db_settings_option') ? fw_get_db_settings_option('homerevslider') : '';
        if ($homerevslider != true) {
            $homeheader_type = function_exists('fw_get_db_settings_option') ? fw_get_db_settings_option('homeheader_content') : '';
            // IF YOU CHOOSE SINGLE IMAGE
            if ($homeheader_type['gadget'] == "header_single") {
                echo '<!-- HEADER SLIDER -->';
                echo '<div class="flexslider" id="header-slider">';
                echo '<ul class="slides">';
                if (!empty($homeheader_type['header_single']['homesingleimage']['url'])) {
                    echo '<li><img src="' . esc_url($homeheader_type['header_single']['homesingleimage']['url']) . '" alt="SLider Image"></li>';
                } else {
                    echo '<li><img src="' . get_template_directory_uri() . '/images/dummy/bg1.jpg" alt="SLider Image"></li>';
                }
                echo '</ul>';
                echo '</div>';
            } elseif ($homeheader_type['gadget'] == "header_slider") {
                if ($homeheader_type['header_slider']['homeslidercontrol'] == true) {
                    echo '<!-- SLIDER NAVIGATION -->';
                    echo '<div class="navigation-slider-container">';
                    echo '<a href="#" id="sliderPrev"><i class="fa fa-arrow-left"></i></a>';
                    echo '<a href="#" id="sliderNext"><i class="fa fa-arrow-right"></i></a>';
                    echo '</div>';
                }
                echo '<!-- HEADER SLIDER -->';
                echo '<div class="flexslider" id="header-slider">';
                echo '<ul class="slides">';
                foreach ($homeheader_type['header_slider']['homesliderimages'] as $value_slider) {
                    echo '<li><img src="' . esc_url($value_slider['url']) . '" alt="slider image"></li>';
                }
                echo '</ul>';
                echo '</div>';
            } elseif ($homeheader_type['gadget'] == "header_video") {
                echo '<div id="header-video" ';
                echo 'data-vide-bg="';
                if (!empty($homeheader_type['header_video']['header_video_mp4']['url'])) {
                    // REMOVE THE EXTENSIO
                    echo 'mp4: ' . esc_url($homeheader_type['header_video']['header_video_mp4']['url']) . ', ';
                }
                if (!empty($homeheader_type['header_video']['header_video_ogv']['url'])) {
                    echo 'ogv: ' . esc_url($homeheader_type['header_video']['header_video_ogv']['url']) . ', ';
                }
                if (!empty($homeheader_type['header_video']['header_video_webm']['url'])) {
                    echo 'webm: ' . esc_url($homeheader_type['header_video']['header_video_webm']['url']) . ', ';
                } elseif (!empty($homeheader_type['header_video']['header_video_webm_link'])) {
                    echo 'webm: ' . esc_url($homeheader_type['header_video']['header_video_webm_link']) . ', ';
                }
                if (!empty($homeheader_type['header_video']['header_video_poster']['url'])) {
                    echo 'poster: ' . esc_url($homeheader_type['header_video']['header_video_poster']['url']) . '" ';
                }
                echo 'data-vide-options="posterType: jpg, loop: true, muted: true, position: 50% 50%">';
                echo '</div>';
            } else {
                echo '<!-- HEADER SLIDER -->';
                echo '<div class="flexslider" id="header-slider">';
                echo '<ul class="slides">';
                echo '<li><img src="' . get_template_directory_uri() . '/images/dummy/bg1.jpg" alt="SLider Image"></li>';
                echo '</ul>';
                echo '</div>';
            }
            // IF YOU CHOOSE THE REVOLUTION SLIDER
        } else {
            echo '<!-- HEADER SLIDER -->';
            echo '<div id="header-slider">';
            putRevSlider("home");
            echo '</div>';
        }
    }
}
 public function render_slider($post_id, $dimensions, $extra_data = array())
 {
     $slider_name = fw_get_db_post_option($post_id, $this->get_name() . '/selected');
     if (!is_null($slider_name)) {
         return $this->get_child($slider_name)->render_slider($post_id, $dimensions, $extra_data);
     }
 }
 /**
  * @intenral
  */
 public function _action_calendar_export()
 {
     global $post;
     if (empty($post) or $post->post_type !== $this->post_type_name) {
         return;
     }
     if (FW_Request::GET('calendar')) {
         $calendar = FW_Request::GET('calendar');
         $row_id = FW_Request::GET('row_id');
         $offset = FW_Request::GET('offset');
         $options = fw_get_db_post_option($post->ID, $this->get_event_option_id());
         if (!is_array(fw_akg('event_children/' . $row_id, $options)) or !preg_match('/^\\d+$/', $row_id)) {
             wp_redirect(site_url() . '?error=404');
         }
         if (!preg_match('/^(\\-|\\d)\\d+$/', $offset)) {
             $offset = 0;
         }
         switch ($calendar) {
             case 'google':
                 wp_redirect($this->get_google_uri($post, $options, $row_id, $offset));
                 break;
             default:
                 $this->get_ics_headers($post);
                 echo $this->get_ics_content($post, $options, $row_id, $offset);
                 die;
         }
     }
 }
Exemple #11
0
function get_content_slider()
{
    $slider = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'tf_page_slider/tf_switch') : '';
    if ($slider === 'yes') {
        ?>
	<div class='page_slider'><?php 
        $value = fw_get_db_post_option(get_the_ID(), 'tf_page_slider/' . $slider);
        $slider_id = $value['tf_slider_content'];
        echo fw_ext('slider')->render_slider($slider_id, array('width' => 300, 'height' => 200));
        ?>
</div>
<?php 
    }
}
Exemple #12
0
<?php

/**
 * The Template for displaying all single posts
 */
get_header();
$header_image = defined('FW') ? fw_get_db_post_option($post->ID, 'header_post_image', fw_get_db_settings_option('header_post_image')) : '';
$header_color = defined('FW') ? fw_get_db_post_option($post->ID, 'header_post_color', fw_get_db_settings_option('header_post_color')) : '';
$header_pattern = defined('FW') ? fw_get_db_post_option($post->ID, 'header_post_pattern', fw_get_db_settings_option('header_post_pattern')) : '';
$header_title = defined('FW') ? esc_html(fw_get_db_post_option($post->ID, 'header_post_title', fw_get_db_settings_option('header_post_title'))) : '';
//show header image
fw_show_header($header_image, $header_color, $header_pattern, $header_title);
?>


<?php 
$sidebar_position = function_exists('fw_ext_sidebars_get_current_position') ? fw_ext_sidebars_get_current_position() : 'right';
?>
<section id="content" class="cols-a <?php 
echo $sidebar_position === 'left' ? 'news-e-left' : '';
?>
 <?php 
echo $sidebar_position == null || $sidebar_position == 'full' ? 'news-e-full' : '';
?>
">
    <div class="news-a">
        <?php 
while (have_posts()) {
    the_post();
    get_template_part('content', 'single');
    // If comments are open, load up the comment template.
 public function get_populated_sliders()
 {
     $posts = get_posts(array('post_type' => $this->post_type, 'numberposts' => -1));
     foreach ($posts as $key => $post) {
         $meta = fw_get_db_post_option($post->ID);
         if (!isset($meta['populated'])) {
             unset($posts[$key]);
         }
     }
     return $posts;
 }
    while (have_posts()) {
        the_post();
        if ($h > 0 && !is_float($h / 4)) {
            print $html_end_slider;
        }
        if (!is_float($h / 4)) {
            print $html_begin_slider;
        }
        print '<div class="col-md-3 team-single">';
        $image_id = get_post_thumbnail_id();
        $image_attributes_team = wp_get_attachment_image_src($image_id, 'full');
        print '<img src="' . esc_url($image_attributes_team[0]) . '" alt="' . get_the_title() . '" class="animate-me bounceIn">';
        print '<h3 class="center">' . get_the_title() . '</h3>';
        print the_excerpt();
        print '<ul class="social-list">';
        $teamoptions = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'teamsocial') : '';
        foreach ($teamoptions as $valueteam) {
            print '<li><a href="' . esc_url($valueteam['teamsociallink']) . '"><i class="' . $valueteam['teamsocialicon'] . '"></i></a></li>';
        }
        print '</ul>';
        print '</div>';
        $h++;
    }
}
if ($h > 0) {
    echo $html_end_slider;
}
wp_reset_query();
?>
	</div>
Exemple #15
0
$wp_query = $custom_query;
$item_string = "";
/** The Loop **/
if ($custom_query->have_posts()) {
    $i = 1;
    while ($custom_query->have_posts()) {
        $custom_query->the_post();
        /** optional post divider **/
        if ($i != 1 && $show_divider == "Yes") {
            $item_string .= '<div class="fw-row blog-row"><div class="fw-col-md-12 full-width"><div class="post-divider"></div></div></div>';
        }
        $hidden_thumb = "";
        /** post options **/
        if (function_exists('fw_get_db_settings_option')) {
            $fullsize = fw_get_db_post_option(get_the_ID(), 'opt_fullsize');
            $subtitle = fw_get_db_post_option(get_the_ID(), 'opt_subtitle');
        } else {
            $fullsize = "No";
        }
        /**  Start Full width post **/
        if ($fullsize == "Yes" || $layout == "full-width") {
            include locate_template('archive-templates/full-width.php');
        } else {
            if ($layout == "image-left-50") {
                include locate_template('archive-templates/left-50.php');
            } else {
                if ($layout == "image-left-33") {
                    include locate_template('archive-templates/left-33.php');
                } else {
                    if ($layout == "image-right-50") {
                        include locate_template('archive-templates/right-50.php');
								<div class="active tab-pane bounceInRight" id="skill-<?php 
                the_ID();
                ?>
">
							<?php 
            } else {
                ?>
								<div class="tab-pane bounceInRight" id="skill-<?php 
                the_ID();
                ?>
">
							<?php 
            }
            ?>
								<?php 
            $theicon = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'skillicon') : '';
            ?>
								<h2><i class="<?php 
            echo $theicon;
            ?>
"></i> <?php 
            the_title();
            ?>
</h2>
					  			<?php 
            the_content();
            ?>
							</div>
						<?php 
        }
        ?>
Exemple #17
0
        /**
         * @Slick Slider v4
         * @return {HTML}
         * */
        public function prepare_slider_version_v4($id = '')
        {
            $margin_top = fw_get_db_post_option($id, 'margin_top', true);
            $margin_bottom = fw_get_db_post_option($id, 'margin_bottom', true);
            $pagination = fw_get_db_post_option($id, 'pagination', true);
            $auto = fw_get_db_post_option($id, 'auto', true);
            $slider_speed = fw_get_db_post_option($id, 'slider_speed', true);
            $slider_type = fw_get_db_post_option($id, 'slider_type', true);
            $flag = fw_unique_increment();
            law_firm_enqueue_slick_library();
            //fw_print($slider_type);
            $autoPlay = 'true';
            if (isset($auto) && $auto == 'disable') {
                $autoPlay = 'false';
            }
            $navigation = 'true';
            if (isset($pagination) && $pagination == 'disable') {
                $navigation = 'false';
            }
            $css = array();
            if (isset($margin_top) && !empty($margin_top)) {
                $css[] = 'margin-top:' . $margin_top . 'px;';
            }
            if (isset($margin_bottom) && !empty($margin_bottom)) {
                $css[] = 'margin-bottom:' . $margin_bottom . 'px;';
            }
            if (isset($slider_type['slider_v4']['slides']) && is_array($slider_type['slider_v4']['slides']) && !empty($slider_type['slider_v4']['slides'])) {
                $slides = $slider_type['slider_v4']['slides'];
                ?>
            <div class="system-slider" style="<?php 
                echo implode(' ', $css);
                ?>
">
             	<div class="fadeslider-home" id="main-slider-<?php 
                echo esc_js($flag);
                ?>
">
				 <?php 
                foreach ($slides as $key => $slide) {
                    $button_link = $slide['button_link'];
                    $button_link_title = $slide['button_link_title'];
                    $slider_title = $slide['slider_title'];
                    $slider_description = $slide['slider_description'];
                    $slider_subheading = $slide['slider_subheading'];
                    if (isset($slide['slider_bg_image']['url']) && !empty($slide['slider_bg_image']['url'])) {
                        ?>
    
                            <div style="background-image: url(<?php 
                        echo esc_url($slide['slider_bg_image']['url']);
                        ?>
);">
                                <?php 
                        if (!empty($slider_title) || !empty($slider_subheading) || !empty($slider_description) || !empty($button_link_title)) {
                            ?>
                                    <div class="slide-inner">
                                        <div class="container">
                                            <div class="row">
                                                <div class="col-xs-12 col-xs-offset-0 col-sm-10 col-sm-offset-1 col-lg-8 col-lg-offset-2">
                                                    <?php 
                            if (!empty($slider_title)) {
                                ?>
                                                        <h1 class="slidetop"><?php 
                                echo esc_attr($slider_title);
                                ?>
</h1>
                                                    <?php 
                            }
                            ?>
                                                    <?php 
                            if (!empty($slider_subheading)) {
                                ?>
                                                        <h2 class="slidebottom"><?php 
                                echo esc_attr($slider_subheading);
                                ?>
</h2>
                                                    <?php 
                            }
                            ?>
                                                    <?php 
                            if (!empty($slider_description)) {
                                ?>
                                                        <p class="slidebottom"><i style="text-transform: lowercase;"><?php 
                                echo esc_attr($slider_description);
                                ?>
</i></p>
                                                    <?php 
                            }
                            ?>
                                                    <?php 
                            if (isset($button_link_title) && !empty($button_link_title)) {
                                ?>
                                                		<div class="shortcode-buttons add2 slidebottom">
                                                        	<a href="<?php 
                                echo esc_url($button_link);
                                ?>
" class="btn btn-default"><?php 
                                echo esc_attr($button_link_title);
                                ?>
</a>
                                                        </div>
                                                    <?php 
                            }
                            ?>
                                                </div>
                                            </div>
                                        </div>
                                	</div>
                                <?php 
                        }
                        ?>
                            </div>
                       <?php 
                    }
                }
                ?>
                </div>
                 <script>
					jQuery(document).ready(function(e) {
						jQuery('#main-slider-<?php 
                echo esc_js($flag);
                ?>
').slick({
							autoplay:<?php 
                echo esc_js($autoPlay);
                ?>
,
							autoplaySpeed: <?php 
                echo esc_js($slider_speed);
                ?>
,
							dots: <?php 
                echo esc_js($navigation);
                ?>
,
							infinite: true,
							speed: 300,
							fade: true,
							arrow: false,
							adaptiveHeight: true,
							cssEase: 'linear'   
						});
					});  
				</script>
            </div>
            <?php 
            }
        }
 public function render_slider($post_id, $dimensions, $extra_data = array())
 {
     $slider_name = fw_get_db_post_option($post_id, $this->get_name() . '/selected');
     $static = empty($extra_data['static']) || $extra_data['static'] == 'yes' ? true : false;
     if (!is_null($this->get_child($slider_name))) {
         $extra_data['static'] = apply_filters('fw_slider_enqueue_static_files', $static, $slider_name, $post_id);
         return $this->get_child($slider_name)->render_slider($post_id, $dimensions, $extra_data);
     }
 }
Exemple #19
0
 /**
  * @param int  $post_id
  * @param WP_Post $post
  */
 public function _action_save_post($post_id, $post)
 {
     if (!fw_is_real_post_save($post_id)) {
         return;
     }
     $options_values = array_merge((array) fw_get_db_post_option($post_id), fw_get_options_values_from_input(fw()->theme->get_post_options($post->post_type)));
     fw_set_db_post_option($post_id, null, $options_values);
     // find options that requested to be saved in separate meta
     foreach (fw_extract_only_options(fw()->theme->get_post_options($post->post_type)) as $option_id => $option) {
         if (isset($option['save-to-separate-meta']) && $option['save-to-separate-meta']) {
             // think of a better key name
             fw_update_post_meta($post_id, 'fw_option_' . $option_id, $options_values[$option_id]);
         }
     }
     do_action('fw_save_post_options', $post_id, $post, $options_values);
 }
    query_posts(array('skills-category' => $atts['category'], 'post_type' => 'skills', 'posts_per_page' => -1, 'orderby' => 'date', 'order' => $skillsorder));
} else {
    query_posts(array('post_type' => 'skills', 'posts_per_page' => -1, 'orderby' => 'date', 'order' => $skillsorder));
}
$h = 0;
if (have_posts()) {
    while (have_posts()) {
        the_post();
        if ($h > 0 && !is_float($h / 3)) {
            print $html_end_row;
        }
        if (!is_float($h / 3)) {
            print $html_begin_row;
        }
        $theicon = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'skillicon') : '';
        $skillmessage = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'skillmessage') : '';
        echo '<td class="skill animate-me zoomIn">';
        echo '<h4><i class="' . $theicon . '"></i>' . get_the_title() . '</h4>';
        echo '<p>' . esc_html($skillmessage) . '</p>';
        echo '</td>';
        $h++;
    }
}
if ($h > 0) {
    echo $html_end_row;
}
?>
			<?php 
wp_reset_query();
?>
		</table>
 public function get_frontend_data($post_id)
 {
     $selected = fw_get_db_post_option($post_id, 'slider/selected');
     $population_method = fw_get_db_post_option($post_id, 'slider/' . $selected . '/population-method');
     return $this->get_child('population-method-' . $population_method)->get_frontend_data($post_id);
 }
Exemple #22
0
/**
 * Set post option value in database
 *
 * @param null|int $post_id
 * @param string|null $option_id Specific option id (accepts multikey). null - all options
 * @param $value
 */
function fw_set_db_post_option($post_id = null, $option_id = null, $value)
{
    $post_id = intval($post_id);
    if (!$post_id) {
        /** @var WP_Post $post */
        global $post;
        if (!$post) {
            return;
        } else {
            $post_id = $post->ID;
        }
    }
    $old_value = fw_get_db_post_option($post_id, $option_id);
    $sub_keys = explode('/', $option_id);
    $base_key = array_shift($sub_keys);
    $option_id = 'fw_options' . ($option_id !== null ? '/' . $option_id : '');
    FW_WP_Meta::set('post', $post_id, $option_id, $value);
    fw()->backend->_sync_post_separate_meta($post_id);
    /**
     * @since 2.2.8
     */
    do_action('fw_post_options_update', $post_id, $base_key, $sub_keys, $old_value);
}
        echo $secondfeaturedheight;
        ?>
px;">
				</div>
			<?php 
    }
    ?>
			
			<!-- PAGE TITLE -->
			<h2 class="with-breaker animate-me fadeInUp">
				<?php 
    echo get_the_title();
    ?>
				<?php 
    // GET THE PAGE TITLE
    $subtitle = function_exists('fw_get_db_post_option') ? fw_get_db_post_option(get_the_ID(), 'subtitle') : '';
    if (!empty($subtitle)) {
        ?>
					<span><?php 
        echo $subtitle;
        ?>
</span>
				<?php 
    }
    ?>
			</h2>

			<?php 
    //THE BREADCRUMB
    if (!is_front_page() && function_exists('fw_ext_breadcrumbs') && is_page()) {
        fw_ext_breadcrumbs();
Exemple #24
0
$post_categories = wp_get_post_categories(get_the_ID());
$post_categories = array_values($post_categories);
$post_categories = thshpr_get_category_ids_string($post_categories);
if (function_exists('fw_get_db_customizer_option')) {
    $sticky_header = fw_get_db_customizer_option('opt_header_sticky');
}
if (function_exists('fw_get_db_post_option')) {
    //$value = fw_get_db_post_option(
    //'option_id/'. fw_get_db_post_option('option_id/'. 'gadget')
    $overrides = fw_get_db_post_option($post->ID, 'override_customizer');
    $override_customizer = $overrides['option-type'];
    /**
     * These two ptions have to be in the post itself
     */
    $subtitle = fw_get_db_post_option($post->ID, 'opt_subtitle');
    $back_image = fw_get_db_post_option($post->ID, 'opt_parallax_image');
    $background_image = $back_image['data']['icon'];
    if ($override_customizer == 'override') {
        /**
         * General Options
         */
        $show_progress_indicator = $overrides['override']['opt_show_progress_indicator'];
        $sidebar_type = $overrides['override']['opt_sidebar_type'];
        $sticky_sidebar = $overrides['override']['opt_sticky_sidebar'];
        $left_right_padding = $overrides['override']['opt_left_right_padding'];
        $show_fancy_prev_next = $overrides['override']['opt_show_fancy_prev_next'];
        /**
         * Title Options
         */
        $title_components_elements = $overrides['override']['opt_single_title_functionality'];
        $title_category_tag_number = $overrides['override']['opt_single_title_number_categories'];
Exemple #25
0
/**
 * Set post option value in database
 *
 * @param null|int $post_id
 * @param string|null $option_id Specific option id (accepts multikey). null - all options
 * @param $value
 */
function fw_set_db_post_option($post_id = null, $option_id = null, $value)
{
    FW_Cache::del('fw_post_options/values');
    $meta_key = 'fw_options';
    $post_id = intval($post_id);
    if (!$post_id) {
        /** @var WP_Post $post */
        global $post;
        if (!$post) {
            return;
        } else {
            $post_id = $post->ID;
        }
    }
    $post_type = get_post_type(($post_revision_id = wp_is_post_revision($post_id)) ? $post_revision_id : $post_id);
    try {
        $options = FW_Cache::get($cache_key = 'fw_post_options/only/' . $post_type);
    } catch (FW_Cache_Not_Found_Exception $e) {
        FW_Cache::set($cache_key, $options = array());
        // prevent recursion
        if (apply_filters('fw_get_db_post_option:fw-storage-enabled', $post_type !== 'fw-slider', $post_type)) {
            FW_Cache::set($cache_key, $options = fw_extract_only_options(fw()->theme->get_post_options($post_type)));
        }
    }
    $sub_keys = null;
    if ($option_id) {
        $option_id = explode('/', $option_id);
        // 'option_id/sub/keys'
        $_option_id = array_shift($option_id);
        // 'option_id'
        $sub_keys = empty($option_id) ? null : implode('/', $option_id);
        // 'sub/keys'
        $option_id = $_option_id;
        unset($_option_id);
        $old_value = fw_get_db_post_option($post_id, $option_id);
        if ($sub_keys) {
            // update sub_key in old_value and use the entire value
            $new_value = $old_value;
            fw_aks($sub_keys, $value, $new_value);
            $value = $new_value;
            unset($new_value);
            $old_value = fw_akg($sub_keys, $old_value);
        }
        if (isset($options[$option_id])) {
            $value = fw()->backend->option_type($options[$option_id]['type'])->storage_save($option_id, $options[$option_id], $value, array('post-id' => $post_id));
        }
        FW_WP_Meta::set('post', $post_id, $meta_key . '/' . $option_id, $value);
    } else {
        $old_value = fw_get_db_post_option($post_id);
        if (!is_array($value)) {
            $value = array();
        }
        foreach ($value as $_option_id => $_option_value) {
            if (isset($options[$_option_id])) {
                $value[$_option_id] = fw()->backend->option_type($options[$_option_id]['type'])->storage_save($_option_id, $options[$_option_id], $_option_value, array('post-id' => $post_id));
            }
        }
        FW_WP_Meta::set('post', $post_id, $meta_key, $value);
    }
    FW_Cache::del('fw_post_options/values');
    // fixes https://github.com/ThemeFuse/Unyson/issues/1538
    /**
     * @deprecated
     */
    fw()->backend->_sync_post_separate_meta($post_id);
    /**
     * @since 2.2.8
     */
    do_action('fw_post_options_update', $post_id, $option_id, explode('/', $sub_keys), $old_value);
}
Exemple #26
0
 /**
  * Update all post meta `fw_option:<option-id>` with values from post options that has the 'save-in-separate-meta' parameter
  *
  * @param int $post_id
  *
  * @return bool
  * @deprecated since 2.5.0
  */
 public function _sync_post_separate_meta($post_id)
 {
     $post_type = get_post_type($post_id);
     if (!$post_type) {
         return false;
     }
     $meta_prefix = 'fw_option:';
     $options_values = fw_get_db_post_option($post_id);
     $separate_meta_options = array();
     foreach (fw_extract_only_options(fw()->theme->get_post_options($post_type)) as $option_id => $option) {
         if (isset($option['save-in-separate-meta']) && $option['save-in-separate-meta'] && array_key_exists($option_id, $options_values)) {
             $separate_meta_options[$meta_prefix . $option_id] = $options_values[$option_id];
         }
     }
     unset($options_values);
     /** @var wpdb $wpdb */
     global $wpdb;
     foreach ($wpdb->get_results($wpdb->prepare("SELECT meta_key " . "FROM {$wpdb->postmeta} " . "WHERE meta_key LIKE %s AND post_id = %d", $wpdb->esc_like($meta_prefix) . '%', $post_id)) as $row) {
         if (array_key_exists($row->meta_key, $separate_meta_options)) {
             /**
              * This meta exists and will be updated below.
              * Do not delete for performance reasons, instead of delete->insert will be performed only update
              */
             continue;
         } else {
             // this option does not exist anymore
             delete_post_meta($post_id, $row->meta_key);
         }
     }
     foreach ($separate_meta_options as $meta_key => $option_value) {
         fw_update_post_meta($post_id, $meta_key, $option_value);
     }
     return true;
 }
Exemple #27
0
/**
 * Set post option value in database
 *
 * @param null|int $post_id
 * @param string|null $option_id Specific option id (accepts multikey). null - all options
 * @param $value
 */
function fw_set_db_post_option($post_id = null, $option_id = null, $value)
{
    $post_id = intval($post_id);
    if (!$post_id) {
        /** @var WP_Post $post */
        global $post;
        if (!$post) {
            return;
        } else {
            $post_id = $post->ID;
        }
    }
    $options = fw_extract_only_options(fw()->theme->get_post_options(get_post_type(($post_revision_id = wp_is_post_revision($post_id)) ? $post_revision_id : $post_id)));
    $sub_keys = null;
    if ($option_id) {
        $option_id = explode('/', $option_id);
        // 'option_id/sub/keys'
        $_option_id = array_shift($option_id);
        // 'option_id'
        $sub_keys = implode('/', $option_id);
        // 'sub/keys'
        $option_id = $_option_id;
        unset($_option_id);
        $old_value = fw_get_db_post_option($post_id, $option_id);
        if ($sub_keys) {
            // update sub_key in old_value and use the entire value
            $new_value = $old_value;
            fw_aks($sub_keys, $value, $new_value);
            $value = $new_value;
            unset($new_value);
            $old_value = fw_akg($sub_keys, $old_value);
        }
        if (isset($options[$option_id])) {
            $value = fw()->backend->option_type($options[$option_id]['type'])->storage_save($option_id, $options[$option_id], $value, array('post-id' => $post_id));
        }
        FW_WP_Meta::set('post', $post_id, 'fw_options/' . $option_id, $value);
    } else {
        $old_value = fw_get_db_post_option($post_id);
        if (!is_array($value)) {
            $value = array();
        }
        foreach ($value as $_option_id => $_option_value) {
            if (isset($options[$_option_id])) {
                $value[$_option_id] = fw()->backend->option_type($options[$_option_id]['type'])->storage_save($_option_id, $options[$_option_id], $_option_value, array('post-id' => $post_id));
            }
        }
        FW_WP_Meta::set('post', $post_id, 'fw_options', $value);
    }
    /**
     * @deprecated
     */
    fw()->backend->_sync_post_separate_meta($post_id);
    /**
     * @since 2.2.8
     */
    do_action('fw_post_options_update', $post_id, $option_id, explode('/', $sub_keys), $old_value);
}
<?php

if (!defined('FW')) {
    die('Forbidden');
}
/**
 * @var string $the_content
 */
global $post;
$options = fw_get_db_post_option($post->ID, fw()->extensions->get('events')->get_event_option_id());
foreach ($options['event_children'] as $key => $row) {
    ?>
	<?php 
    if (empty($row['event_date_range']['from']) or empty($row['event_date_range']['to'])) {
        ?>
		<?php 
        continue;
        ?>
	<?php 
    }
    ?>
	<ul class="details-event">
		<li><b><?php 
    _e('Start', 'fw');
    ?>
:</b> <?php 
    echo $row['event_date_range']['from'];
    ?>
</li>
		<li><b><?php 
    _e('End', 'fw');
Exemple #29
0
get_header();
?>

	<div id="primary" class="content-area">
		<div id="content" class="site-content" role="main">
			<?php 
// Start the Loop.
while (have_posts()) {
    the_post();
    global $post;
    /**
     * @var WP_Query $wp_query
     */
    global $wp_query;
    $lesson = get_post($post->post_parent);
    $pass_mark = (int) fw_get_db_post_option($lesson->ID, 'learning-quiz-passmark');
    $text = '';
    if ($pass_mark > 0) {
        $text = sprintf(__('You require %d%% in oder to pass the test', 'unyson'), $pass_mark);
    }
    $response = fw_ext_learning_quiz_get_response();
    if (!empty($response)) {
        if ((int) $response['minimum-pass-mark'] > 0) {
            if ((int) $response['accumulated'] < (int) $response['minimum-pass-mark']) {
                $text = __('Sorry, you did not pass the test', 'unyson');
            } else {
                $text = __('Congratulation, you passed the test', 'unyson');
            }
        } else {
            $correct = 0;
            foreach ($response['questions'] as $question) {
 /**
  * Init the titles-metas extension in frontend
  * This method get the location ( posts, pages, archives, taxonomies ) SEO titles and returns to the wp_title
  *
  * @param $title , current wordpress title, before being processed
  * @param $sep , worpdress title separator
  * @param $sepdirection , wordpress separator direction
  *
  * @return string
  * @internal
  */
 public function _action_add_title($title, $sep, $sepdirection)
 {
     $location = $this->get_parent()->get_location();
     $prefix = $this->get_name() . '-';
     if (empty($location['type'])) {
         // fixme: investigate why this happens and add an info comment here
         return;
     }
     switch ($location['type']) {
         case '404':
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'not-found-title'));
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'search':
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'search-page-title'));
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'author_archive':
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'author-archive-title'));
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'date_archive':
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'date-archive-title'));
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'front_page':
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'homepage-title'));
             if (!empty($fw_title)) {
                 $title = $fw_title;
             } elseif (isset($location['id'])) {
                 $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_post_option($location['id'], $prefix . 'title'));
                 if (!empty($fw_title)) {
                     $title = $fw_title;
                 }
             }
             break;
         case 'blog_page':
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_post_option($location['id'], $prefix . 'title'));
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'singular':
             if (!in_array($location['post_type'], $this->allowed_post_types)) {
                 break;
             }
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_post_option($location['id'], $prefix . 'title'));
             if (empty($fw_title)) {
                 $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . $location['post_type'] . '-title'));
             }
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'category':
             if (!in_array($location['type'], $this->allowed_taxonomies)) {
                 break;
             }
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_term_option($location['id'], 'category', $prefix . 'title'));
             if (empty($fw_title)) {
                 $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'category-title'));
             }
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'tag':
             if (!in_array('post_tag', $this->allowed_taxonomies)) {
                 break;
             }
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_term_option($location['id'], 'post_tag', $prefix . 'title'));
             if (empty($fw_title)) {
                 $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'post_tag-title'));
             }
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'taxonomy':
             if (!in_array($location['taxonomy_type'], $this->allowed_taxonomies)) {
                 break;
             }
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_term_option($location['id'], $location['taxonomy_type'], $prefix . 'title'));
             if (empty($fw_title)) {
                 $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . $location['taxonomy_type'] . '-title'));
             }
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
         case 'feed':
             $fw_title = fw_ext_seo_parse_meta_tags(fw_get_db_ext_settings_option($this->get_parent()->get_name(), $prefix . 'homepage-title'));
             if (!empty($fw_title)) {
                 $title = $fw_title;
             }
             break;
     }
     $title = apply_filters('fw_ext_seo_titles_metas_load_title', $title, $sep, $sepdirection, $location);
     return $title;
 }