Ejemplo n.º 1
0
<?php

global $prodoConfig;
$isFrontPage = ProdoTheme::isFrontPage(get_the_ID());
?>
<!DOCTYPE html>
<html class="no-js <?php 
echo ($prodoConfig['header-sticky'] and !$isFrontPage) ? 'nav-sticky' : '';
?>
 <?php 
echo is_admin_bar_showing() ? 'wp-bar' : '';
?>
" <?php 
language_attributes();
?>
>
<head>
<meta charset="<?php 
bloginfo('charset');
?>
">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php 
if (!function_exists('_wp_render_title_tag')) {
    ?>
<title><?php 
    wp_title('|', true, 'right');
    ?>
</title>
<?php 
}
    public static function portfolio($atts, $content = null)
    {
        extract(shortcode_atts(array('limit' => -1, 'order' => 'menu_order', 'filters' => 'yes', 'terms' => ''), $atts));
        $filters_html = '';
        $limit = intval($limit);
        if ($filters == 'yes') {
            $categories = get_terms('portfolio-category', array('orderby' => 'count', 'order' => 'DESC', 'hide_empty' => 1));
            $filters_html = '<a href="#" data-filter="*" class="active">' . __('All', 'prodo') . '</a>';
            if (count($categories) > 0) {
                foreach ($categories as $row) {
                    $filters_html .= '<a href="#" data-filter=".filter-' . esc_attr($row->slug) . '">' . esc_html($row->name) . '</a>';
                }
            }
        }
        $query = array('post_type' => 'portfolio', 'numberposts' => $limit, 'order' => ($order == 'date' or $order == 'modified' or $order == 'rand') ? 'DESC' : 'ASC', 'orderby' => $order);
        if (!empty($terms)) {
            $terms_arr = explode(',', $terms);
            $terms_query = array();
            if (is_array($terms_arr) and count($terms_arr) > 0) {
                foreach ($terms_arr as $term) {
                    $terms_query[] = trim(esc_sql($term));
                }
                $query['tax_query'] = array(array('taxonomy' => 'portfolio-category', 'field' => 'slug', 'terms' => $terms_query));
            }
        }
        $rows = get_posts($query);
        $output = $projects = '';
        if (count($rows) > 0) {
            foreach ($rows as $row) {
                $info = wp_get_object_terms($row->ID, 'portfolio-category');
                $category = array();
                $filter = '';
                foreach ($info as $item) {
                    $category[] = $item->name;
                    $filter .= 'filter-' . $item->slug . ' ';
                }
                $category = implode(', ', $category);
                $filter = rtrim($filter);
                unset($info);
                $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($row->ID), 'full');
                $title = apply_filters('the_title', $row->post_title);
                $link = get_permalink($row->ID);
                if (get_option('show_on_front', 'posts') == 'page' and get_option('page_on_front', 0) > 0 and ProdoTheme::isFrontPage(get_the_ID())) {
                    $href = site_url('#view-' . $row->post_name);
                } else {
                    $href = $link;
                }
                $projects .= '
				<div class="animation animation-from-left">
					<div class="portfolio-item' . (!empty($filter) ? ' ' . esc_attr($filter) : '') . '" rel="' . esc_attr($row->post_name) . '">
						<img src="' . $thumb[0] . '" alt="' . esc_attr($title) . '"><div class="overlay"></div>
						<div class="details">' . esc_html($category) . '</div>
						<div class="href"><a href="' . esc_url($href) . '" data-url="' . esc_url($link) . '"></a></div></div></div>';
            }
            if ($filters == 'yes' and !empty($filters_html)) {
                $output = '<div class="row"><div class="col-md-12 portfolio-filters">' . $filters_html . '</div></div>';
            }
            $output .= '</div><div class="container-fluid offsetTop' . (($filters == 'yes' and !empty($filters_html)) ? '' : 'S') . '"><div class="row portfolio-items clearfix" data-on-line-lg="5" data-on-line-md="5" data-on-line-sm="4" data-on-line-xs="2">' . $projects . '</div>';
        }
        return $output;
    }
Ejemplo n.º 3
0
 public static function menuAtts($atts, $item, $args = array())
 {
     if (!isset($args->theme_location) or $args->theme_location != 'header-menu') {
         return $atts;
     }
     if (get_option('show_on_front', 'posts') == 'page' and get_option('page_on_front', 0) > 0) {
         $is_front_page = ProdoTheme::isFrontPage(get_the_ID());
         if ($is_front_page) {
             $front_id = get_option('page_on_front');
             if (intval($front_id) == $item->object_id and $item->object_id == get_the_ID()) {
                 $atts['href'] = '#intro';
             }
         }
         if ($item->object == 'page') {
             if ($slug = self::sectionID($item->object_id)) {
                 if ($is_front_page) {
                     $atts['href'] = '#' . $slug;
                 } else {
                     $atts['href'] = esc_url(site_url('#' . $slug));
                 }
             }
         }
     }
     return $atts;
 }