本文整理汇总了PHP中get_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP get_permalink函数的具体用法?PHP get_permalink怎么用?PHP get_permalink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_permalink函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? __('Recent Posts', 'lan-thinkupthemes') : apply_filters('widget_title', $instance['title']);
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
$posts = new WP_Query('orderby=date&posts_per_page=' . $instance['postcount'] . '');
while ($posts->have_posts()) {
$posts->the_post();
// Insert post date if needed.
if ($instance['postdate'] == 'on') {
$date_input = '<a href="' . get_permalink() . '" class="date">' . get_the_date('M j, Y') . '</a>';
}
// HTML output
echo '<div class="recent-posts">';
if (has_post_thumbnail() and $instance['imageswitch'] == 'on') {
echo '<div class="image">', '<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail($post->ID, array(65, 65)) . '<div class="image-overlay"></div></a>', '</div>', '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>';
} else {
echo '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>';
}
echo '</div>';
}
wp_reset_query();
echo $after_widget;
}
开发者ID:closings,项目名称:closings,代码行数:28,代码来源:recentposts.php
示例2: wpcf7_special_mail_tag_for_post_data
function wpcf7_special_mail_tag_for_post_data($output, $name)
{
if (!isset($_POST['_wpcf7_unit_tag']) || empty($_POST['_wpcf7_unit_tag'])) {
return $output;
}
if (!preg_match('/^wpcf7-f(\\d+)-p(\\d+)-o(\\d+)$/', $_POST['_wpcf7_unit_tag'], $matches)) {
return $output;
}
$post_id = (int) $matches[2];
if (!($post = get_post($post_id))) {
return $output;
}
$user = new WP_User($post->post_author);
// For backwards compat.
$name = preg_replace('/^wpcf7\\./', '_', $name);
if ('_post_id' == $name) {
$output = (string) $post->ID;
} elseif ('_post_name' == $name) {
$output = $post->post_name;
} elseif ('_post_title' == $name) {
$output = $post->post_title;
} elseif ('_post_url' == $name) {
$output = get_permalink($post->ID);
} elseif ('_post_author' == $name) {
$output = $user->display_name;
} elseif ('_post_author_email' == $name) {
$output = $user->user_email;
}
return $output;
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:30,代码来源:special-mail-tags.php
示例3: square_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function square_posted_on()
{
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
$byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
$comment_count = get_comments_number();
// get_comments_number returns only a numeric value
if (comments_open()) {
if ($comment_count == 0) {
$comments = __('No Comments', 'square');
} elseif ($comment_count > 1) {
$comments = $comment_count . __(' Comments', 'square');
} else {
$comments = __('1 Comment', 'square');
}
$comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
} else {
$comment_link = __(' Comment Closed', 'square');
}
echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
// WPCS: XSS OK.
}
开发者ID:jgcopple,项目名称:drgaryschwantz,代码行数:29,代码来源:template-tags.php
示例4: submenu_items
/**
* Add Menu Cart to menu
*
* @return menu items including cart
*/
public function submenu_items()
{
$get_cart = jigoshop_cart::get_cart();
$submenu_items = '';
//see jigoshop/widgets/cart.php
if (count($get_cart) > 0) {
foreach ($get_cart as $cart_item_key => $values) {
$_product = $values['data'];
if ($_product->exists() && $values['quantity'] > 0) {
$item_thumbnail = has_post_thumbnail($_product->id) ? get_the_post_thumbnail($_product->id, 'shop_tiny') : jigoshop_get_image_placeholder('shop_tiny');
$item_name = $_product->get_title();
// Not used: Displays variations and cart item meta
$item_meta = jigoshop_cart::get_item_data($values);
$item_quantity = esc_attr($values['quantity']);
$item_price = $_product->get_price_html();
// Item permalink
$item_permalink = esc_attr(get_permalink($_product->id));
$submenu_items[] = array('item_thumbnail' => $item_thumbnail, 'item_name' => $item_name, 'item_quantity' => $item_quantity, 'item_price' => $item_price, 'item_permalink' => $item_permalink);
}
}
} else {
$submenu_items = '';
}
return $submenu_items;
}
开发者ID:Atlas-Solutions-Group,项目名称:wp-menu-cart-pro,代码行数:30,代码来源:wpmenucart-jigoshop-pro.php
示例5: hybrid_excerpt_more
/**
* Filters the excerpt more output with internationalized text and a link to the post.
*
* @since 2.0.0
* @access public
* @param string $text
* @return string
*/
function hybrid_excerpt_more($text)
{
if (0 !== strpos($text, '<a')) {
$text = sprintf(' <a href="%s" class="more-link">%s</a>', esc_url(get_permalink()), trim($text));
}
return $text;
}
开发者ID:KL-Kim,项目名称:my-theme,代码行数:15,代码来源:functions-filters.php
示例6: wc_template_redirect
/**
* Handle redirects before content is output - hooked into template_redirect so is_page works.
*
* @return void
*/
function wc_template_redirect()
{
global $wp_query, $wp;
// When default permalinks are enabled, redirect shop page to post type archive url
if (!empty($_GET['page_id']) && get_option('permalink_structure') == "" && $_GET['page_id'] == wc_get_page_id('shop')) {
wp_safe_redirect(get_post_type_archive_link('product'));
exit;
} elseif (is_page(wc_get_page_id('checkout')) && sizeof(WC()->cart->get_cart()) == 0 && empty($wp->query_vars['order-pay']) && !isset($wp->query_vars['order-received'])) {
wp_redirect(get_permalink(wc_get_page_id('cart')));
exit;
} elseif (isset($wp->query_vars['customer-logout'])) {
wp_redirect(str_replace('&', '&', wp_logout_url(get_permalink(wc_get_page_id('myaccount')))));
exit;
} elseif (is_search() && is_post_type_archive('product') && apply_filters('woocommerce_redirect_single_search_result', true) && $wp_query->found_posts == 1) {
$product = wc_get_product($wp_query->post);
if ($product->is_visible()) {
wp_safe_redirect(get_permalink($product->id), 302);
exit;
}
} elseif (is_add_payment_method_page()) {
WC()->payment_gateways();
} elseif (is_checkout()) {
// Buffer the checkout page
ob_start();
// Ensure gateways and shipping methods are loaded early
WC()->payment_gateways();
WC()->shipping();
}
}
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:34,代码来源:wc-template-functions.php
示例7: filter_woocommerce_ajax_params
function filter_woocommerce_ajax_params($woocommerce_params)
{
global $sitepress, $post;
$value = array();
$value = $woocommerce_params;
if ($sitepress->get_current_language() !== $sitepress->get_default_language()) {
$value['ajax_url'] = add_query_arg('lang', ICL_LANGUAGE_CODE, $woocommerce_params['ajax_url']);
$value['checkout_url'] = add_query_arg('action', 'woocommerce-checkout', $value['ajax_url']);
}
if (!isset($post->ID)) {
return $value;
}
$ch_pages = wp_cache_get('ch_pages', 'wcml_ch_pages');
if (empty($ch_pages)) {
$ch_pages = array('checkout_page_id' => get_option('woocommerce_checkout_page_id'), 'pay_page_id' => get_option('woocommerce_pay_page_id'), 'cart_page_id' => get_option('woocommerce_cart_page_id'));
$ch_pages['translated_checkout_page_id'] = apply_filters('translate_object_id', $ch_pages['checkout_page_id'], 'page', false);
$ch_pages['translated_pay_page_id'] = apply_filters('translate_object_id', $ch_pages['pay_page_id'], 'page', false);
$ch_pages['translated_cart_page_id'] = apply_filters('translate_object_id', $ch_pages['cart_page_id'], 'page', false);
}
wp_cache_set('ch_pages', $ch_pages, 'wcml_ch_pages');
if ($ch_pages['translated_cart_page_id'] == $post->ID) {
$value['is_cart'] = 1;
$value['cart_url'] = get_permalink($ch_pages['translated_cart_page_id']);
} else {
if ($ch_pages['translated_checkout_page_id'] == $post->ID || $ch_pages['checkout_page_id'] == $post->ID) {
$value['is_checkout'] = 1;
$_SESSION['wpml_globalcart_language'] = $sitepress->get_current_language();
} else {
if ($ch_pages['translated_pay_page_id'] == $post->ID) {
$value['is_pay_page'] = 1;
}
}
}
return $value;
}
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:35,代码来源:ajax-setup.class.php
示例8: custom_rss_teaser
function custom_rss_teaser($content)
{
$teaser = preg_split('/<span id="(more-\\d+)"><\\/span>/', $content);
$readmore = '<a href="' . get_permalink() . '">[前往围观...]</a>';
$content = $teaser[0] . $readmore;
return $content;
}
开发者ID:BeyondIM,项目名称:wordpress-hack-bundle,代码行数:7,代码来源:wordpress-hack-bundle.php
示例9: testGetCertificateUrl
/**
* Test the "get_certificate_url" method.
*/
public function testGetCertificateUrl()
{
$entry = Edr_Crt_Test::get_instance()->addEntry(array('user_id' => 1, 'course_id' => 1, 'entry_status' => 'complete'));
$edr_crt = Edr_Manager::get('edr_crt');
$certificate_id = $edr_crt->create_certificate($entry);
$this->assertEquals(get_permalink($certificate_id), $edr_crt->get_certificate_url($entry->ID));
}
开发者ID:educatorplugin,项目名称:educator-certificates,代码行数:10,代码来源:test-edr-crt.php
示例10: woo_shortcode_view_full_article
function woo_shortcode_view_full_article($atts)
{
$defaults = array('label' => __('Read full story', 'woothemes'), 'before' => '', 'after' => '');
$atts = shortcode_atts($defaults, $atts);
$output = sprintf('<span class="read-more">%1$s<a href="%3$s" title="%4$s">%4$s</a>%2$s</span> ', $atts['before'], $atts['after'], get_permalink(get_the_ID()), $atts['label']);
return apply_filters('woo_shortcode_view_full_article', $output, $atts);
}
开发者ID:hram908,项目名称:albertos-project,代码行数:7,代码来源:theme-shortcodes.php
示例11: get_event_avatar
/**
* Get HTML markup for the post's "avatar" image according conditional
* fallback model.
*
* Accepts an ordered array of named avatar $fallbacks. Also accepts a string
* of space-separated classes to add to the default classes.
* @param Ai1ec_Event $event The event to get the avatar for
* @param array|null $fallback_order Order of fallback in searching for
* images, or null to use default
* @param string $classes A space-separated list of CSS classes
* to apply to the outer <div> element.
* @param boolean $wrap_permalink Whether to wrap the element in a link
* to the event details page.
*
* @return string String of HTML if image is found
*/
public function get_event_avatar(Ai1ec_Event $event, $fallback_order = null, $classes = '', $wrap_permalink = true)
{
$source = $size = null;
$url = $this->get_event_avatar_url($event, $fallback_order, $source, $size);
if (empty($url)) {
return '';
}
$url = esc_attr($url);
$classes = esc_attr($classes);
// Set the alt tag (helpful for SEO).
$alt = $event->get('post')->post_title;
$location = $this->_registry->get('view.event.location')->get_short_location($event);
if (!empty($location)) {
$alt .= ' @ ' . $location;
}
$alt = esc_attr($alt);
$size_attr = $size[0] ? "width=\"{$size['0']}\" height=\"{$size['1']}\"" : "";
$html = '<img src="' . $url . '" alt="' . $alt . '" ' . $size_attr . ' />';
if ($wrap_permalink) {
$permalink = add_query_arg('instance_id', $event->get('instance_id'), get_permalink($event->get('post_id')));
$html = '<a href="' . $permalink . '">' . $html . '</a>';
}
$classes .= ' ai1ec-' . $source;
$classes .= $size[0] > $size[1] ? ' ai1ec-landscape' : ' ai1ec-portrait';
$html = '<div class="ai1ec-event-avatar timely ' . $classes . '">' . $html . '</div>';
return $html;
}
开发者ID:pivotlearning,项目名称:wpsite,代码行数:43,代码来源:avatar.php
示例12: imported
/**
* Batch has been successfully imported.
*
* @param Batch $batch
*/
public function imported(Batch $batch)
{
$links = array();
$output = '';
$types = array('page', 'post');
// Only keep published posts of type $types.
$posts = array_filter($batch->get_posts(), function (Post $post) use($types) {
return $post->get_post_status() == 'publish' && in_array($post->get_type(), $types);
});
// Create links for each of the posts.
foreach ($posts as $post) {
$post_id = $this->post_dao->get_id_by_guid($post->get_guid());
$links[] = array('link' => get_permalink($post_id), 'title' => $post->get_title());
}
$links = apply_filters('sme_imported_post_links', $links);
foreach ($links as $link) {
$output .= '<li><a href="' . $link['link'] . '" target="_blank">' . $link['title'] . '</a></li>';
}
if ($output !== '') {
$output = '<ul>' . $output . '</ul>';
$message = '<h3>Posts deployed to ' . get_bloginfo('name') . ':</h3>' . $output;
$this->api->add_deploy_message($batch->get_id(), $message, 'info', 102);
}
$this->api->add_deploy_message($batch->get_id(), 'Batch has been successfully imported!', 'success', 101);
}
开发者ID:tonyjohnston,项目名称:content-staging,代码行数:30,代码来源:class-import-message-listener.php
示例13: al_portfolio_meta_tags
function al_portfolio_meta_tags()
{
$post_type = get_post_type();
if ('portfolio' == $post_type) {
$title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
$title = !empty($title) ? $title : get_the_title();
$meta = array('og:title' => $title, 'og:url' => get_permalink());
$desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
$desc = !empty($desc) ? $desc : false;
if ($desc) {
$meta['og:description'] = $desc;
}
if (has_post_thumbnail()) {
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$meta['og:image'] = $thumbnail[0];
}
if (get_post_format() == 'gallery') {
$images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
if (is_array($images)) {
foreach ($images as $image) {
$meta['images'][] = $image['url'];
}
}
}
foreach ($meta as $key => $value) {
if ($key == 'images') {
foreach ($value as $image) {
echo '<meta property="og:image" content="' . $image . '" />';
}
} else {
echo '<meta property="' . $key . '" content="' . $value . '" />';
}
}
}
}
开发者ID:azeemgolive,项目名称:thefunkidsgame,代码行数:35,代码来源:artless-portfolio.php
示例14: testThemeTemplateIsCorrectForPost
public function testThemeTemplateIsCorrectForPost()
{
$post = $this->factory->post->create();
$this->go_to_with_template(get_permalink($post));
$this->assertTrue(is_single());
$this->assertSame('single.php', self::get_theme_data('template_file'));
}
开发者ID:johnbillion,项目名称:query-monitor,代码行数:7,代码来源:test-collector-theme.php
示例15: start_el
function start_el(&$output, $page, $depth = 0, $args = array(), $current_page = 0)
{
if ($depth) {
$indent = str_repeat("\t", $depth);
} else {
$indent = '';
}
extract($args, EXTR_SKIP);
$css_class = array('page_item', 'page-item-' . $page->ID);
if (!empty($current_page)) {
$_current_page = get_post($current_page);
if (in_array($page->ID, $_current_page->ancestors)) {
$css_class[] = 'current_page_ancestor';
}
if ($page->ID == $current_page) {
$css_class[] = 'current_page_item';
} elseif ($_current_page && $page->ID == $_current_page->post_parent) {
$css_class[] = 'current_page_parent';
}
} elseif ($page->ID == get_option('page_for_posts')) {
$css_class[] = 'current_page_parent';
}
$css_class = implode(' ', apply_filters('page_css_class', $css_class, $page, $depth, $args, $current_page));
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '">' . $link_before . apply_filters('the_title', $page->post_title, $page->ID) . $link_after . '</a>';
if (!empty($show_date)) {
if ('modified' == $show_date) {
$time = $page->post_modified;
} else {
$time = $page->post_date;
}
$output .= " " . mysql2date($date_format, $time);
}
}
开发者ID:jeremybradbury,项目名称:wp-ninja-kit,代码行数:33,代码来源:default_menu_walker.php
示例16: check_get_post_response
protected function check_get_post_response($response, $post_obj, $context = 'view')
{
$response = json_ensure_response($response);
$response_data = $response->get_data();
$this->assertEquals($post_obj->ID, $response_data['ID']);
$this->assertEquals($post_obj->post_name, $response_data['slug']);
$this->assertEquals($post_obj->post_status, $response_data['status']);
$this->assertEquals($post_obj->post_author, $response_data['author']);
$this->assertArrayHasKey('parent', $response_data);
$this->assertEquals(get_permalink($post_obj->ID), $response_data['link']);
$this->assertEquals($post_obj->menu_order, $response_data['menu_order']);
$this->assertEquals($post_obj->comment_status, $response_data['comment_status']);
$this->assertEquals($post_obj->ping_status, $response_data['ping_status']);
$this->assertEquals($post_obj->post_password, $response_data['password']);
$this->assertEquals(is_sticky($post_obj->ID), $response_data['sticky']);
// Check post parent.
if ($post_obj->post_parent) {
if (is_int($response_data['parent'])) {
$this->assertEquals($post_obj->post_parent, $response_data['parent']);
} else {
$this->assertEquals($post_obj->post_parent, $response_data['parent']['ID']);
$this->check_get_post_response($response_data['parent'], get_post($response_data['parent']['ID']), 'view-parent');
}
} else {
$this->assertEmpty($response_data['parent']);
}
// Check post format.
$post_format = get_post_format($post_obj->ID);
if (empty($post_format)) {
$this->assertEquals('standard', $response_data['format']);
} else {
$this->assertEquals(get_post_format($post_obj->ID), $response_data['format']);
}
// Check post dates.
if ($post_obj->post_date_gmt === '0000-00-00 00:00:00') {
$this->assertNull($response_data['date']);
$this->assertNull($response_data['date_gmt']);
} else {
$this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date), $response_data['date']);
$this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date_gmt), $response_data['date_gmt']);
}
if ($post_obj->post_modified_gmt === '0000-00-00 00:00:00') {
$this->assertNull($response_data['modified']);
$this->assertNull($response_data['modified_gmt']);
} else {
$this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified), $response_data['modified']);
$this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified_gmt), $response_data['modified_gmt']);
}
// Check filtered values.
$this->assertEquals(get_the_title($post_obj->ID), $response_data['title']);
// TODO: apply content filter for more accurate testing.
$this->assertEquals(wpautop($post_obj->post_content), $response_data['content']);
// TODO: apply excerpt filter for more accurate testing.
$this->assertEquals(wpautop($post_obj->post_excerpt), $response_data['excerpt']);
$this->assertEquals($post_obj->guid, $response_data['guid']);
if ($context === 'edit') {
$this->assertEquals($post_obj->post_content, $response_data['content_raw']);
$this->assertEquals($post_obj->post_excerpt, $response_data['excerpt_raw']);
}
}
开发者ID:NicholasTaylorUK,项目名称:WP-API,代码行数:60,代码来源:test-json-posts.php
示例17: novalite_get_title
/**
* Wp in Progress
*
* @author WPinProgress
*
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
* It is also available at this URL: http://www.gnu.org/licenses/gpl-3.0.txt
*/
function novalite_get_title()
{
global $post;
$title = get_the_title();
if (!empty($title)) {
if (is_home() || is_category() || is_search()) {
?>
<h3 class="title"> <a href="<?php
echo get_permalink($post->ID);
?>
"> <?php
echo $title;
?>
</a> </h3>
<?php
} else {
?>
<h1 class="title"> <?php
echo $title;
?>
</h1>
<?php
}
}
}
开发者ID:f0rg3,项目名称:salvation-army,代码行数:37,代码来源:title.php
示例18: output
/**
* Output the shortcode.
*
* @access public
* @param array $atts
* @return void
*/
public static function output($atts)
{
global $woocommerce;
$woocommerce->nocache();
extract(shortcode_atts(array(), $atts));
global $post;
if (!empty($_REQUEST['orderid'])) {
$woocommerce->verify_nonce('order_tracking');
$order_id = empty($_REQUEST['orderid']) ? 0 : esc_attr($_REQUEST['orderid']);
$order_email = empty($_REQUEST['order_email']) ? '' : esc_attr($_REQUEST['order_email']);
if (!$order_id) {
echo '<p class="woocommerce-error">' . __('Please enter a valid order ID', 'woocommerce') . '</p>';
} elseif (!$order_email) {
echo '<p class="woocommerce-error">' . __('Please enter a valid order email', 'woocommerce') . '</p>';
} else {
$order = new WC_Order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
if ($order->id && $order_email) {
if (strtolower($order->billing_email) == strtolower($order_email)) {
do_action('woocommerce_track_order', $order->id);
woocommerce_get_template('order/tracking.php', array('order' => $order));
return;
}
} else {
echo '<p class="woocommerce-error">' . sprintf(__('Sorry, we could not find that order id in our database.', 'woocommerce'), get_permalink($post->ID)) . '</p>';
}
}
}
woocommerce_get_template('order/form-tracking.php');
}
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:36,代码来源:class-wc-shortcode-order-tracking.php
示例19: widget
/**
* Outputs the HTML for this widget.
*
* @param array An array of standard parameters for widgets in this theme
* @param array An array of settings for this widget instance
* @return void Echoes it's output
**/
public function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$count = esc_attr($instance['count']);
$count = 0 < $count && $count < 10 ? $count : 2;
$loop = new WP_Query(array('post_type' => 'event', 'posts_per_page' => $count, 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_event_start', 'meta_query' => array(array('key' => '_event_end', 'value' => time(), 'compare' => '>'))));
if ($loop->have_posts()) {
echo $before_widget;
if ($instance['title']) {
echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
}
echo '<ul>';
while ($loop->have_posts()) {
$loop->the_post();
global $post;
$output = '<span class="meta">' . date(get_option('date_format'), get_post_meta(get_the_ID(), '_event_start', true)) . '</span> <a href="' . get_permalink() . '">' . get_the_title() . '</a>';
$read_more = apply_filters('em4wp_events_manager_upcoming_widget_output', $output, $post);
if ($read_more) {
echo '<li>' . $read_more . '</li>';
}
}
if ($instance['more_text']) {
echo '<li><a href="' . get_post_type_archive_link('event') . '">' . esc_attr($instance['more_text']) . '</a></li>';
}
echo '</ul>';
echo $after_widget;
}
wp_reset_postdata();
}
开发者ID:forsitemedia,项目名称:events-manager-for-wp,代码行数:36,代码来源:class-em4wp-upcoming-events.php
示例20: lp_thumbnail_metabox
function lp_thumbnail_metabox()
{
global $post;
$template = get_post_meta($post->ID, 'lp-selected-template', true);
$template = apply_filters('lp_selected_template', $template);
$permalink = get_permalink($post->ID);
$datetime = the_modified_date('YmjH', null, null, false);
$permalink = $permalink . '?dt=' . $datetime;
if (in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
if (file_exists(LANDINGPAGES_UPLOADS_PATH . $template . '/thumbnail.png')) {
$thumbnail = LANDINGPAGES_UPLOADS_URLPATH . $template . '/thumbnail.png';
} else {
$thumbnail = LANDINGPAGES_URLPATH . 'templates/' . $template . '/thumbnail.png';
}
} else {
$thumbnail = 'http://s.wordpress.com/mshots/v1/' . urlencode(esc_url($permalink)) . '?w=250';
}
$permalink = apply_filters('lp_live_screenshot_url', $permalink);
?>
<div >
<div class="inside" style='margin-left:-8px;'>
<table>
<tr>
<td>
<?php
echo "<a href='{$permalink}' target='_blank' ><img src='{$thumbnail}' style='width:250px;height:250px;' title='" . __('Preview this theme', 'landing-pages') . " , ({$template})'></a>";
?>
</td>
</tr>
</table>
</div>
</div>
<?php
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:35,代码来源:module.metaboxes.php
注:本文中的get_permalink函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论