public function opengraph() { $tags = []; if (is_singular()) { $tags['og:title'] = get_the_title(); } elseif (is_archive()) { $tags['og:title'] = get_the_archive_title(); } if (is_singular()) { $tags['og:description'] = get_the_excerpt(); } if (is_singular()) { $tags['og:url'] = get_permalink(); } elseif (is_tax()) { $tags['og:url'] = get_term_link(get_queried_object(), get_queried_object()->taxonomy); } if (is_singular() && has_post_thumbnail()) { $tags['og:image'] = get_the_post_thumbnail_url('full'); } $tags = wp_parse_args($tags, ['og:type' => 'website', 'og:title' => get_bloginfo('name'), 'og:description' => get_bloginfo('description'), 'og:url' => home_url('/'), 'og:image' => get_site_icon_url()]); $tags = array_filter($tags); $tags = apply_filters('opengraph_tags', $tags); foreach ($tags as $property => $content) { printf(' <meta property="%s" content="%s">', esc_attr($property), esc_attr($content)); } }
function wpb_latest_sticky() { /* Get all sticky posts */ $sticky = get_option('sticky_posts'); /* Sort the stickies with the newest ones at the top */ rsort($sticky); /* Get the 5 newest stickies (change 5 for a different number) */ $sticky = array_slice($sticky, 0, 1); /* Query sticky posts */ $the_query = new WP_Query(array('post__in' => $sticky, 'ignore_sticky_posts' => 1)); // The Loop $arr = array(); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); $arr['permlink'] = get_permalink("", "", false); $arr['title'] = get_the_title("", "", false); $arr['excerpt'] = get_the_excerpt("", "", false); $arr['img_url'] = get_the_post_thumbnail_url(); } } else { // no posts found $arr['excerpt'] = $arr['title'] = $arr['permlink'] = $arr["img_url"] = "404 not found any featured post ! :( "; } /* Restore original Post Data */ wp_reset_postdata(); return $arr; }
/** * @return string Inline CSS * @since 0.0.1-dev */ private function get_css() { if (has_post_thumbnail() && !post_password_required()) { $thumb = esc_url(get_the_post_thumbnail_url(null, 'push7ssb-sbz-thumbnail')); } elseif (has_site_icon()) { $thumb = esc_url(get_site_icon_url()); } else { $thumb = ''; } return <<<EOI .push7-sb-sbz-with-thumb { \tbackground-image: url({$thumb}); } .push7-sb-sbz-with-thumb-subscribe { \tbackground-color: rgba(43,43,43, 0.7); \tcolor: #ffffff; } @media only screen and (min-width : 415px) { \t.push7-sb-sbz-with-thumb-thumbnail { \t\tbackground-image: url({$thumb}); \t} \t.push7-sb-sbz-with-thumb-subscribe { \t\tbackground-color: rgba(43,43,43, 1); \t} } EOI; }
/** * wcj_get_product_image_url. * * @version 2.5.7 * @since 2.5.7 * @todo placeholder */ function wcj_get_product_image_url($product_id, $image_size = 'shop_thumbnail') { if (has_post_thumbnail($product_id)) { $image_url = get_the_post_thumbnail_url($product_id, $image_size); } elseif (($parent_id = wp_get_post_parent_id($product_id)) && has_post_thumbnail($parent_id)) { $image_url = get_the_post_thumbnail_url($parent_id, $image_size); } else { $image_url = ''; } return $image_url; }
function widget($args, $instance) { /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : __(' ', 'bookyourtravel')); extract($args); echo $before_widget; $url = get_post_meta($title, '_location', true); $img = get_the_post_thumbnail_url($title, 'large'); echo "<a target='_blank' href='" . $url . "'><img src='" . $img . "'></a>"; /* After widget (defined by themes). */ echo $after_widget; }
/** * Get thumbnail image url * * @param null|\WP_Post $_post Post data object. * * @return string */ public static function get_thumbnail($_post = null) { $thumb = apply_filters(VA_SOCIALBUZZ_PREFIX . 'default_thumbnail', 'none'); if (empty($_post)) { global $post; $_post = $post; } if (!empty($_post) && has_post_thumbnail($_post) && !post_password_required($_post)) { $thumb = get_the_post_thumbnail_url($_post, VA_SOCIALBUZZ_PREFIX . 'thumbnail'); } elseif ('none' === $thumb && has_header_image()) { $thumb = get_header_image(); } elseif ('none' === $thumb && has_site_icon()) { $thumb = get_site_icon_url(); } return $thumb; }
function __construct($wp_post) { $this->id = (int) $wp_post->ID; $this->type = $wp_post->post_type; $this->slug = $wp_post->post_name; $this->url = get_permalink($this->id); $this->status = $wp_post->post_status; $this->title = get_the_title($this->id); $this->title_plain = strip_tags(@$this->title); $this->excerpt = apply_filters('the_excerpt', get_the_excerpt($wp_post->ID)); $this->date = get_the_time($wp_post->ID); $this->modified = $wp_post->post_modified; $this->categories = get_the_category($this->id); $tags = get_the_tags($this->id); $this->tags = $tags ? $tags : array(); $this->author = get_the_author($wp_post->ID); $this->comment_count = (int) $wp_post->comment_count; $this->comment_status = $wp_post->comment_status; $this->thumbnail = get_the_post_thumbnail_url($wp_post->ID); $this->custom_fields = get_post_custom($this->id); }
/** * @internal * @param false|object $coauthor co-author object */ protected function init($coauthor = false) { $this->id = $coauthor->ID; $this->first_name = $coauthor->first_name; $this->last_name = $coauthor->last_name; $this->user_nicename = $coauthor->user_nicename; $this->description = $coauthor->description; /** * @property string name */ $this->display_name = $coauthor->display_name; $this->_link = get_author_posts_url(null, $coauthor->user_nicename); // 96 is the default wordpress avatar size $avatar_url = get_the_post_thumbnail_url($this->id, 96); if (CoAuthorsPlus::$prefer_gravatar || !$avatar_url) { $avatar_url = get_avatar_url($coauthor->user_email); } if ($avatar_url) { $this->avatar = new \Timber\Image($avatar_url); } }
?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <div class="entry-wrapper"> <?php if (!is_single() && has_post_thumbnail()) { ?> <div class="entry-image"> <?php $post_image_thumbnail_url = get_the_post_thumbnail_url(get_the_ID(), 'full'); $post_image_thumbnail = aq_resize($post_image_thumbnail_url, 310, '', false, false); ?> <a class="post-feature-image" href="<?php the_permalink(); ?> "> <img class="img-responsive" src="<?php echo $post_image_thumbnail[0]; ?> " width="<?php echo $post_image_thumbnail[1]; ?> " height="<?php
/** * Display the post thumbnail URL. * * @since 4.4.0 * * @param string|array $size Optional. Image size to use. Accepts any valid image size, * or an array of width and height values in pixels (in that order). * Default 'post-thumbnail'. */ function the_post_thumbnail_url($size = 'post-thumbnail') { $url = get_the_post_thumbnail_url(null, $size); if ($url) { echo esc_url($url); } }
</section> <?php $features = $fields['features']; if ($features[0] != 0) { /* if there are features */ ?> <section id="home-features" class="row full-width"> <?php $f = 1; foreach ($features as $featureObj) { $feature = $featureObj['feature']; $id = $feature->ID; $featureFields = get_fields($id); $imageSrc = get_the_post_thumbnail_url($id, 'home-feature'); $title = $feature->post_title; $subtitle = $featureFields['subtitle']; $excerpt = $feature->post_excerpt; $link = get_the_permalink($id); ?> <div class="feature <?php if ($f % 2 == 0) { echo 'reverse'; } ?> animate-in"> <div class="image animate-element <?php if ($f % 2 == 0) {
</div> <div class="content-body"> <?php if (have_posts()): while (have_posts()) : the_post(); ?> <div class="body-container"> <h1><?php the_title(); ?></h1> <?php the_content(); // Dynamic Content ?> <div class="pagination"> <?php $nextPost = get_next_post(true);?> <div class="previous" style="background-image:url('<?php echo get_the_post_thumbnail_url($nextPost->ID); ?>');"> <?php next_post_link('%link', '<span>Previous Story</span><p>%title</p>'); ?> </div> <div class="home"><h3><a href="/news/">Back to news home</a></h3></div> <?php $prevPost = get_previous_post(true);?> <div class="next" style="background-image:url('<?php echo get_the_post_thumbnail_url($prevPost->ID); ?>');"><?php previous_post_link('%link', '<span>Next Story</span><p>%title</p>'); ?> </div> </div> </div> <?php endwhile; ?> <?php endif; ?> </div>
/** * Display navigation to next/previous post when applicable. * * Improve the post_nav() with post thumbnails. Help from this * @link: http://www.measureddesigns.com/adding-previous-next-post-wordpress-post/ * @link: http://wpsites.net/web-design/add-featured-images-to-previous-next-post-nav-links/ */ function jkl_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); $prevID = $previous ? $previous->ID : ''; $nextID = $next ? $next->ID : ''; if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation clear" role="navigation"> <h2 class="screen-reader-text"><?php _e('Post navigation', 'jkl'); ?> </h2> <div class="nav-links"> <?php // My custom code below FIRST, then _s code // PREVIOUS POST LINK if (!empty($previous)) { ?> <div class="nav-previous"> <a href="<?php echo get_permalink($prevID); ?> " rel="prev"> <?php if (has_post_thumbnail($prevID) && has_post_thumbnail($nextID)) { $prev_thumb = get_the_post_thumbnail_url($prevID, 'medium'); $prev_thumb = $prev_thumb ? $prev_thumb : get_header_image(); ?> <div class="post-nav-thumb" style="background-image: url( <?php echo $prev_thumb; ?> )"> <!-- Placeholder for image --> </div> <?php } ?> <span class="meta-nav" aria-hidden="true"><?php _e('Previously', 'jkl'); ?> </span> <span class="screen-reader-text"><?php _e('Previous Post', 'jkl'); ?> </span> <span class="post-title"><?php echo $previous->post_title; ?> </span> </a> </div> <?php } // NEXT POST LINK if (!empty($next)) { ?> <div class="nav-next"> <a href="<?php echo get_permalink($nextID); ?> " rel="next"> <?php if (has_post_thumbnail($prevID) && has_post_thumbnail($nextID)) { $next_thumb = get_the_post_thumbnail_url($nextID, 'medium'); $next_thumb = $next_thumb ? $next_thumb : get_header_image(); ?> <div class="post-nav-thumb"style="background-image: url( <?php echo $next_thumb; ?> )"> <!-- Placeholder for image --> </div> <?php } ?> <span class="meta-nav" aria-hidden="true"><?php _e('Next time', 'jkl'); ?> </span> <span class="screen-reader-text"><?php _e('Next Post', 'jkl'); ?> </span> <span class="post-title"><?php echo $next->post_title; ?> </span> </a> </div> <?php } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
// endwhile; ?> </ul>--> <ul class="testimonial-quotes"> <?php while ($query->have_posts()) { $query->the_post(); if ('' != get_the_post_thumbnail()) { ?> <li class="quote quote-<?php echo get_the_ID(); ?> " data-thumb="<?php echo get_the_post_thumbnail_url($post, 'medium'); ?> "> <?php get_template_part('components/features/frontpage/front', 'testimonials'); ?> </li> <?php } } ?> </ul> </div> </section><!-- #testimonials --> <?php
<?php if (have_posts()) { while (have_posts()) { the_post(); ?> <!--BEGIN .hentry--> <?php echo '<div class="services">'; echo '<div class="service"> <h1 class="service-title">' . get_the_title() . '</h1> <hr/> <div class="service-content"> <img class="service-img" src="' . get_the_post_thumbnail_url() . '"> <p class="service-desc">' . get_the_content() . '</p> </div> </div>'; echo '</div>'; ?> <?php } } ?> <!--END #primary .hfeed--> </div> <?php get_footer();
function get_product_header($postID) { ?> <div class="images"> <?php $product_gallery_images = get_field('product_gallery_image', $postID); $slider_width = 570; $slider_height = 420; if (has_post_thumbnail() && count($product_gallery_images)) { ?> <div id="product-slider"> <ul class="slides"> <?php if (has_post_thumbnail()) { $product_image_url = get_the_post_thumbnail_url($postID, 'full'); $product_image = aq_resize($product_image_url, $slider_width, $slider_height, true, false); if (!$product_image) { $product_image = db_aq_resize($product_image_url); } ?> <li style="width: <?php echo $slider_width; ?> px; height: <?php echo $slider_height; ?> px"> <img data-src="<?php echo $product_image[0]; ?> " width="<?php echo $product_image[1]; ?> " height="<?php echo $product_image[2]; ?> "/> </li> <?php } foreach ($product_gallery_images as $image) { $image_resize = aq_resize($image['url'], $slider_width, $slider_height, true, false, true); ?> <li style="width: <?php echo $slider_width; ?> px; height: <?php echo $slider_height; ?> px"> <img data-src="<?php echo $image_resize[0]; ?> " width="<?php echo $image_resize[1]; ?> " height="<?php echo $image_resize[2]; ?> " alt="<?php echo $image['alt']; ?> "/> </li> <?php } ?> </ul> <div id="product-thumbnails"> <?php $i = 0; ?> <?php if (has_post_thumbnail()) { $product_image_url = get_the_post_thumbnail_url($postID, 'full'); $product_image = aq_resize($product_image_url, 170, 130, true, false, true); ?> <a data-slide-index="<?php echo $i; ?> " href="#"><img data-src="<?php echo $product_image[0]; ?> " width="<?php echo $product_image[1]; ?> " height="<?php echo $product_image[2]; ?> "/></a> <?php $i++; } ?> <?php foreach ($product_gallery_images as $image) { $image_resize = aq_resize($image['url'], 170, 130, true, false, true); ?> <a data-slide-index="<?php echo $i; ?> " href="#"><img data-src="<?php echo $image_resize[0]; ?> " width="<?php echo $image_resize[1]; ?> " height="<?php echo $image_resize[2]; ?> "/></a> <?php $i++; ?> <?php } ?> </div> </div> <?php } else { if (has_post_thumbnail()) { ?> <div id="product-slider"> <?php $product_image_url = get_the_post_thumbnail_url($postID, 'full'); $product_image = aq_resize($product_image_url, 570, 420, true, false); if (!$product_image) { $product_image = db_aq_resize($product_image_url); } ?> <img data-src="<?php echo $product_image[0]; ?> " width="<?php echo $product_image[1]; ?> " height="<?php echo $product_image[2]; ?> "/> </div> <?php } } ?> </div> <div class="summary entry-summary"> <?php $db_product_sku = get_field('db_product_sku', $postID); $db_product_brand = get_field('db_product_brand', $postID); $db_product_warranty = get_field('db_product_warranty', $postID); $db_product_price = get_field('db_product_price', $postID); ?> <h1 itemprop="name" class="product_title entry-title"><?php the_title(); ?> </h1> <div class="description" itemprop="description"> <?php the_content(); ?> </div> <?php if ($db_product_sku) { ?> <div class="product-sku"><strong>Mã sản phẩm:</strong> <?php echo $db_product_sku; ?> </div> <?php } ?> <div class="info"> <?php if ($db_product_brand) { ?> <p class="product-brand"><strong>Hãng sản xuất:</strong> <?php echo $db_product_brand; ?> </p> <?php } ?> <?php if ($db_product_warranty) { ?> <p class="product-arranty"><strong>Bảo hành:</strong> <?php echo $db_product_warranty; ?> </p> <?php } ?> <?php if ($db_product_price) { ?> <p class="product-price"><strong>Giá bán:</strong> <?php echo $db_product_price; ?> </p> <?php } ?> </div> </div> <?php }
} if (!isset($meta_url)) { $meta_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } if (!isset($description_content)) { $description_content = get_bloginfo('description'); } if (!isset($keywords)) { $keywords = "bem infinito, ação social, doação"; } if (is_page()) { $t = get_the_title(); if (strtolower($t) != "bem infinito") { $t = preg_replace("/&#?[a-z0-9]+;/i", "", $t . ' | ' . $meta_title); } $i = has_post_thumbnail() ? get_the_post_thumbnail_url() : $meta_image; $d = preg_replace("/&#?[a-z0-9]+;/i", "", get_field('descricao')); $k = preg_replace("/&#?[a-z0-9]+;/i", "", get_field('keywords')); if ($t != "") { $meta_title = $t; } if ($i != "") { $meta_image = $i; } if ($d != "") { $description_content = $d; } if ($k != "") { $keywords = $k; } } else {
function siteorigin_panels_ajax_get_prebuilt_layouts() { if (empty($_REQUEST['_panelsnonce']) || !wp_verify_nonce($_REQUEST['_panelsnonce'], 'panels_action')) { wp_die(); } // Get any layouts that the current user could edit. header('content-type: application/json'); $type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : 'directory'; $search = !empty($_REQUEST['search']) ? trim(strtolower($_REQUEST['search'])) : ''; $page = !empty($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $return = array('title' => '', 'items' => array()); if ($type == 'prebuilt') { $return['title'] = __('Theme Defined Layouts', 'siteorigin-panels'); // This is for theme bundled prebuilt directories $layouts = apply_filters('siteorigin_panels_prebuilt_layouts', array()); foreach ($layouts as $id => $vals) { if (!empty($search) && strpos(strtolower($vals['name']), $search) === false) { continue; } $return['items'][] = array('title' => $vals['name'], 'id' => $id, 'type' => 'prebuilt', 'description' => isset($vals['description']) ? $vals['description'] : '', 'screenshot' => !empty($vals['screenshot']) ? $vals['screenshot'] : ''); } $return['max_num_pages'] = 1; } elseif ($type == 'directory') { $return['title'] = __('Layouts Directory', 'siteorigin-panels'); // This is a query of the prebuilt layout directory $query = array(); if (!empty($search)) { $query['search'] = $search; } $query['page'] = $page; $url = add_query_arg($query, SITEORIGIN_PANELS_LAYOUT_URL . '/wp-admin/admin-ajax.php?action=query_layouts'); $response = wp_remote_get($url); if (is_array($response) && $response['response']['code'] == 200) { $results = json_decode($response['body'], true); if (!empty($results) && !empty($results['items'])) { foreach ($results['items'] as $item) { $item['id'] = $item['slug']; $item['screenshot'] = 'http://s.wordpress.com/mshots/v1/' . urlencode($item['preview']) . '?w=400'; $item['type'] = 'directory'; $return['items'][] = $item; } } $return['max_num_pages'] = $results['max_num_pages']; } } elseif (strpos($type, 'clone_') !== false) { // Check that the user can view the given page types $post_type = str_replace('clone_', '', $type); $return['title'] = sprintf(__('Clone %s', 'siteorigin-panels'), esc_html(ucfirst($post_type))); global $wpdb; $user_can_read_private = $post_type == 'post' && current_user_can('read_private_posts') || $post_type == 'page' && current_user_can('read_private_pages'); $include_private = $user_can_read_private ? "OR posts.post_status = 'private' " : ""; // Select only the posts with the given post type that also have panels_data $results = $wpdb->get_results("\n\t\t\tSELECT SQL_CALC_FOUND_ROWS DISTINCT ID, post_title, meta.meta_value\n\t\t\tFROM {$wpdb->posts} AS posts\n\t\t\tJOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id\n\t\t\tWHERE\n\t\t\t\tposts.post_type = '" . esc_sql($post_type) . "'\n\t\t\t\tAND meta.meta_key = 'panels_data'\n\t\t\t\t" . (!empty($search) ? 'AND posts.post_title LIKE "%' . esc_sql($search) . '%"' : '') . "\n\t\t\t\tAND ( posts.post_status = 'publish' OR posts.post_status = 'draft' " . $include_private . ")\n\t\t\tORDER BY post_date DESC\n\t\t\tLIMIT 16 OFFSET " . intval(($page - 1) * 16)); $total_posts = $wpdb->get_var("SELECT FOUND_ROWS();"); foreach ($results as $result) { $thumbnail = get_the_post_thumbnail_url($result->ID, array(400, 300)); $return['items'][] = array('id' => $result->ID, 'title' => $result->post_title, 'type' => $type, 'screenshot' => !empty($thumbnail) ? $thumbnail : ''); } $return['max_num_pages'] = ceil($total_posts / 16); } else { // An invalid type. Display an error message. } // Add the search part to the title if (!empty($search)) { $return['title'] .= __(' - Results For:', 'siteorigin-panels') . ' <em>' . esc_html($search) . '</em>'; } echo json_encode($return); wp_die(); }
<header class="post-related-head"> <h3 class="post-related-title">相关内容</h3> <small>您可能对以下内容也有兴趣</small> <div class="post-icon"> <i class="fa fa-file-text-o"></i> </div> </header> <div class="row"> <?php foreach (get_posts(array('category__in' => array_map(function ($cat) { return $cat->cat_ID; }, get_the_category()))) as $index => $post) { ?> <div class="col-md-4 col-sm-4"> <article class="post-related-post" style="background-image: url(<?php echo get_the_post_thumbnail_url($post->ID) ? get_the_post_thumbnail_url($post->ID) : get_stylesheet_directory_uri() . '/assets/images/uploads/image-02-normal-300x200.jpg'; ?> )"> <h4> <a href="<?php echo get_the_permalink($post->ID); ?> "><?php echo get_the_title($post->ID); ?> </a> <!-- <small>by Manos Proistakis</small> --> </h4> </article> </div> <?php
<?php /** * teaser Heads Gallery. * * @link https://codex.wordpress.org/Template_Hierarchy * * @package medium_magazin_beta */ $teaser_image = get_the_post_thumbnail_url($post, 'thumbnail'); $teaser_text = get_field('teaser-text'); ?> <div class="item"> <a href="<?php the_permalink(); ?> " class="voll-teaser-link"> <?php if ($teaser_image) { ?> <img class="img-circle teaser3-img" src="<?php echo $teaser_image; ?> " alt="Card image cap"> <?php } ?> <h6 class="heads-gallery-name"><?php the_title();
function mc_show_block($field, $has_data, $data, $echo = true, $default = '') { global $user_ID; $return = $checked = $value = ''; $show_block = mc_show_edit_block($field); $pre = '<div class="ui-sortable meta-box-sortables"><div class="postbox">'; $post = '</div></div>'; switch ($field) { case 'event_host': if ($show_block) { $users = mc_get_users(); $select = ''; foreach ($users as $u) { $display_name = $u->display_name == '' ? $u->user_nicename : $u->display_name; if (is_object($data) && $data->event_host == $u->ID) { $selected = ' selected="selected"'; } else { if (is_object($u) && $u->ID == $user_ID && empty($data->event_host)) { $selected = ' selected="selected"'; } else { $selected = ''; } } $select .= "<option value='{$u->ID}'{$selected}>{$display_name}</option>\n"; } $return = ' <p> <label for="e_host">' . __('Host', 'my-calendar') . '</label> <select id="e_host" name="event_host">' . $select . '</select> </p>'; } break; case 'event_author': if ($show_block && is_object($data) && $data->event_author === '0') { $users = mc_get_users(); $select = ''; foreach ($users as $u) { $display_name = $u->display_name == '' ? $u->user_nicename : $u->display_name; $select .= "<option value='{$u->ID}'>{$display_name}</option>\n"; } $return = ' <p> <label for="e_author">' . __('Author', 'my-calendar') . '</label> <select id="e_author" name="event_author"> <option value="0" selected="selected">Public Submitter</option>' . $select . '</select> </p>'; } else { $return = '<input type="hidden" name="event_author" value="' . $default . '" />'; } break; case 'event_desc': if ($show_block) { global $current_screen; // because wp_editor cannot return a value, event_desc fields cannot be filtered if its enabled. $value = $has_data ? stripslashes($data->event_desc) : ''; if ($current_screen->base == 'post') { $return = '<div class="event_description"> <label for="content" class="screen-reader-text">' . __('Event Description', 'my-calendar') . '</label> <textarea id="content" name="content" class="event_desc" rows="8" cols="80">' . stripslashes(esc_attr($value)) . '</textarea> </div>'; } else { echo ' <div class="event_description"> <label for="content" class="screen-reader-text">' . __('Event Description', 'my-calendar') . '</label>'; if (user_can_richedit()) { wp_editor($value, 'content', array('textarea_rows' => 10)); } else { echo '<textarea id="content" name="content" class="event_desc" rows="8" cols="80">' . stripslashes(esc_attr($value)) . '</textarea>'; } echo '</div>'; } } break; case 'event_short': if ($show_block) { $value = $has_data ? stripslashes(esc_attr($data->event_short)) : ''; $return = ' <p> <label for="e_short">' . __('Short Description', 'my-calendar') . '</label><br /><textarea id="e_short" name="event_short" rows="2" cols="80">' . $value . '</textarea> </p>'; } break; case 'event_image': if ($show_block) { if ($has_data && property_exists($data, 'event_post')) { $image = has_post_thumbnail($data->event_post) ? get_the_post_thumbnail_url($data->event_post) : $data->event_image; $image_id = has_post_thumbnail($data->event_post) ? get_post_thumbnail_id($data->event_post) : ''; } else { $image = ''; $image_id = ''; } $return = ' <div class="mc-image-upload field-holder"> <input type="hidden" name="event_image_id" value="' . esc_attr($image_id) . '" class="textfield" id="e_image_id" /> <label for="e_image">' . __("Add an image:", 'my-calendar') . '</label><br /><input type="text" name="event_image" id="e_image" size="60" value="' . esc_attr($image) . '" placeholder="http://yourdomain.com/image.jpg" /> <button type="button" class="button textfield-field">' . __("Upload", 'my-calendar') . '</button>'; if ($image != '') { $image = has_post_thumbnail($data->event_post) ? get_the_post_thumbnail_url($data->event_post) : $data->event_image; $return .= '<div class="event_image"><img src="' . esc_attr($image) . '" alt="" /></div>'; } else { $return .= '<div class="event_image"></div>'; } $return .= '</div>'; } else { $return = '<input type="hidden" name="event_image" value="' . esc_attr($image) . '" />'; } break; case 'event_category': if ($show_block) { $return = '<p> <label for="e_category">' . __('Category', 'my-calendar') . '</label> <select id="e_category" name="event_category">' . mc_category_select($data) . ' </select> </p>'; } else { $return = '<div><input type="hidden" name="event_category" value="' . mc_category_select($data, false) . '" /></div>'; } break; case 'event_link': if ($show_block) { $value = $has_data ? esc_url($data->event_link) : ''; if ($has_data && $data->event_link_expires == '1') { $checked = " checked=\"checked\""; } else { if ($has_data && $data->event_link_expires == '0') { $checked = ""; } else { if (get_option('mc_event_link_expires') == 'true') { $checked = " checked=\"checked\""; } } } $return = ' <p> <label for="e_link">' . __('URL', 'my-calendar') . '</label> <input type="text" id="e_link" name="event_link" size="40" value="' . $value . '" /> <input type="checkbox" value="1" id="e_link_expires" name="event_link_expires"' . $checked . ' /> <label for="e_link_expires">' . __('Link will expire after event', 'my-calendar') . '</label> </p>'; } break; case 'event_recurs': if (is_object($data)) { $event_recur = is_object($data) ? $data->event_recur : ''; $recurs = str_split($event_recur, 1); $recur = $recurs[0]; $every = isset($recurs[1]) ? $recurs[1] : 1; if ($every == 1 && $recur == 'B') { $every = 2; } $prev = '<input type="hidden" name="prev_event_repeats" value="' . $data->event_repeats . '" /><input type="hidden" name="prev_event_recur" value="' . $data->event_recur . '" />'; } else { $recur = false; $every = 1; $prev = ''; } if (is_object($data) && $data->event_repeats != null) { $repeats = $data->event_repeats; } else { $repeats = 0; } if ($show_block && empty($_GET['date'])) { $return = $pre . ' <h2>' . __('Recurring', 'my-calendar') . '</h2> <div class="inside">' . $prev . ' <fieldset> <legend class="screen-reader-text">' . __('Recurring Events', 'my-calendar') . '</legend> <p> <label for="e_repeats">' . __('Repeats', 'my-calendar') . ' <input type="text" name="event_repeats" aria-labelledby="e_repeats_label" id="e_repeats" size="1" value="' . esc_attr($repeats) . '" /> <span id="e_repeats_label">' . __('times', 'my-calendar') . '</span>, </label> <label for="e_every">' . __('every', 'my-calendar') . '</label> <input type="number" name="event_every" id="e_every" size="1" min="1" max="99" maxlength="2" value="' . esc_attr($every) . '" /> <label for="e_recur" class="screen-reader-text">' . __('Units', 'my-calendar') . '</label> <select name="event_recur" id="e_recur"> ' . mc_recur_options($recur) . ' </select><br /> ' . __('Your entry is the number of events after the first occurrence of the event: a recurrence of <em>2</em> means the event will happen three times.', 'my-calendar') . ' <div class="mc_recur_notice" aria-live="polite"><p><span class="dashicons dashicons-no"></span>' . __('Month by day events currently only support monthly recurrances.', 'my-calendar') . '</p></div> </p> </fieldset> </div> ' . $post; } else { if ($every == '' && $repeats == '') { $every = 'S'; $repeats = '0'; } $return = ' <div>' . $prev . ' <input type="hidden" name="event_repeats" value="' . esc_attr($repeats) . '" /> <input type="hidden" name="event_every" value="' . esc_attr($every) . '" /> <input type="hidden" name="event_recur" value="' . esc_attr($recur) . '" /> </div>'; } break; case 'event_access': if ($show_block) { $label = __('Event Access', 'my-calendar'); $return = $pre . ' <h2>' . $label . '</h2> <div class="inside"> ' . mc_event_accessibility('', $data, $label) . apply_filters('mc_event_access_fields', '', $has_data, $data) . ' </div>' . $post; } break; case 'event_open': if ($show_block) { $return = $pre . ' <h2>' . __('Event Registration Settings', 'my-calendar') . '</h2> <div class="inside"> <fieldset> <legend class="screen-reader-text">' . __('Event Registration', 'my-calendar') . '</legend> ' . apply_filters('mc_event_registration', '', $has_data, $data, 'admin') . ' </fieldset> </div> ' . $post; } else { $open = $has_data ? esc_attr($data->event_open) : '2'; $tickets = $has_data ? esc_url($data->event_tickets) : ''; $registration = $has_data ? esc_attr($data->event_registration) : ''; $return = ' <div> <input type="hidden" name="event_open" value="' . $open . '" /> <input type="hidden" name="event_tickets" value="' . $tickets . '" /> <input type="hidden" name="event_registration" value="' . $registration . '" /> </div>'; } break; case 'event_location': if ($show_block) { $return = mc_locations_fields($has_data, $data, 'event'); } else { if ($has_data) { $return = "\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<input type='hidden' name='event_label' value='" . esc_attr(stripslashes($data->event_label)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_street' value='" . esc_attr(stripslashes($data->event_street)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_street2' value='" . esc_attr(stripslashes($data->event_street2)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_phone' value='" . esc_attr(stripslashes($data->event_phone)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_phone2' value='" . esc_attr(stripslashes($data->event_phone2)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_city' value='" . esc_attr(stripslashes($data->event_city)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_state' value='" . esc_attr(stripslashes($data->event_state)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_postcode' value='" . esc_attr(stripslashes($data->event_postcode)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_region' value='" . esc_attr(stripslashes($data->event_region)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_country' value='" . esc_attr(stripslashes($data->event_country)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_zoom' value='" . esc_attr(stripslashes($data->event_zoom)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_url' value='" . esc_attr(stripslashes($data->event_url)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_latitude' value='" . esc_attr(stripslashes($data->event_latitude)) . "' />\r\n\t\t\t\t\t<input type='hidden' name='event_longitude' value='" . esc_attr(stripslashes($data->event_longitude)) . "' />\r\n\t\t\t\t</div>"; } } break; default: return; } $return = apply_filters('mc_show_block', $return, $data, $field); if ($echo == true) { echo $return; } else { return $return; } }
<?php global $post; foreach (espresso_get_events(["limit" => 3]) as $post) { setup_postdata($post); ?> <a href="<?php the_permalink(); ?> " class="col-md-4 event-container"> <?php $image = ''; if (has_post_thumbnail()) { $image = get_the_post_thumbnail_url($post->ID, 'event_desktop'); } ?> <div class="event-content"> <div class="event-image" style="background-image:url(<?php echo $image; ?> );"></div> <div class="event-info clearfix"> <div class="pull-left text-center event-date"> <div class="event-month"> <?php
/** * @ticket 33070 */ function test_get_the_post_thumbnail_url_with_invalid_post() { set_post_thumbnail(self::$post, self::$attachment_id); $this->assertTrue(false !== get_the_post_thumbnail_url(self::$post->ID)); $deleted = wp_delete_post(self::$post->ID, true); $this->assertNotEmpty($deleted); $this->assertFalse(get_the_post_thumbnail_url(self::$post->ID)); }
/** * Content template. * * @todo 後で分割する * * @since 0.0.1 (Alpha) * @return string */ protected function _content_template() { if (!is_singular()) { return null; } $options = self::get_option(); if (has_post_thumbnail() && !post_password_required()) { $options['thumb'] = get_the_post_thumbnail_url(null, self::$prefix . '-thumbnail'); } elseif (has_site_icon()) { $options['thumb'] = get_site_icon_url(); } else { $options['thumb'] = ''; } $template[] = '<div id="va-social-buzz" class="va-social-buzz">'; if (!empty($options['fb_page'])) { $template[] = '<div class="vasb_fb">'; $template[] = sprintf('<div class="vasb_fb_thumbnail" style="background-image: url(%s);"></div>', $options['thumb']); $template[] = '<div class="vasb_fb_like">'; $template[] = sprintf('<p>%s<br>%s</p>', esc_html($options['text']['like'][0]), esc_html($options['text']['like'][1])); $template[] = sprintf('<div class="fb-like" data-href="https://www.facebook.com/%s" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>', esc_attr($options['fb_page'])); $template[] = '</div>'; $template[] = '<!-- //.vasb_fb --></div>'; } $template[] = '<div class="vasb_share">'; $template[] = '<div class="vasb_share_button vasb_share_button-fb">'; $template[] = sprintf('<a href="http://www.facebook.com/sharer.php?u=%s"><i class="vasb_icon"></i><span>%s</span></a>', get_the_permalink(), esc_html($options['text']['share'])); $template[] = '</div>'; $template[] = '<div class="vasb_share_button vasb_share_button-tw">'; $template[] = sprintf('<a href="http://twitter.com/share?url=%s&text=%s"><i class="vasb_icon"></i><span>%s</span></a>', get_the_permalink(), get_the_title(), esc_html($options['text']['tweet'])); $template[] = '</div>'; $template[] = '<!-- //.vasb_share --></div>'; if (!empty($options['tw_account'])) { $template[] = '<div class="vasb_tw">'; $template[] = sprintf('%1$s <a href="https://twitter.com/%2$s" class="twitter-follow-button" data-show-count="true" data-size="large" data-show-screen-name="false">Follow @%2$s</a>', esc_html($options['text']['follow']), esc_html($options['tw_account'])); $template[] = '<!-- //.vasb_tw --></div>'; } $template[] = '<!-- //.va-social-buzz --></div>'; return apply_filters('va_social_buzz_content', implode(PHP_EOL, $template), $options); }
<?php get_header(); ?> <div class="cbp-row cbp_widget_row ch-slider " > <ul class="sliders bxslider"> <?php $i = 0; $args = array('post_type' => 'slider', 'posts_per_page' => -1); $queryRows = get_posts($args); foreach ($queryRows as $row) { $i++; $url_image = get_the_post_thumbnail_url($row->ID, 'custom-size'); $url_link = get_permalink($row->ID); $name = $row->post_title; $postcontent = strip_tags($row->post_content); ?> <li style="background: url('<?php echo $url_image; ?> ') no-repeat center; -webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;"> <a href="<?php echo $url_link; ?> "></a> </li> <?php } ?> </ul>
<?php /** * teaser Standard. * * @link https://codex.wordpress.org/Template_Hierarchy * * @package medium_magazin_beta */ $teaser_image = get_the_post_thumbnail_url($post, 'medium'); $teaser_text = get_field('teaser-text'); ?> <a href="<?php the_permalink(); ?> " class="voll-teaser-link"> <div class="col-xs-12 col-sm-10 col-sm-offset-1 col-md-6 col-md-offset-0 col-lg-6"> <div class="card teaser teaser1-container"> <div class="card-block teaser1-content"> <div class="teaser1-body"> <?php if ($teaser_image) { ?> <div class="bg-image bg-image-teaser" style="background-image: url(<?php echo $teaser_image; ?> );" > </div> <?php }
get_header(); if (have_posts()) { while (have_posts()) { the_post(); ?> <?php $konkurs_deadline_hour = get_field('konkurs_deadline_hour'); if (has_post_thumbnail()) { $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); } else { $url = get_template_directory_uri() . '/img/head_konkursi.svg'; } $subtitle = get_field('subtitle'); $title = get_the_title(); $image = get_the_post_thumbnail_url(); $excerpt = get_the_excerpt(); $link = get_the_permalink(); $konkurs = $_GET['konkurs']; $konkurs_name = get_the_title($konkurs); ?> <div class="banner single-kontakt clearfix" style="background-image: url(<?php echo $url; ?> );"></div> <main role="main" class="main konkursi"> <!-- section --> <section class="konkursi-leading bottom"> <div class="grid-container"> <div class="row">
?> </header><!-- .entry-header --> <?php } ?> <?php jkl_index_posted_on(); ?> <div class="hentry-index entry-meta" <?php if (has_post_thumbnail()) { ?> style="background-image: url(<?php echo get_the_post_thumbnail_url($post, 'jkl_featured'); ?> )" <?php } // End header image check. ?> > <div class="quote-overlay"> <div class="entry-content index-content"> <?php if (is_single()) { jkl_get_the_quote(); } else { the_excerpt();
<div class="ano--previous"><?php next_post_link('%link', '<span class="dashicons dashicons-arrow-left-alt2"></span>'); ?> </div> <div class="ano--next"><?php previous_post_link('%link', '<span class="dashicons dashicons-arrow-right-alt2"></span>'); ?> </div> </div> <div class="work--hero"> <div class="hero--color-overlay" style="background: <?php echo $titlecolor; ?> "></div> <div class="hero--image" style="background: url('<?php echo get_the_post_thumbnail_url(); ?> ') center;"></div> <div class="hero--logo" style="background: <?php echo $logocolor; ?> "> <div class="logo"> <img src="<?php echo $logo; ?> " alt=""> </div> </div> </div> <div class="work--title">
/** * Get post featured image * * @since 1.0.0 * * @param array $args Array, containing size and format options. * * @return string */ public function post_featured_image(array $args = array()) { $size = $this->image_sizes['small']; $format = '<div style="background-image: url(\'%1$s\');"><img src="%2$s"></div>'; if (true === isset($args['size']) && false === empty($args['size'])) { $size = $args['size']; } if (true === isset($args['format']) && false === empty($args['format'])) { $format = $args['format']; } if (has_post_thumbnail()) { $image_url = get_the_post_thumbnail_url(null, $size); } else { $width = get_option("{$size}_size_w"); $height = get_option("{$size}_size_h"); $image_url = "http://fakeimg.pl/{$width}x{$height}"; } $image_url = esc_url($image_url); return sprintf($format, $image_url, $image_url); }