示例#1
0
/**
 * Get page layout
 *
 * @param string $default Default layout
 *
 * @return string
 */
function constructent_layout($default = 'sidebar-right')
{
    // Default layout
    $layout = $default;
    // Site layout
    if ($site_layout = constructent_option('site_layout')) {
        $layout = $site_layout;
    }
    // Singular page can have custom layout
    if (is_page()) {
        $custom_layout = constructent_meta('layout');
        if ($custom_layout && constructent_meta('custom_layout')) {
            $layout = $custom_layout;
        } else {
            $layout = constructent_option('page_layout');
        }
    }
    // Shop page layout
    if (function_exists('is_woocommerce') && is_woocommerce()) {
        $layout = constructent_option('shop_layout');
    }
    // Layout Full content
    if (is_page_template('tpl/portfolio.php') || is_singular('portfolio') || is_404()) {
        $layout = 'full-content';
    }
    if (is_tax('portfolio_category') && constructent_option('portfolio_columns')) {
        $layout = 'full-content';
    }
    // Allow to filter
    $layout = apply_filters(__FUNCTION__, $layout);
    return $layout;
}
示例#2
0
/**
 * Get post thumbnail src based on post formats
 *
 * @param $size
 *
 * @return string
 */
function constructent_post_thumbnail_src($size)
{
    $src = '';
    switch (get_post_format()) {
        case 'gallery':
            $images = constructent_meta('images', "type=image&size={$size}");
            if (empty($images)) {
                break;
            }
            $image = current($images);
            $src = $image['url'];
            break;
        default:
            $src = constructent_get_image(array('size' => $size, 'format' => 'src', 'meta_key' => 'image', 'echo' => false));
            break;
    }
    return $src;
}
示例#3
0
    /**
     * Show team shortcode
     *
     * @param array $atts
     * @param string $content
     *
     * @return string
     */
    function team($atts, $content)
    {
        $atts = shortcode_atts(array('number' => 10, 'columns' => 4, 'orderby' => 'date', 'order' => 'DESC'), $atts, 'team');
        $args = array('post_type' => 'team_member', 'posts_per_page' => absint($atts['number']), 'orderby' => $atts['orderby'], 'order' => $atts['order']);
        $members = new WP_Query($args);
        if (!$members->have_posts()) {
            return '';
        }
        $socials = array('facebook', 'twitter', 'google', 'linkedin', 'tumblr');
        $list = array();
        while ($members->have_posts()) {
            $members->the_post();
            $links = array();
            foreach ($socials as $social) {
                $url = constructent_meta($social);
                if ($url) {
                    $links[] = sprintf('<li><a href="%s" rel="nofollow" target="_blank"><i class="fa fa-%s"></i></a></li>', esc_url($url), $social == 'google' ? 'google-plus' : $social);
                }
            }
            $list[] = sprintf('<div class="team-member clearfix">
					%s
					<div class="member-bio">
						%s
					</div>
					<div class="member-info">
						<h5 class="name">%s</h5>
						<span class="position">%s</span>
					</div>
					%s
				</div>', constructent_get_image('size=constructent-member-thumbnail&echo=0'), constructent_content_limit(12, false, false), get_the_title(), constructent_meta('job'), $links ? '<ul class="social-icons">' . implode("\n", $links) . '</ul>' : '');
        }
        wp_reset_postdata();
        return sprintf('<div class="fitsc-team"><div class="team-members" data-items="%d">%s</div></div>', absint($atts['columns']), implode("\n", $list));
    }
示例#4
0
 /**
  * Output custom CSS directly into <head>
  * This is needed in case of singular pages where custom CSS is applied to that page only
  * and cannot be saved in custom.css file
  *
  * @return void
  */
 function direct_css()
 {
     $css = '';
     if (is_singular()) {
         if ($bg = constructent_meta('featured_title_background')) {
             $css .= '.featured-title { background-image: url(' . esc_attr($bg) . '); }';
         }
         if ($custom_css = constructent_meta('custom_css')) {
             $css .= $custom_css;
         }
     }
     if ($css) {
         echo "<style>{$css}</style>";
     }
 }
示例#5
0
<?php

if (is_front_page()) {
    return;
}
if (constructent_option('hide_breadcrumbs')) {
    return;
}
if (is_page() && constructent_meta('hide_breadcrumbs')) {
    return;
}
$tax = 'category';
if (function_exists('is_woocommerce') && is_woocommerce()) {
    $tax = 'product_cat';
} elseif (is_singular('portfolio') || is_tax('portfolio_category')) {
    $tax = 'portfolio_category';
}
echo '<div class="breadcrumb-wrapper container"><ul class="breadcrumb">';
constructent_breadcrumbs(array('separator' => '', 'before' => '', 'before_item' => '<li>', 'after_item' => '</li>', 'display_last_item' => true, 'taxonomy' => $tax));
echo '</ul></div>';
<div class="project-images">
	<?php 
$images = constructent_meta('images', 'type=image_advanced');
if ($images) {
    foreach ($images as $image) {
        printf('<img src="%s" alt="">', esc_url($image['full_url']), esc_attr($image['name']));
    }
}
?>
</div>
<div class="project-details">
	<?php 
the_content();
?>
</div>
示例#7
0
/**
 * Show entry format images, video, gallery, audio, etc.
 * @return void
 */
function constructent_post_formats()
{
    $html = '';
    $size = apply_filters('constructent_post_format_thumbnail_size', 'constructent-big-post-thumbs');
    switch (get_post_format()) {
        case 'image':
            $image = constructent_get_image(array('size' => $size, 'format' => 'src', 'meta_key' => 'image', 'echo' => false));
            if (!$image) {
                break;
            }
            $html = sprintf('<a class="post-image" href="%1$s" title="%2$s"><img src="%3$s" alt="%2$s"></a>', get_permalink(), the_title_attribute('echo=0'), $image);
            break;
        case 'gallery':
            $images = constructent_meta('images', "type=image&size={$size}");
            if (empty($images)) {
                break;
            }
            $current = 0;
            $carousel = array('id' => 'entry-gallery-' . get_the_ID(), 'indicators' => array(), 'items' => array());
            foreach ($images as $image) {
                $carousel['indicators'][] = sprintf('<li data-target="#%s" data-slide-to="%s" class="%s"></li>', $carousel['id'], $current, 0 == $current ? 'active' : '');
                $carousel['items'][] = sprintf('<div class="item %s"><img src="%s" alt="gallery"></div>', 0 == $current ? 'active' : '', $image['url']);
                $current++;
            }
            $html .= '<div id="' . $carousel['id'] . '" class="carousel slide" data-ride="carousel">';
            $html .= '<ol class="carousel-indicators">' . implode("\n", $carousel['indicators']) . '</ol>';
            $html .= '<div class="carousel-inner">' . implode("\n", $carousel['items']) . '</div>';
            $html .= '</div>';
            break;
        case 'audio':
            $audio = constructent_meta('audio');
            if (!$audio) {
                break;
            }
            // If URL: show oEmbed HTML or jPlayer
            if (filter_var($audio, FILTER_VALIDATE_URL)) {
                // Try oEmbed first
                if ($oembed = @wp_oembed_get($audio)) {
                    $html .= $oembed;
                } else {
                    $html .= '<div class="audio-player">' . wp_audio_shortcode(array('src' => $audio)) . '</div>';
                    $attachment_id = constructent_get_attachment_id_from_url($audio);
                    if (!empty($attachment_id)) {
                        $html .= constructent_media_metadata($attachment_id, 'audio');
                    }
                }
            } else {
                $html .= $audio;
            }
            break;
        case 'video':
            $video = constructent_meta('video');
            if (!$video) {
                break;
            }
            // If URL: show oEmbed HTML
            if (filter_var($video, FILTER_VALIDATE_URL)) {
                if ($oembed = @wp_oembed_get($video)) {
                    $html .= $oembed;
                } else {
                    $atts = array('src' => $video, 'width' => 848);
                    if (has_post_thumbnail()) {
                        $atts['poster'] = constructent_get_image('format=src&echo=0&size=full');
                    }
                    $html .= wp_video_shortcode($atts);
                    $attachment_id = constructent_get_attachment_id_from_url($video);
                    if (!empty($attachment_id)) {
                        $html .= constructent_media_metadata($attachment_id, 'video');
                    }
                }
            } else {
                $html .= $video;
            }
            break;
        case 'quote':
            $quote = constructent_meta('quote');
            $author = constructent_meta('author');
            $author_url = constructent_meta('author_url');
            if ($author_url) {
                $author = "<a href='{$author_url}'>{$author}</a>";
            }
            if ($quote && $author) {
                $html .= "<blockquote>{$quote}<cite>- {$author}</cite></blockquote>";
            }
            break;
        case 'link':
            $url = constructent_meta('url');
            $text = constructent_meta('text');
            if ($url && $text) {
                $html .= "<p><a class='link' title='{$text}' href='{$url}'>{$text}</a></p>";
            }
            break;
        default:
            $thumb = get_the_post_thumbnail(get_the_ID(), $size);
            if (empty($thumb)) {
                return;
            }
            $html .= '<a class="post-image" href="' . get_permalink() . '">';
            $html .= $thumb;
            $html .= '</a>';
    }
    if ($html) {
        echo "<div class='entry-format'>{$html}</div>";
    }
}
示例#8
0
/**
 * Add classes to <body>
 *
 * @param array $classes
 *
 * @return array
 */
function constructent_body_class($classes)
{
    // Layout class
    $classes[] = constructent_layout();
    // Class for layout style
    $classes[] = constructent_option('layout_style');
    // Color scheme
    $custom_color_scheme = constructent_option('custom_color_scheme');
    if (!$custom_color_scheme) {
        $classes[] = constructent_option('color_scheme');
    } else {
        $classes[] = 'custom-color-scheme';
    }
    // Class for custom header color
    if (constructent_option('header_custom') && constructent_option('header_background')) {
        $classes[] = 'header-custom';
    }
    // Class for woocommerce columns
    if (function_exists('is_shop') && (is_shop() || is_product_taxonomy())) {
        global $woocommerce_loop;
        if (empty($woocommerce_loop['columns'])) {
            $columns = 'full-content' == constructent_layout() ? 4 : 3;
        } else {
            $columns = $woocommerce_loop['columns'];
        }
        $classes[] = 'columns-' . esc_attr($columns);
    }
    // Class for solid header
    $header_type = constructent_option('header_type');
    $header_type = $header_type ? esc_attr($header_type) : 'static';
    if ($header_type == 'absolute' && !is_page_template('tpl/homepage.php')) {
        $classes[] = 'header-static';
    } else {
        $classes[] = 'header-' . $header_type;
    }
    // Transparent header
    if ('absolute' == $header_type && is_page_template('tpl/homepage.php') && constructent_option('header_transparent')) {
        $classes[] = 'header-transparent';
    }
    // Class for menu hover
    if ($hover = constructent_option('menu_hover')) {
        $classes[] = 'menu-hover-' . $hover;
    }
    // If no featured title area
    if (!constructent_show_featured_title()) {
        $classes[] = 'no-title-area';
    }
    // Class for portfolio layout
    if (is_page_template('tpl/portfolio.php')) {
        $classes[] = 'portfolio-' . constructent_meta('style_portfolio');
    }
    // Class for portfolio category layout
    if (is_tax('portfolio_category')) {
        $classes[] = 'portfolio-' . constructent_option('portfolio_view');
    }
    $classes = array_unique(array_filter($classes));
    return $classes;
}
示例#9
0
<?php

/*
 * Template Name: Contact
 */
?>

<?php 
$ct_address_1 = constructent_meta('ct_address_1');
$ct_address_2 = constructent_meta('ct_address_2');
$ct_phone = constructent_meta('ct_phone');
$ct_email = constructent_meta('ct_email');
$ct_day = constructent_meta('ct_day');
$ct_time = constructent_meta('ct_time');
$ct_cf_shortcode = constructent_meta('ct_cf_shortcode');
$ct_map_shortcode = constructent_meta('ct_map_shortcode');
?>

<div class="ct-contact-info">
	<ul class="container">
	<?php 
if ($ct_address_1 || $ct_address_2) {
    ?>
		<li class="ct-address col-md-4 col-xs-12">
			<?php 
    if ($ct_address_1 != '') {
        echo '<span class="ct-address-1">' . $ct_address_1 . '</span>';
    }
    $address_2_class = $ct_address_1 == '' ? 'ct-address-1' : 'ct-address-2';
    if ($ct_address_2 != '') {
        echo '<span class="' . $address_2_class . '">' . $ct_address_2 . '</span>';
示例#10
0
}
$title = esc_html__('Archives', 'constructent');
$subtitle = '';
if (is_home()) {
    if ('posts' == get_option('show_on_front')) {
        $title = esc_html__('Home', 'constructent');
    } else {
        $page_for_posts = get_option('page_for_posts');
        $title = $page_for_posts ? get_the_title($page_for_posts) : esc_html__('Blog', 'constructent');
        $subtitle = constructent_meta('subtitle', '', $page_for_posts);
    }
} elseif (is_singular()) {
    if (!($title = constructent_meta('custom_title'))) {
        $title = get_the_title();
    }
    $subtitle = constructent_meta('subtitle');
} elseif (is_search()) {
    $title = sprintf(esc_html__('Search results for &quot;%s&quot;', 'constructent'), get_search_query());
} elseif (is_author()) {
    the_post();
    $title = sprintf(esc_html__('Author Archives: %s', 'constructent'), get_the_author());
    rewind_posts();
} elseif (is_day()) {
    $title = sprintf(esc_html__('Daily Archives: %s', 'constructent'), get_the_date());
} elseif (is_month()) {
    $title = sprintf(esc_html__('Monthly Archives: %s', 'constructent'), get_the_date('F Y'));
} elseif (is_year()) {
    $title = sprintf(esc_html__('Yearly Archives: %s', 'constructent'), get_the_date('Y'));
} elseif (is_tax() || is_category() || is_tag()) {
    $title = single_term_title('', false);
} elseif (function_exists('is_shop') && is_shop()) {