本文整理汇总了PHP中get_post_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_permalink函数的具体用法?PHP get_post_permalink怎么用?PHP get_post_permalink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_permalink函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testPostsSelectionWithFilters
public function testPostsSelectionWithFilters()
{
// Create 2 posts and 2 entities
$entity_1_id = wl_create_post('', 'entity0', 'An Entity', 'draft', 'entity');
$post_1_id = wl_create_post('', 'post1', 'A post', 'publish');
$post_2_id = wl_create_post('', 'post2', 'A post', 'publish');
// Insert relations
wl_core_add_relation_instance($post_1_id, WL_WHAT_RELATION, $entity_1_id);
wl_core_add_relation_instance($post_2_id, WL_WHAT_RELATION, $entity_1_id);
// Set $_GET variable: this means we will perform data selection for $entity_1_id
$_GET['post_id'] = $post_1_id;
// Mock php://input
$mock_http_raw_data = json_encode(array(wl_get_entity_uri($entity_1_id)));
try {
$this->_handleAjax('wordlift_related_posts', $mock_http_raw_data);
} catch (WPAjaxDieContinueException $e) {
}
$response = json_decode($this->_last_response);
$this->assertInternalType('array', $response);
$this->assertCount(1, $response);
$this->assertEquals('post', $response[0]->post_type);
$this->assertEquals($post_2_id, $response[0]->ID);
$this->assertEquals(get_edit_post_link($post_2_id, 'none'), $response[0]->link);
$this->assertEquals(get_post_permalink($post_2_id), $response[0]->permalink);
}
开发者ID:Byrlyne,项目名称:wordlift-plugin,代码行数:25,代码来源:test-ajax-related-posts.php
示例2: widget
public function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
$numberposts = isset($instance['numberposts']) ? $instance['numberposts'] : 1;
$termargs = array('post_type' => 'glossary', 'post_status' => 'publish', 'numberposts' => $numberposts, 'orderby' => 'rand');
if ($group = $instance['group']) {
$termargs['tax_query'] = array(array('taxonomy' => 'wpglossarygroup', 'field' => 'slug', 'terms' => $group));
}
$terms = get_posts($termargs);
if ($terms && count($terms)) {
echo '<ul class="wpglossary widget-list">';
foreach ($terms as $term) {
setup_postdata($term);
$title = '<a href="' . apply_filters('wpg_term_link', get_post_permalink($term->ID)) . '">' . get_the_title($term->ID) . '</a>';
$desc = '';
$display = $instance['display'];
if ($display && $display != 'title') {
$desc = $display == 'full' ? apply_filters('the_content', get_the_content(), $main = false) : wpautop(get_the_excerpt());
$desc = '<br>' . $desc;
}
echo '<li>' . $title . $desc . '</li>';
}
wp_reset_postdata();
echo '</ul>';
} else {
echo '<em>' . __('No terms available', 'wp-glossary') . '</em>';
}
echo $after_widget;
}
开发者ID:s3rgiosan,项目名称:WP-Glossary,代码行数:34,代码来源:wpg-widget-random-term.class.php
示例3: wordlift_ajax_related_posts
function wordlift_ajax_related_posts($http_raw_data = null)
{
// Extract filtering conditions
if (!isset($_GET["post_id"]) || !is_numeric($_GET["post_id"])) {
wp_die('Post id missing or invalid!');
return;
}
$post_id = $_GET["post_id"];
// Get the current post
$post = get_post($post_id);
wl_write_log("Going to find posts related to current with post id: {$post_id} ...");
// Extract filtering conditions
$filtering_entity_uris = null == $http_raw_data ? file_get_contents("php://input") : $http_raw_data;
$filtering_entity_uris = json_decode($filtering_entity_uris);
$filtering_entity_ids = wl_get_entity_post_ids_by_uris($filtering_entity_uris);
$related_posts = array();
// If the current post is an antity
// related posts to the current entity are returned
if (Wordlift_Entity_Service::TYPE_NAME == $post->post_type) {
$filtering_entity_ids = array($post_id);
}
if (!empty($filtering_entity_ids)) {
$related_posts = wl_core_get_posts(array('get' => 'posts', 'related_to__in' => $filtering_entity_ids, 'post__not_in' => array($post_id), 'post_type' => 'post', 'post_status' => 'publish', 'as' => 'subject'));
foreach ($related_posts as $post_obj) {
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($post_obj->ID, 'thumbnail'));
$post_obj->thumbnail = $thumbnail ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
$post_obj->link = get_edit_post_link($post_obj->ID, 'none');
$post_obj->permalink = get_post_permalink($post_obj->ID);
}
}
wl_core_send_json($related_posts);
}
开发者ID:Byrlyne,项目名称:wordlift-plugin,代码行数:32,代码来源:wordlift_admin_ajax_related_posts.php
示例4: send_message
/**
* Should we send the message over to email?
*
* @param array $data The data to be sent
* @param array $settings The Integration settings
* @param bool Is this a default message?
* @return null
*/
function send_message($data, $settings, $default)
{
if (!isset($settings[$this->slug . '-enable'])) {
return;
}
// Check if the to emails are set
$to_emails = $settings[$this->slug . '-to-emails'];
if (empty($to_emails)) {
return;
}
$subject = '';
$message = '';
$headers = array();
// Check if this is a default message
if ($default) {
$subject = $data['text'];
$message = $data['text'];
}
// Post Status
if (isset($data['post_status']) && isset($data['post'])) {
$subject = $data['post']->post_title . ' changed status to ' . $data['post_status'];
$message = $data['post']->post_title . ' changed status to ' . $data['post_status'] . '.' . $this->new_line . $this->new_line . 'View: ' . get_post_permalink($data['post']->ID);
}
wp_mail(apply_filters('gnt_integration_' . $this->slug . '_to_emails', $to_emails), apply_filters('gnt_integration_' . $this->slug . '_subject', $subject), apply_filters('gnt_integration_' . $this->slug . '_message', $message), apply_filters('gnt_integration_' . $this->slug . '_headers', $headers));
}
开发者ID:kjbenk,项目名称:get-notified,代码行数:33,代码来源:email.php
示例5: show_ajax_form
public function show_ajax_form()
{
if (isset($_REQUEST['productid'])) {
$dropdownargs = array('show_option_all' => false, 'show_option_none' => false, 'orderby' => 'id', 'order' => 'ASC', 'show_count' => 1, 'hide_empty' => 0, 'child_of' => 0, 'exclude' => '', 'echo' => 0, 'selected' => 0, 'hierarchical' => 1, 'name' => 'wcordersortupdateshelf', 'id' => '', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'product_shelf', 'hide_if_empty' => false, 'option_none_value' => -1, 'value_field' => 'term_id');
$echo = '';
$product_name = '<a href="' . get_post_permalink($_REQUEST['productid']) . '" >' . get_the_title($_REQUEST['productid']) . '</a>';
$echo .= '<form method="post"> <table class="flat-table" cellspacing="3" >';
$echo .= '<tr>';
$echo .= '<th>Product Name : </th>';
$echo .= '<td>' . $product_name . '</td>';
$echo .= '</tr>';
$echo .= '<tr>';
$echo .= '<th>Shelf : </th>';
$echo .= '<td>' . wp_dropdown_categories($dropdownargs) . '</td>';
$echo .= '</tr>';
$echo .= '<tr>';
$echo .= '<td><input type="hidden" name="action" value="wcordersortforechangeshelf" /> </td>';
$echo .= '<td><input type="submit" class="myButton "value="Update Shelf"/> </td>';
$echo .= '</tr>';
$echo .= '</table> </form>';
$echo .= '<style>';
$echo .= 'table { width: 100%; }
th { background: #eee; color: black; font-weight: bold; }
td, th { padding: 6px; border: 1px solid #ccc; text-align: left; }';
$echo .= ".myButton {\tbackground:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #77b55a), color-stop(1, #72b352)); background:-moz-linear-gradient(top, #77b55a 5%, #72b352 100%); \tbackground:-webkit-linear-gradient(top, #77b55a 5%, #72b352 100%); \tbackground:-o-linear-gradient(top, #77b55a 5%, #72b352 100%); background:-ms-linear-gradient(top, #77b55a 5%, #72b352 100%); background:linear-gradient(to bottom, #77b55a 5%, #72b352 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77b55a', endColorstr='#72b352',GradientType=0); background-color:#77b55a; -moz-border-radius:4px; \t-webkit-border-radius:4px; \tborder-radius:4px; \tborder:1px solid #4b8f29; display:inline-block; cursor:pointer; color:#ffffff; font-family:Arial; font-size:15px; font-weight:bold; padding:6px 12px;\ttext-decoration:none;\ttext-shadow:0px 1px 0px #5b8a3c;} .myButton:hover { background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #72b352), color-stop(1, #77b55a)); \tbackground:-moz-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:-webkit-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:-o-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:-ms-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:linear-gradient(to bottom, #72b352 5%, #77b55a 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#72b352', endColorstr='#77b55a',GradientType=0); \tbackground-color:#72b352; } .myButton:active { \tposition:relative; \ttop:1px; }";
$echo .= '</style>';
echo $echo;
}
wp_die();
}
开发者ID:technofreaky,项目名称:wc-order-category-sort,代码行数:30,代码来源:class-admin-functions.php
示例6: test_google_utm_link
public function test_google_utm_link()
{
$link = get_post_permalink($this->_post_id);
$name = 'sharedate_0_' . $this->_post_id . '_tw';
$unique_link = ppp_generate_google_utm_link($link, $this->_post_id, $name);
$this->assertEquals('http://example.org/?post_type=post&p=' . $this->_post_id . '&utm_source=Twitter&utm_medium=social&utm_term=test-post&utm_content=0&utm_campaign=PostPromoterPro', $unique_link);
}
开发者ID:sumobi,项目名称:post-promoter-pro,代码行数:7,代码来源:tests-general.php
示例7: test_landing_page_read
/**
* launch a landing page
*/
function test_landing_page_read()
{
return;
/* includes */
include_once LANDINGPAGES_PATH . 'classes/class.statistics.php';
$permalink = get_post_permalink($this->lp_id, false);
echo $permalink . "\r\n";
$permalink = 'http://local.wordpress.dev/go/ab-testing-landing-page-example-104/?lp-variation-id=1';
$permalink = 'http://local.wordpress.dev/';
print_r(inbound_remote_get($permalink));
/*
sleep(5);
$response = inbound_remote_get( $permalink );
sleep(5);
$response = inbound_remote_get( $permalink );
sleep(5);
$response = inbound_remote_get( $permalink );
sleep(5);
$response = inbound_remote_get( add_query_arg( array('lp-variation-id'=> 0 ) , $permalink ) );
sleep(5);
$response = inbound_remote_get( add_query_arg( array('lp-variation-id'=> 1 ) , $permalink ) );
sleep(5);
*/
$stats = Landing_Pages_Statistics::read_statistics($this->lp_id);
print_r($stats);
$this->assertEquals($stats['impressions'][0], 3);
$this->assertEquals($stats['conversions'][0], 0);
$this->assertEquals($stats['impressions'][1], 3);
$this->assertEquals($stats['conversions'][1], 0);
}
开发者ID:polishman,项目名称:landing-pages,代码行数:33,代码来源:test.statistics.php
示例8: cdm_logout_url
function cdm_logout_url()
{
global $wp_query;
$post_id = $wp_query->post->ID;
$logout = wp_logout_url(get_post_permalink($post_id));
$logout = apply_filters('spcdm/links/logout', $logout);
return $logout;
}
开发者ID:beafus,项目名称:Living-Meki-Platform,代码行数:8,代码来源:functions.php
示例9: em_wp_localize_script
public static function em_wp_localize_script($vars)
{
if (get_option('dbem_multiple_bookings_redirect')) {
$vars['mb_redirect'] = get_post_permalink(get_option('dbem_multiple_bookings_checkout_page'));
}
$vars['mb_empty_cart'] = get_option('dbem_multiple_bookings_feedback_empty_cart');
return $vars;
}
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:8,代码来源:multiple-bookings.php
示例10: setupFromPost
public function setupFromPost()
{
$this->id = $this->post->ID;
$this->title = $this->post->post_title;
$this->date = $this->post->post_date;
$this->postUrl = get_post_permalink($this->id);
$this->snippet = get_post_meta($this->id, 'snippet', true);
}
开发者ID:kilrizzy,项目名称:WP-JK-Snippets,代码行数:8,代码来源:Snippet.php
示例11: start_el
/**
* Start rendering an item element
*
* This overrides the parent method.
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $page Page data object.
* @param int $depth Depth of page. Used for padding.
* @param array $args
* @param int $current_page Page ID.
*/
function start_el(&$output, $page, $depth, $args, $current_page)
{
// need the menu item classes
$classes[] = 'menu-item';
$classes[] = 'menu-item-type-post_type';
$classes[] = 'menu-item-object-page';
// our custom output
$output .= infinity_base_superfish_list_item(array('id' => $page->ID, 'title' => apply_filters('the_title', $page->post_title, $page->ID), 'close_item' => false, 'li_classes' => $classes, 'a_title' => $page->post_title, 'a_href' => get_post_permalink($page->ID), 'a_target' => isset($args['target']) ? $args['target'] : null, 'a_rel' => isset($args['rel']) ? $args['rel'] : null, 'a_open' => isset($args['link_before']) ? $args['link_before'] : null, 'a_close' => isset($args['link_after']) ? $args['link_after'] : null), false);
}
开发者ID:shads196770,项目名称:cbox-theme,代码行数:20,代码来源:walkers.php
示例12: hook_redirect_comment_for_answer
/**
* Change redirect link when comment for answer finished
* @param string $location Old redirect link
* @param object $comment Comment Object
* @return string New redirect link
*/
public function hook_redirect_comment_for_answer($location, $comment)
{
if ('dwqa-answer' == get_post_type($comment->comment_post_ID)) {
$question = get_post_meta($comment->comment_post_ID, '_question', true);
if ($question) {
return get_post_permalink($question) . '#' . 'answer-' . $comment->comment_post_ID . '&comment=' . $comment->comment_ID;
}
}
return $location;
}
开发者ID:layoutzweb,项目名称:dw-question-answer,代码行数:16,代码来源:Comment.php
示例13: save_post
/**
* AJAX handler for saving the post as draft or published.
*
* @since 4.2.0
* @access public
*/
public function save_post()
{
if (empty($_POST['post_ID']) || !($post_id = (int) $_POST['post_ID'])) {
wp_send_json_error(array('errorMessage' => __('Missing post ID.')));
}
if (empty($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'update-post_' . $post_id) || !current_user_can('edit_post', $post_id)) {
wp_send_json_error(array('errorMessage' => __('Invalid post.')));
}
$post = array('ID' => $post_id, 'post_title' => !empty($_POST['post_title']) ? sanitize_text_field(trim($_POST['post_title'])) : '', 'post_content' => !empty($_POST['post_content']) ? trim($_POST['post_content']) : '', 'post_type' => 'post', 'post_status' => 'draft', 'post_format' => !empty($_POST['post_format']) ? sanitize_text_field($_POST['post_format']) : '', 'tax_input' => !empty($_POST['tax_input']) ? $_POST['tax_input'] : array(), 'post_category' => !empty($_POST['post_category']) ? $_POST['post_category'] : array());
if (!empty($_POST['post_status']) && 'publish' === $_POST['post_status']) {
if (current_user_can('publish_posts')) {
$post['post_status'] = 'publish';
} else {
$post['post_status'] = 'pending';
}
}
$post['post_content'] = $this->side_load_images($post_id, $post['post_content']);
$updated = wp_update_post($post, true);
if (is_wp_error($updated)) {
wp_send_json_error(array('errorMessage' => $updated->get_error_message()));
} else {
if (isset($post['post_format'])) {
if (current_theme_supports('post-formats', $post['post_format'])) {
set_post_format($post_id, $post['post_format']);
} elseif ($post['post_format']) {
set_post_format($post_id, false);
}
}
$forceRedirect = false;
if ('publish' === get_post_status($post_id)) {
$redirect = get_post_permalink($post_id);
} elseif (isset($_POST['pt-force-redirect']) && $_POST['pt-force-redirect'] === 'true') {
$forceRedirect = true;
$redirect = get_edit_post_link($post_id, 'js');
} else {
$redirect = false;
}
/**
* Filter the URL to redirect to when Press This saves.
*
* @since 4.2.0
*
* @param string $url Redirect URL. If `$status` is 'publish', this will be the post permalink.
* Otherwise, the default is false resulting in no redirect.
* @param int $post_id Post ID.
* @param string $status Post status.
*/
$redirect = apply_filters('press_this_save_redirect', $redirect, $post_id, $post['post_status']);
if ($redirect) {
wp_send_json_success(array('redirect' => $redirect, 'force' => $forceRedirect));
} else {
wp_send_json_success(array('postSaved' => true));
}
}
}
开发者ID:kadrim1,项目名称:metsayhistu,代码行数:61,代码来源:class-wp-press-this.php
示例14: output
/**
* Output the metabox
*/
public static function output($post)
{
$feeds = new SP_Feeds();
$calendar_feeds = $feeds->calendar;
?>
<div>
<?php
foreach ($calendar_feeds as $slug => $formats) {
?>
<?php
$link = add_query_arg('feed', 'sp-' . $slug, untrailingslashit(get_post_permalink($post)));
?>
<?php
foreach ($formats as $format) {
?>
<?php
$protocol = sp_array_value($format, 'protocol');
if ($protocol) {
$feed = str_replace(array('http:', 'https:'), 'webcal:', $link);
} else {
$feed = $link;
}
$prefix = sp_array_value($format, 'prefix');
if ($prefix) {
$feed = $prefix . urlencode($feed);
}
?>
<p>
<strong><?php
echo sp_array_value($format, 'name');
?>
</strong>
<a class="sp-link" href="<?php
echo $feed;
?>
" target="_blank" title="<?php
_e('Link', 'sportspress');
?>
"></a>
</p>
<p>
<input type="text" value="<?php
echo $feed;
?>
" readonly="readonly" class="code widefat">
</p>
<?php
}
?>
<?php
}
?>
</div>
<?php
}
开发者ID:engrmostafijur,项目名称:SportsPress,代码行数:58,代码来源:class-sp-meta-box-calendar-feeds.php
示例15: widget
function widget($args, $instance)
{
global $tc;
if (tc_current_url() !== $cart_url || $show_widget_on_cart_page) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? ' ' : apply_filters('tc_cart_widget_title', $instance['title']);
$events_count = empty($instance['events_count']) ? 10 : apply_filters('tc_events_count_widget_value', $instance['events_count']);
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
//event_date_time
$tc_events_args = array('posts_per_page' => (int) $events_count, 'meta_query' => array(array('key' => 'event_date_time', 'value' => date('Y-m-d h:i'), 'type' => 'DATETIME', 'compare' => '>='), 'orderby' => 'event_date_time'), 'order' => 'ASC', 'orderby' => 'meta_value', 'post_type' => 'tc_events', 'post_status' => 'publish');
$tc_events = get_posts($tc_events_args);
?>
<?php
// Cart Contents
if (!empty($tc_events)) {
do_action('tc_upcoming_events_before_ul', $tc_events);
?>
<ul class='tc_upcoming_events_ul'>
<?php
foreach ($tc_events as $tc_event) {
$event_content = '<li id="tc_upcoming_event_' . $tc_event->ID . '">
<a href="' . get_post_permalink($tc_event->ID) . '">' . get_the_title($tc_event->ID) . '</a>
<span class="tc_event_data_widget">' . do_shortcode('[tc_event_date id="' . $tc_event->ID . '"]') . '</span>
</li>';
echo apply_filters('tc_upcoming_events_widget_event_content', $event_content, $tc_event->ID);
}
?>
</ul><!--tc_cart_ul-->
<?php
do_action('tc_upcoming_events_after_ul', $tc_events);
} else {
do_action('tc_upcoming_events_before_empty');
?>
<span class='tc_empty_upcoming_events'><?php
_e('There are no upcoming events at this time.', 'tc');
?>
</span>
<?php
do_action('tc_upcoming_events_after_empty');
}
?>
<div class='tc-clearfix'></div>
<?php
echo $after_widget;
}
}
开发者ID:walkthenight,项目名称:walkthenight-wordpress,代码行数:52,代码来源:upcoming-events-widget.php
示例16: setupFromPost
public function setupFromPost()
{
$this->id = $this->post->ID;
$this->title = $this->post->post_title;
$this->date = $this->post->post_date;
$this->postUrl = get_post_permalink($this->id);
$this->url = trim($this->post->post_excerpt);
$this->thumbId = get_post_thumbnail_id($this->id);
$imageURLParts = wp_get_attachment_image_src(get_post_thumbnail_id($this->id), 'single-post-thumbnail');
if ($imageURLParts) {
$this->imageURL = $imageURLParts[0];
}
}
开发者ID:kilrizzy,项目名称:WP-JK-Banners,代码行数:13,代码来源:Banner.php
示例17: setupFromPost
public function setupFromPost()
{
$this->id = $this->post->ID;
$this->title = $this->post->post_title;
$this->date = $this->post->post_date;
$this->url = get_post_permalink($this->id);
$this->thumbId = get_post_thumbnail_id($this->id);
$this->content = apply_filters('the_content', $this->post->post_content);
$imageURLParts = wp_get_attachment_image_src(get_post_thumbnail_id($this->id), 'single-post-thumbnail');
if ($imageURLParts) {
$this->imageURL = $imageURLParts[0];
}
}
开发者ID:kilrizzy,项目名称:WP-JK-Comics,代码行数:13,代码来源:Comic.php
示例18: widget
/**
* How to display the widget on the screen.
*/
function widget($args, $instance)
{
extract($args);
/* Our variables from the widget settings. */
$title = $instance['title'];
$num_comments = $instance['number_comments'];
$args = array('number' => $num_comments, 'status' => 'approve');
$comments = get_comments($args);
if (count($comments) == 0) {
?>
<!-- Note, MBU: Recent Comments Widget not shown. No comments to display -->
<?php
} else {
/* Before widget (defined by themes). */
echo $before_widget;
?>
<div id="recent-comments" >
<h2><?php
echo $title;
?>
</h2>
<ul>
<?php
foreach ($comments as $comment) {
$commented_post = get_post($comment->comment_post_ID);
$commented_post_link = convert_chars(get_post_permalink($comment->comment_post_ID)) . '#comment-' . $comment->comment_ID;
?>
<li>
<a href="<?php
echo $commented_post_link;
?>
" title="<?php
printf(_x('By %1$s on %2$s.', ' By [comment author] on [post title]', TEMPLATE_DOMAIN), $comment->comment_author, $commented_post->post_title);
?>
" ><?php
echo $comment->comment_content;
?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<?php
/* After widget (defined by themes). */
echo $after_widget;
}
}
开发者ID:mbudm,项目名称:artpro,代码行数:53,代码来源:mb_Recent_Comments_Widget.php
示例19: parseRedirect
/**
* Parse Redirect
*
* @todo Delete in next release
* @param mixed
*/
protected function parseRedirect($redirect)
{
if (filter_var($redirect, FILTER_VALIDATE_URL)) {
wp_redirect($redirect);
exit;
} elseif (is_int($redirect)) {
wp_redirect(get_post_permalink($redirect));
exit;
} elseif (is_object($redirect) && isset($redirect->userFunc)) {
$func = trim($redirect->userFunc);
if (is_string($func) && is_callable($func)) {
call_user_func($func);
}
}
}
开发者ID:rosshettel,项目名称:Northern-Star-Blogs,代码行数:21,代码来源:mvb_model_configpress.php
示例20: update_post
function update_post($content)
{
$_number_roman = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
$_number_tibet = array('༠', '༡', '༢', '༣', '༤', '༥', '༦', '༧', '༨', '༩');
$title = get_the_title();
$id = get_the_ID();
$link = get_post_permalink();
$time = get_the_time();
$new_time = str_replace($_number_roman, $_number_tibet, $time);
$_comments = get_comments_number();
$_comments = str_replace($_number_roman, $_number_tibet, $_comments);
$updated_content = str_replace($_number_roman, $_number_tibet, $content);
//return $updated_content. $_comments;
return '<a href="' . $link . '"><b>' . $title . '</b></a>' . $updated_content . '<br />' . $new_time . ' | ' . $_comments . 'comments';
}
开发者ID:str33thack3r,项目名称:wp01,代码行数:15,代码来源:custom-01.php
注:本文中的get_post_permalink函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论