コード例 #1
0
ファイル: shortcodes.php プロジェクト: riaface/GrowBeyond
function sc_team_item($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "user" => "", "name" => "", "position" => "", "photo" => "", "email" => "", "socials" => "", "border" => "no", "align" => ""), $atts));
    global $THEMEREX_sc_team_counter, $THEMEREX_sc_team_columns, $THEMEREX_sc_team_style;
    $THEMEREX_sc_team_counter++;
    $style = $THEMEREX_sc_team_style;
    $descr = do_shortcode($content);
    if (!empty($user) && $user != 'none' && ($user_obj = get_user_by('login', $user)) != false) {
        $meta = get_user_meta($user_obj->ID);
        if (empty($email)) {
            $email = $user_obj->data->user_email;
        }
        if (empty($name)) {
            $name = $user_obj->data->display_name;
        }
        if (empty($position)) {
            $position = isset($meta['user_position'][0]) ? $meta['user_position'][0] : '';
        }
        //	if (empty($descr))		$descr = isset($meta['description'][0]) ? $meta['description'][0] : '';
        if (empty($socials)) {
            $socials = showUserSocialLinks(array('author_id' => $user_obj->ID, 'echo' => false, 'before' => '<li>', 'after' => '</li>', 'style' => 'icons'));
        }
    } else {
        global $THEMEREX_user_social_list;
        $allowed = explode('|', $socials);
        $socials = '';
        for ($i = 0; $i < count($allowed); $i++) {
            $s = explode('=', $allowed[$i]);
            if (!empty($s[1]) && array_key_exists($s[0], $THEMEREX_user_social_list)) {
                $img = get_template_directory_uri() . '/images/socials/' . $s[0] . '.png';
                $socials .= '<li><a href="' . $s[1] . '" class="social_icons social_' . $s[0] . ' ' . $s[0] . '" target="_blank" style="background-image: url(' . $img . ');">' . '<span style="background-image: url(' . $img . ');"></span>' . '</a></li>';
            }
        }
    }
    $photo_sizes = getThumbSizes(array('thumb_size' => getThumbColumns('cub', $THEMEREX_sc_team_columns), 'thumb_crop' => true, 'sidebar' => false));
    if (empty($photo)) {
        if (!empty($email)) {
            $photo = get_avatar($email, $photo_sizes['w']);
        }
    } else {
        $photo = getResizedImageTag($photo, $photo_sizes['w'], $photo_sizes['h']);
    }
    if (!empty($name) || !empty($position)) {
        if ($style != '3') {
            return '<div class="sc_columns_item">' . '<div' . ($id ? ' id="sc_team_item_' . $id . '"' : '') . ' class="sc_team_item sc_team_item_' . $THEMEREX_sc_team_counter . ($THEMEREX_sc_team_counter % 2 == 1 ? ' odd' : ' even') . ($THEMEREX_sc_team_counter == 1 ? ' first' : '') . '">' . '<div class="sc_team_item_avatar_wrap">' . '<div class="sc_team_item_avatar ' . ($border == "yes" ? 'sc_team_item_border' : '') . '">' . $photo . '</div>' . (!empty($socials) ? '<div class="sc_team_item_socials"><ul>' . $socials . '</ul></div>' : '') . '</div>' . ($name != '' ? '<h3 class="sc_team_item_title">' . $name . '</h3>' : '') . ($position != '' ? '<div class="sc_team_item_position">' . $position . '</div>' : '') . ($descr != '' ? '<div class="sc_team_item_description">' . $descr . '</div>' : '') . '</div>' . '</div>';
        } else {
            if ($style == '3') {
                if ($align == "left") {
                    return '<div class="sc_columns_item sc_team_left" >' . '<div' . ($id ? ' id="sc_team_item_' . $id . '"' : '') . ' class="sc_team_item sc_team_item_' . $THEMEREX_sc_team_counter . ($THEMEREX_sc_team_counter % 2 == 1 ? ' odd' : ' even') . ($THEMEREX_sc_team_counter == 1 ? ' first' : '') . '">' . '<div class="sc_team_content"><div class="sc_team_middle">' . ($name != '' ? '<h3 class="sc_team_item_title">' . $name . '</h3>' : '') . ($position != '' ? '<div class="sc_team_item_position">' . $position . '</div>' : '') . ($descr != '' ? '<div class="sc_team_item_description">' . $descr . '</div>' : '') . '</div></div>' . '<div class="sc_team_item_avatar_wrap">' . '<div class="sc_team_line"></div>' . '<div class="sc_team_item_avatar ' . ($border == "yes" ? 'sc_team_item_border' : '') . '">' . $photo . '</div>' . (!empty($socials) ? '<div class="sc_team_item_socials"><ul>' . $socials . '</ul></div>' : '') . '</div>' . '<div class="sc_space_column"></div>' . '</div>' . '</div>';
                } else {
                    return '<div class="sc_columns_item">' . '<div' . ($id ? ' id="sc_team_item_' . $id . '"' : '') . ' class="sc_team_item sc_team_item_' . $THEMEREX_sc_team_counter . ($THEMEREX_sc_team_counter % 2 == 1 ? ' odd' : ' even') . ($THEMEREX_sc_team_counter == 1 ? ' first' : '') . '">' . '<div class="sc_space_column"></div>' . '<div class="sc_team_item_avatar_wrap">' . '<div class="sc_team_line"></div>' . '<div class="sc_team_item_avatar">' . $photo . '</div>' . (!empty($socials) ? '<div class="sc_team_item_socials"><ul>' . $socials . '</ul></div>' : '') . '</div>' . '<div class="sc_team_content"><div class="sc_team_middle">' . ($name != '' ? '<h3 class="sc_team_item_title">' . $name . '</h3>' : '') . ($position != '' ? '<div class="sc_team_item_position">' . $position . '</div>' : '') . ($descr != '' ? '<div class="sc_team_item_description">' . $descr . '</div>' : '') . '</div></div>' . '</div>' . '</div>';
                }
            }
        }
    }
    return '';
}
コード例 #2
0
        $args['category__in'] = $post_data['post_categories_ids'];
    }
    // Uncomment this section if you want filter related posts on post formats
    if ($post_data['post_format'] != '' && $post_data['post_format'] != 'standard') {
        $args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-' . $post_data['post_format']));
    }
    $args = addSortOrderInQuery($args, get_custom_option('post_related_sort'), get_custom_option('post_related_order'));
    $recent_posts = wp_get_recent_posts($args, OBJECT);
    if (is_array($recent_posts) && count($recent_posts) > 0) {
        ?>
		<section class="related">
			<h3><?php 
        _e('Related posts', 'themerex');
        ?>
</h3>
			<div class="sc_columns_<?php 
        echo esc_attr($columns);
        ?>
 postBox">
				<?php 
        $i = 0;
        foreach ($recent_posts as $recent) {
            $i++;
            showPostLayout(array('layout' => 'related', 'number' => $i, 'add_view_more' => false, 'posts_on_page' => get_custom_option('post_related_count')), getPostData(array('thumb_size' => getThumbColumns('cub', $columns), 'strip_teaser' => false, 'sidebar' => !in_array(get_custom_option('show_sidebar_main'), array('none', 'fullwidth')), 'categories_list' => true), $recent));
        }
        ?>
			</div>
		</section>
		<?php 
    }
}
コード例 #3
0
	<article class="isotopeItem <?php 
echo 'post_format_' . $post_data['post_format'] . ($opt['number'] % 2 == 0 ? ' even' : ' odd') . ($opt['number'] == 0 ? ' first' : '') . ($opt['number'] == $opt['posts_on_page'] ? ' last' : '') . ($opt['add_view_more'] ? ' viewmore' : '') . (get_custom_option('show_filters') == 'yes' ? ' flt_' . join(' flt_', get_custom_option('filter_taxonomy') == 'categories' ? $post_data['post_categories_ids'] : $post_data['post_tags_ids']) : '');
?>
" data-postid="<?php 
echo esc_attr($post_data['post_id']);
?>
">
		<div class="isotopeItemWrap">
			<?php 
//thumb
if ($post_data['post_thumb']) {
    ?>
				<div class="thumb">
					<?php 
    $thumb_crop = array('portfolio_big' => '1', 'portfolio_medium' => '2', 'portfolio_mini' => '3');
    $thumb_sizes = getThumbSizes(array('thumb_size' => getThumbColumns('cub', $thumb_crop[$post_data['post_layout']]), 'thumb_crop' => true, 'sidebar' => false));
    $thumb_img = getResizedImageURL($post_data['post_attachment'], $thumb_sizes['w'], $thumb_sizes['h']);
    ?>
					<img src="<?php 
    echo esc_url($thumb_img);
    ?>
" alt="<?php 
    echo esc_attr($post_data['post_title']);
    ?>
">
				</div>
			<?php 
} else {
    if ($post_data['post_gallery']) {
        echo balanceTags($post_data['post_gallery']);
    } else {