本文整理汇总了PHP中themify_get_image函数的典型用法代码示例。如果您正苦于以下问题:PHP themify_get_image函数的具体用法?PHP themify_get_image怎么用?PHP themify_get_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了themify_get_image函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
/**
* Default Values
* 'title' => 'Most Commented Posts',
'show_count' => 5,
'show_excerpt' => false,
'show_thumb' => false,
'thumb_width' => 50,
'thumb_height' => 50,
'excerpt_length' => 55,
'hide_title' => false
*/
extract($args);
extract($instance);
$loop = get_posts(array('numberposts' => $show_count, 'orderby' => 'comment_count', 'post_type' => 'post', 'order' => 'DESC'));
$html = '';
if ($loop) {
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
$html .= '<ul class="feature-posts-list">';
global $post;
foreach ($loop as $post) {
setup_postdata($post);
$post_excerpt = trim(strip_tags($post->post_excerpt));
$post_title = trim(strip_tags($post->post_title));
// cut to character limit
$cut_excerpt = substr($post_excerpt, 0, $excerpt_length);
if ($cut_excerpt != $post_excerpt) {
// cut to last space
$post_excerpt = substr($post_excerpt, 0, strrpos($post_excerpt, ' '));
}
$html .= '<li>';
if ($show_thumb) {
$html .= themify_get_image('ignore=true&w=' . $instance['thumb_width'] . '&h=' . $instance['thumb_height'] . '&before=<a href="' . get_permalink() . '">&after=</a>&class=post-img');
}
if (!$hide_title) {
$html .= '<a href="' . get_permalink() . '" class="feature-posts-title">' . get_the_title() . '</a>';
}
if ($show_comment_count) {
$comment_string = get_comments_number() > 1 ? __('comments', 'themify') : __('comment', 'themify');
$html .= '<br/><small>' . get_comments_number() . ' ' . $comment_string . '</small> <br />';
}
if ($show_excerpt) {
$the_excerpt = get_the_excerpt();
if ($excerpt_length != "") {
// cut to character limit
$the_excerpt = substr($the_excerpt, 0, $excerpt_length);
// cut to last space
$the_excerpt = substr($the_excerpt, 0, strrpos($the_excerpt, ' '));
}
$html .= '<span class="post-excerpt">' . $the_excerpt . '</span>';
}
$html .= '</li>';
wp_reset_postdata();
}
$html .= '</ul>';
echo $html;
echo $after_widget;
}
}
示例2: extract
* @author Themify
*/
extract($settings, EXTR_SKIP);
?>
<div class="gallery-showcase-image">
<img src="<?php
echo wp_get_attachment_url($gallery_images[0]->ID);
?>
" alt="" />
</div>
<div class="gallery-images">
<?php
$i = 0;
foreach ($gallery_images as $image) {
$link = wp_get_attachment_url($image->ID);
$link_before = '' != $link ? sprintf('<a title="%s" href="%s">', esc_attr($image->post_title), esc_url($link)) : '';
$link_after = '' != $link ? '</a>' : '';
if ($this->is_img_php_disabled()) {
$image = wp_get_attachment_image($image->ID, 'thumbnail');
} else {
$image = wp_get_attachment_image_src($image->ID, 'full');
$image = themify_get_image("ignore=true&src={$image[0]}&w={$thumb_w_gallery}&h={$thumb_h_gallery}");
}
echo $link_before . $image . $link_after;
}
// end loop
?>
</div>
示例3: themify_logo_image
/**
* Returns logo image.
* Available filters:
* 'themify_'.$location.'_logo_tag': filter the HTML tag used to wrap the text or image.
* 'themify_logo_home_url': filter the home URL linked.
* 'themify_'.$location.'_logo_html': filter the final HTML output to page.
* @param string $location Logo location used as key to get theme setting values
* @return string logo markup
*/
function themify_logo_image($location = 'site_logo', $cssid = 'site-logo')
{
if (themify_get('setting-' . $location) == 'image' && themify_check('setting-' . $location . '_image_value')) {
$logo_tag = apply_filters('themify_' . $location . '_logo_tag', 'div');
$type = 'image';
} else {
$logo_tag = apply_filters('themify_' . $location . '_logo_tag', 'h1');
$type = 'text';
}
$html = '<' . $logo_tag . ' id="' . $cssid . '">';
$html .= '<a class="hidden-xs" href="' . apply_filters('themify_logo_home_url', "#header") . '" title="' . get_bloginfo('name') . '">';
if ('image' == $type) {
$html .= themify_get_image("src=" . themify_get('setting-' . $location . '_image_value') . "&w=" . themify_get('setting-' . $location . '_width') . "&h=" . themify_get('setting-' . $location . '_height') . "&alt=" . urlencode(get_bloginfo('name')));
} else {
$html .= get_bloginfo('name');
}
$html .= '</a>';
$html .= '</' . $logo_tag . '>';
return apply_filters('themify_' . $location . '_logo_html', $html, $location, $logo_tag, $type);
}
示例4: get_the_ID
?>
</ul>
</div>
<?php
} else {
// Check if user wants to use a common dimension or those defined in each highlight
if ('yes' == $themify->use_original_dimensions) {
// Save post id
$post_id = get_the_ID();
// Set image width
$themify->width = get_post_meta($post_id, 'image_width', true);
// Set image height
$themify->height = get_post_meta($post_id, 'image_height', true);
}
//otherwise display the featured image
if ($post_image = themify_get_image('ignore=true&' . $themify->auto_featured_image . $themify->image_setting . "w=" . $themify->width . "&h=" . $themify->height)) {
?>
<figure class="post-image <?php
echo $themify->image_align;
?>
">
<?php
if ('yes' == $themify->unlink_image) {
?>
<?php
echo $post_image;
?>
<?php
} else {
?>
<a href="<?php
示例5: themify_logo_image
/**
* Returns logo image.
* Available filters:
* 'themify_'.$location.'_logo_tag': filter the HTML tag used to wrap the text or image.
* 'themify_logo_home_url': filter the home URL linked.
* 'themify_'.$location.'_logo_html': filter the final HTML output to page.
* @param string $location Logo location used as key to get theme setting values
* @param string $cssid ID attribute for the logo tag.
* @return string logo markup
*/
function themify_logo_image($location = 'site_logo', $cssid = 'site-logo')
{
global $themify_customizer;
$logo_tag = apply_filters('themify_' . $location . '_logo_tag', 'div');
$logo_mod = get_theme_mod($cssid . '_image');
$logo_is_image = themify_get('setting-' . $location) == 'image' && themify_check('setting-' . $location . '_image_value');
$html = '<' . $logo_tag . ' id="' . esc_attr($cssid) . '">';
if ($logo_is_image && empty($logo_mod)) {
$html .= '<a href="' . esc_url(apply_filters('themify_logo_home_url', home_url())) . '" title="' . esc_attr(get_bloginfo('name')) . '">';
$type = $logo_is_image ? 'image' : 'text';
$site_name = get_bloginfo('name');
if ('image' == $type) {
$html .= themify_get_image('ignore=true&src=' . themify_get('setting-' . $location . '_image_value') . '&w=' . themify_get('setting-' . $location . '_width') . '&h=' . themify_get('setting-' . $location . '_height') . '&alt=' . urlencode(get_bloginfo('name')));
$html .= isset($themify_customizer) ? '<span style="display: none;">' . esc_html($site_name) . '</span>' : '';
} else {
$html .= isset($themify_customizer) ? '<span>' . esc_html($site_name) . '</span>' : esc_html($site_name);
}
$html .= '</a>';
} else {
$type = 'customizer';
$html .= $themify_customizer->site_logo($cssid);
}
$html .= '</' . $logo_tag . '>';
return apply_filters('themify_' . $location . '_logo_html', $html, $location, $logo_tag, $type);
}
示例6: portfolio_image
/**
* Returns the image for the portfolio slider
* @param int $attachment_id Image attachment ID
* @param int $width Width of the returned image
* @param int $height Height of the returned image
* @param string $size Size of the returned image
* @return string
* @since 1.1.0
*/
function portfolio_image($attachment_id, $width, $height, $size = 'large')
{
$size = apply_filters('themify_portfolio_image_size', $size);
if (themify_check('setting-img_settings_use')) {
// Image Script is disabled, use WP image
$html = wp_get_attachment_image($attachment_id, $size);
} else {
// Image Script is enabled, use it to process image
$img = wp_get_attachment_image_src($attachment_id, $size);
$html = themify_get_image('ignore=true&src=' . $img[0] . '&w=' . $width . '&h=' . $height);
}
return apply_filters('themify_portfolio_image_html', $html, $attachment_id, $width, $height, $size);
}
示例7: isset
$image_h = $img_h_slider;
$image_title = isset($content['img_title_slider']) ? $content['img_title_slider'] : '';
$param_image_src = 'src=' . $image_url . '&w=' . $image_w . '&h=' . $image_h . '&alt=' . $image_title . '&ignore=true';
if ($this->is_img_php_disabled()) {
// get image preset
$preset = $image_size_slider != '' ? $image_size_slider : themify_get('setting-global_feature_size');
if (isset($_wp_additional_image_sizes[$preset]) && $image_size_slider != '') {
$image_w = intval($_wp_additional_image_sizes[$preset]['width']);
$image_h = intval($_wp_additional_image_sizes[$preset]['height']);
} else {
$image_w = $image_w != '' ? $image_w : get_option($preset . '_size_w');
$image_h = $image_h != '' ? $image_h : get_option($preset . '_size_h');
}
$image = '<img src="' . $image_url . '" alt="' . $image_title . '" width="' . $image_w . '" height="' . $image_h . '">';
} else {
$image = themify_get_image($param_image_src);
}
?>
<?php
if (!empty($content['img_link_slider'])) {
?>
<a href="<?php
echo $content['img_link_slider'];
?>
" alt="<?php
echo $content['img_title_slider'];
?>
">
<?php
echo $image;
?>
示例8: array
if (themify_check('setting-header_slider_display') && themify_get('setting-header_slider_display') == "images") {
$options = array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten');
foreach ($options as $option) {
$option = 'setting-header_slider_images_' . $option;
if (themify_check($option . '_image')) {
echo '<li>';
$title = function_exists('icl_t') ? icl_t('Themify', $option . '_title', themify_get($option . '_title')) : (themify_check($option . '_title') ? themify_get($option . '_title') : '');
$image = themify_get($option . '_image');
$alt = $title ? $title : $image;
if (themify_check($option . '_link')) {
$link = themify_get($option . '_link');
$title_attr = $title ? "title='{$title}'" : '';
echo "<div class='slide-feature-image'><a href='{$link}' {$title_attr}>" . themify_get_image("src={$image}&ignore=true&w={$img_width}&h={$img_height}&alt={$alt}&class=feature-img") . '</a></div>';
echo $title ? '<div class="slide-content-wrap"><h3 class="slide-post-title"><a href="' . $link . '" ' . $title_attr . ' >' . $title . '</a></h3></div>' : '';
} else {
echo '<div class="slide-feature-image">' . themify_get_image("src=" . $image . "&ignore=true&w={$img_width}&h={$img_height}&alt=" . $alt . "&class=feature-img") . '</div>';
echo $title ? '<div class="slide-content-wrap"><h3 class="slide-post-title">' . $title . '</h3></div>' : '';
}
echo '</li>';
}
}
} else {
query_posts($num_posts . $cat);
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<?php
$link = themify_get_featured_image_link();
示例9: themify_get
?>
</figure>
<?php
} else {
?>
<?php
if ('yes' == $themify->use_original_dimensions) {
$themify->width = themify_get('image_width');
$themify->height = themify_get('image_height');
}
?>
<?php
if ($post_image = themify_get_image('ignore=true&w=' . $themify->width . '&h=' . $themify->height)) {
?>
<figure class="post-image <?php
echo $themify->image_align;
?>
">
<?php
if ($themify->unlink_image != 'yes') {
?>
<a href="<?php
echo themify_get_featured_image_link();
?>
" class="themify-lightbox">
<?php
示例10: themify_image
/**
* Image Helper - Echoes themify_get_image
* @param string $options Format string.
*/
function themify_image($options)
{
echo themify_get_image($options);
}
示例11: themify_before_post_image
<?php
themify_before_post_image();
// Hook
?>
<?php
if (themify_get('video_url') != '') {
?>
<?php
global $wp_embed;
echo $wp_embed->run_shortcode('[embed]' . themify_get('video_url') . '[/embed]');
?>
<?php
} elseif ($post_image = themify_get_image($themify->auto_featured_image . $themify->image_setting . "w=" . $themify->width . "&h=" . $themify->height)) {
?>
<figure class="post-image <?php
echo $themify->image_align;
?>
">
<?php
if ('yes' == $themify->unlink_image) {
?>
<?php
echo $post_image;
?>
<?php
} else {
?>
示例12: _e
<div class="related-posts">
<h4 class="related-title"><?php
_e('Related Posts', 'themify');
?>
</h4>
<?php
while ($related->have_posts()) {
$related->the_post();
?>
<article class="post type-post clearfix">
<?php
if (!themify_check($key . '_hide_image') && has_post_thumbnail()) {
?>
<?php
if ($post_image = themify_get_image('setting=image_post_single&w=255&h=155&ignore=true')) {
?>
<figure class="post-image clearfix">
<a href="<?php
echo themify_get_featured_image_link();
?>
"><?php
echo $post_image;
themify_zoom_icon();
?>
</a>
</figure>
<?php
}
// if there's a featured image
?>
示例13: themify_shortcode_post_slider
/**
* Create a slider with posts retrieved through get_posts
* @param Object $atts
* @param String $content
* @return String
*/
function themify_shortcode_post_slider($atts, $content = null)
{
extract(shortcode_atts(array('visible' => '1', 'scroll' => '1', 'auto' => '0', 'wrap' => 'no', 'excerpt_length' => '20', 'speed' => 'normal', 'slider_nav' => 'yes', 'limit' => '5', 'category' => '', 'image' => 'yes', 'image_w' => '240px', 'image_h' => '180px', 'more_text' => 'More...', 'title' => 'yes', 'display' => 'none', 'post_meta' => 'no', 'post_date' => 'no', 'width' => '', 'height' => '', 'class' => '', 'unlink_title' => 'no', 'unlink_image' => 'no'), $atts));
if ($wrap == "yes") {
$wrapvar = "circular";
}
if ($wrap == "no") {
$wrapvar = "null";
}
$numsldr = rand(0, 10000);
global $wpdb, $post, $table_prefix;
if ($category == 0) {
$posts = get_posts(array('numberposts' => $limit));
} else {
$arraycat = array($category);
$listcat = $category;
$arraycat = explode(',', $listcat);
$posts = get_posts('category=' . $listcat . '&numberposts=' . $show);
}
if ($posts) {
$postsliderstr = '<!-- shortcode post_slider --> <div id="post-slider-' . $numsldr . '" style="width: ' . $width . '; height: ' . $height . ';" class="shortcode clearfix post-slider ' . $class . '">
<ul class="slides">';
foreach ($posts as $post) {
setup_postdata($post);
global $more;
$more = 0;
$post_class = "";
if (themify_get('external_link') != '') {
$thislink = themify_get('external_link');
} else {
$thislink = get_permalink();
}
foreach (get_post_class() as $postclass) {
$post_class .= " " . $postclass;
}
//get_post_class() as $postclass
$postsliderstr .= '<li><div class="slide-wrap ' . $post_class . '">';
if ($image == "yes") {
if ('no' == $unlink_image) {
$postsliderstr .= themify_get_image('ignore=true&w=' . $image_w . '&h=' . $image_h . '&alt=' . get_the_title() . '&before=<p class="post-image"><a href="' . $thislink . '">&after=</a></p>');
} else {
$postsliderstr .= themify_get_image('ignore=true&w=' . $image_w . '&h=' . $image_h . '&alt=' . get_the_title() . '&before=<p class="post-image">&after=</p>');
}
}
//$image == "yes"
if ($title == "yes") {
if ('no' == $unlink_title) {
$postsliderstr .= '<h3 class="post-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
} else {
$postsliderstr .= '<h3 class="post-title">' . get_the_title() . '</h3>';
}
}
//$title == "yes"
if ($post_date == "yes") {
$postsliderstr .= '<p class="post-date">' . get_the_date() . '</p>';
}
//$post_date == "yes"
if ($post_meta == "yes") {
$postsliderstr .= '<p class="post-meta">
<span class="post-author">' . get_the_author() . '</span>
<span class="post-category">' . get_the_category_list(', ') . '</span>';
$num_comments = get_comments_number();
if (comments_open()) {
ob_start();
comments_popup_link('0', '1', '%', 'comments-link', '');
$write_comments = ob_get_contents();
ob_clean();
} else {
$write_comments = __('');
}
$postsliderstr .= '<span class="post-comment">' . $write_comments . '</span>';
if (has_tag()) {
$postsliderstr .= '<span class="post-tag">' . get_the_tag_list('', ', ') . '</span>';
}
$postsliderstr .= '</p>';
}
//$post_meta == "yes"
if ($display == "content") {
$postsliderstr .= '<div class="post-content">' . themify_get_content($more_text) . '</div></div></li>
';
}
//$display == "content"
if ($display == "excerpt") {
$postsliderstr .= '<div class="post-content">' . themify_excerpt($excerpt_length) . '</div></div></li>
';
}
//$display == "excerpt"
}
$postsliderstr .= '</ul>';
if ($slider_nav == "yes") {
$nextbutton = "<div>»</div>";
$prevbutton = "<div>«</div>";
} else {
$nextbutton = "null";
//.........这里部分代码省略.........
示例14: themify_shortcode_post_slider
/**
* Create a slider with posts retrieved through get_posts
* @param Object $atts
* @param String $content
* @return String
*/
function themify_shortcode_post_slider($atts, $content = null)
{
wp_enqueue_script('themify-carousel-js');
extract(shortcode_atts(array('visible' => '1', 'scroll' => '1', 'auto' => '0', 'pause_hover' => 'no', 'wrap' => 'yes', 'excerpt_length' => '20', 'speed' => 'normal', 'slider_nav' => 'yes', 'pager' => 'yes', 'limit' => '5', 'offset' => '0', 'category' => '', 'image' => 'yes', 'image_w' => '240px', 'image_h' => '180px', 'more_text' => __('More...', 'themify'), 'title' => 'yes', 'display' => 'none', 'post_meta' => 'no', 'post_date' => 'no', 'width' => '', 'height' => '', 'class' => '', 'unlink_title' => 'no', 'unlink_image' => 'no', 'image_size' => 'medium', 'post_type' => 'post', 'taxonomy' => 'category', 'order' => 'DESC', 'orderby' => 'date', 'effect' => 'scroll'), $atts, 'themify_post_slider'));
$wrapvar = 'false';
if ('yes' == $wrap) {
$wrapvar = 'true';
}
if ('0' == $auto) {
$play = 'false';
} else {
$play = 'true';
}
switch ($speed) {
case 'fast':
$speed = '.5';
break;
case 'normal':
$speed = '1';
break;
case 'slow':
$speed = '4';
break;
}
$pause_hover = $pause_hover == 'yes' ? 'true' : 'false';
$numsldr = rand(0, 10000);
$postsliderstr = '';
global $post;
$query_args = array('numberposts' => $limit, 'offset' => $offset, 'post_type' => $post_type, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false, 'post__not_in' => array(get_the_ID()));
if ('' != $category) {
$tax_query_terms = explode(',', $category);
if (preg_match('#[a-z]#', $category)) {
$query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $tax_query_terms));
} else {
$exclude = array_filter($tax_query_terms, 'themify_is_negative_number');
$query_args['tax_query'] = array('relation' => 'AND', array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_filter($tax_query_terms, 'themify_is_positive_number')), array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_map('themify_make_absolute_number', $exclude), 'operator' => 'NOT IN'));
}
}
$posts = get_posts($query_args);
$class .= ' effect-' . $effect;
if ($posts) {
$postsliderstr = '<!-- shortcode post_slider --> <div id="post-slider-' . esc_attr($numsldr) . '" style="width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . ';" class="shortcode clearfix post-slider ' . $class . '">
<ul class="slides">';
foreach ($posts as $post) {
setup_postdata($post);
global $more;
$more = 0;
$post_class = '';
foreach (get_post_class() as $postclass) {
$post_class .= " " . $postclass;
}
//get_post_class() as $postclass
$postsliderstr .= '<li><div class="slide-wrap ' . esc_attr($post_class) . '">';
if ('yes' == $image) {
$video_url = themify_get('video_url');
if ('' != $video_url) {
$postsliderstr .= '<div class="post-video">';
global $wp_embed;
$postsliderstr .= $wp_embed->run_shortcode('[embed]' . $video_url . '[/embed]');
$postsliderstr .= '</div>';
} else {
if ('no' == $unlink_image) {
$postsliderstr .= themify_get_image(array('image_size=' => $image_size, 'ignore' => true, 'w' => $image_w, 'h' => $image_h, 'alt' => get_the_title(), 'before' => '<p class="post-image"><a href="' . themify_get_featured_image_link() . '">', 'after' => '</a></p>'));
} else {
$postsliderstr .= themify_get_image(array('image_size' => $image_size, 'ignore' => true, 'w' => $image_w, 'h' => $image_h, 'alt' => get_the_title(), 'before' => '<p class="post-image">', 'after' => '</p>'));
}
}
}
//'yes' == $image
if ('yes' == $title) {
if ('no' == $unlink_title) {
$postsliderstr .= '<h3 class="post-title"><a href="' . themify_get_featured_image_link() . '">' . get_the_title() . '</a></h3>';
} else {
$postsliderstr .= '<h3 class="post-title">' . get_the_title() . '</h3>';
}
}
//$title == "yes"
if ($post_date == "yes") {
$postsliderstr .= '<p class="post-date">' . get_the_date() . '</p>';
}
//$post_date == "yes"
if ('yes' == $post_meta) {
$postsliderstr .= '<p class="post-meta">
<span class="post-author">' . get_the_author() . '</span>
<span class="post-category">' . get_the_category_list(', ') . '</span>';
if (comments_open()) {
ob_start();
comments_popup_link('0', '1', '%', 'comments-link', '');
$write_comments = ob_get_contents();
ob_clean();
} else {
$write_comments = '';
}
$postsliderstr .= '<span class="post-comment">' . $write_comments . '</span>';
//.........这里部分代码省略.........
示例15: logo_image
/**
* Returns logo image
* @param string
* @return string
*/
function logo_image($location = 'site_logo')
{
$html = '<a href="' . home_url() . '" title="' . get_bloginfo('name') . '">';
$html .= themify_get_image("src=" . themify_get('setting-' . $location . '_image_value') . "&w=" . themify_get('setting-' . $location . '_width') . "&h=" . themify_get('setting-' . $location . '_height') . "&alt=" . urlencode(get_bloginfo('name')));
$html .= '</a>';
return apply_filters('themify_' . $location . '_image', $html);
}