本文整理汇总了PHP中get_edit_post_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_edit_post_link函数的具体用法?PHP get_edit_post_link怎么用?PHP get_edit_post_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_edit_post_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: work_complete
function work_complete($job_id, $update = false)
{
global $iclTranslationManagement, $sitepress, $wpdb;
$job = $iclTranslationManagement->get_translation_job($job_id);
if ($job->manager_id == $job->translator_id) {
return;
}
$manager = new WP_User($job->manager_id);
$translator = new WP_User($job->translator_id);
// get current user admin language
$user_language = $sitepress->get_user_admin_language($manager->ID);
if (empty($user_language)) {
$user_language = $sitepress->get_admin_language();
}
$lang_from = $wpdb->get_var($wpdb->prepare("SELECT name FROM {$wpdb->prefix}icl_languages_translations WHERE language_code='%s' AND display_language_code='%s'", $job->source_language_code, $user_language));
$lang_to = $wpdb->get_var($wpdb->prepare("SELECT name FROM {$wpdb->prefix}icl_languages_translations WHERE language_code='%s' AND display_language_code='%s'", $job->language_code, $user_language));
$tj_url = get_option('siteurl') . '/wp-admin/admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/translation-management.php&sm=jobs';
$doc_url = get_edit_post_link($job->original_doc_id);
if ($iclTranslationManagement->settings['notification']['completed'] == ICL_TM_NOTIFICATION_IMMEDIATELY) {
$mail['to'] = $manager->user_email;
if ($update) {
$mail['subject'] = sprintf(__('Translator has updated translation job for %s', 'sitepress'), get_bloginfo('name'));
$mail['body'] = sprintf(__("Translator (%s) has updated translation of job \"%s\" for %s to %s.\n%s\n\nView translation jobs: %s", 'sitepress'), $translator->display_name, $job->original_doc_title, $lang_from, $lang_to, $doc_url, $tj_url);
} else {
$mail['subject'] = sprintf(__('Translator has completed translation job for %s', 'sitepress'), get_bloginfo('name'));
$mail['body'] = sprintf(__("Translator (%s) has completed translation of job \"%s\" for %s to %s.\n%s\n\nView translation jobs: %s", 'sitepress'), $translator->display_name, $job->original_doc_title, $lang_from, $lang_to, $doc_url, $tj_url);
}
$mail['type'] = 'admin';
$this->send_mail($mail);
}
}
示例2: answers_meta_box_content
/**
* Render Meta Box content.
*/
public function answers_meta_box_content()
{
$ans_args = array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => get_the_ID(), 'showposts' => 10, 'orderby' => 'date', 'order' => 'DESC');
$ans_args = apply_filters('ap_meta_box_answers_query_args', $ans_args);
$answers = get_posts($ans_args);
if (!empty($answers)) {
foreach ($answers as $ans) {
?>
<div class="answer clearfix">
<div class="author">
<span><?php
echo get_avatar($ans->post_author, 30);
?>
</span>
<strong><?php
echo ap_user_display_name($ans->post_author);
?>
</strong>
</div>
<div class="answer-content">
<div class="submitted-on">
<?php
printf(__('%sAnswered about %s ago%s', 'ap'), '<span class="when">', '</span>', ap_human_time(get_the_time('U', $ans)));
?>
</div>
<p><?php
echo $ans->post_content;
?>
</p>
<div class="row-actions">
<span><a href="<?php
echo get_edit_post_link($ans->ID);
?>
"><?php
_e('Edit', 'ap');
?>
</a></span>
<span> | <a href="#"><?php
_e('Hide', 'ap');
?>
</a></span>
<span class="delete vim-d vim-destructive"> | <a href="<?php
echo get_delete_post_link($ans->ID);
?>
"><?php
_e('Trash', 'ap');
?>
</a></span>
</div>
</div>
</div>
<?php
}
} else {
_e('No answers yet', 'ap');
}
wp_reset_postdata();
}
示例3: acquirer_field_input
/**
* Acquirrer field input
*
* @param string $field_content
* @param string $field
* @param string $value
* @param string $lead_id
* @param string $form_id
*/
public static function acquirer_field_input($field_content, $field, $value, $lead_id, $form_id)
{
$type = RGFormsModel::get_input_type($field);
if (Pronamic_WP_Pay_Extensions_GravityForms_IssuerDropDown::TYPE === $type) {
$id = $field['id'];
$field_id = IS_ADMIN || 0 === $form_id ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
$class_suffix = RG_CURRENT_VIEW === 'entry' ? '_admin' : '';
$size = rgar($field, 'size');
$class = $size . $class_suffix;
$css_class = trim(esc_attr($class) . ' gfield_ideal_acquirer_select');
$tab_index = GFCommon::get_tabindex();
$disabled_text = IS_ADMIN && 'entry' !== RG_CURRENT_VIEW ? "disabled='disabled'" : '';
$html = '';
$feed = get_pronamic_gf_pay_conditioned_feed_by_form_id($form_id, true);
/**
* Developing warning:
* Don't use single quotes in the HTML you output, it is buggy in combination with SACK
*/
if (IS_ADMIN) {
if (null === $feed) {
$html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", add_query_arg('post_type', 'pronamic_pay_gf', admin_url('post-new.php')), __('Create iDEAL feed', 'pronamic_ideal'));
} else {
$html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", get_edit_post_link($feed->id), __('Edit iDEAL feed', 'pronamic_ideal'));
}
}
$html_input = '';
$html_error = '';
if (null !== $feed) {
$gateway = Pronamic_WP_Pay_Plugin::get_gateway($feed->config_id);
if ($gateway) {
$issuer_field = $gateway->get_issuer_field();
$error = $gateway->get_error();
if (is_wp_error($error)) {
$html_error .= Pronamic_WP_Pay_Plugin::get_default_error_message();
$html_error .= '<br /><em>' . $error->get_error_message() . '</em>';
} elseif ($issuer_field) {
$choices = $issuer_field['choices'];
$options = Pronamic_WP_HTML_Helper::select_options_grouped($choices, $value);
// Double quotes are not working, se we replace them with an single quote
$options = str_replace('"', '\'', $options);
$html_input = '';
$html_input .= sprintf("<select name='input_%d' id='%s' class='%s' %s %s>", $id, $field_id, $css_class, $tab_index, $disabled_text);
$html_input .= sprintf('%s', $options);
$html_input .= sprintf('</select>');
}
}
}
if ($html_error) {
$html .= sprintf("<div class='gfield_description validation_message'>");
$html .= sprintf('%s', $html_error);
$html .= sprintf('</div>');
} else {
$html .= sprintf("<div class='ginput_container ginput_ideal'>");
$html .= sprintf('%s', $html_input);
$html .= sprintf('</div>');
}
$field_content = $html;
}
return $field_content;
}
示例4: 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);
}
示例5: testimonial_rotator_add_columns
function testimonial_rotator_add_columns($column, $post_id)
{
$edit_link = get_edit_post_link($post_id);
$rotator_ids = testimonial_rotator_break_piped_string(get_post_meta($post_id, "_rotator_id", true));
$rotator_title_array = array();
foreach ($rotator_ids as $rotator_id) {
$rotator_title_array[] = "<a href='post.php?action=edit&post=" . $rotator_id . "'>" . get_the_title($rotator_id) . "</a>";
}
$this_testimonial = get_post($post_id);
if ($column == 'ID') {
echo implode(", ", $rotator_title_array);
}
if ($column == 'image') {
echo '<a href="' . $edit_link . '">' . get_the_post_thumbnail($post->ID, array(50, 50), array('title' => trim(strip_tags($post->post_title)))) . '</a>';
}
if ($column == 'order') {
echo '<a href="' . $edit_link . '">' . $this_testimonial->menu_order . '</a>';
}
if ($column == 'rating') {
echo get_post_meta($post_id, "_rating", true);
}
if ($column == 'shortcode') {
echo '<b>' . __('Display as Single', 'testimonial-rotator') . '</b><br />';
echo '[testimonial_single id="' . $post_id . '"]';
}
}
示例6: fnt_dashboard_widget
function fnt_dashboard_widget()
{
$clientid = '9f690b3117f0c43767528e2b60bc70ce';
$args = array('posts_per_page' => -1, 'offset' => 0, 'post_status' => array('publish', 'draft'), 'post_type' => 'tracks');
$errors = 0;
$query = new WP_Query($args);
while ($query->have_posts()) {
$query->the_post();
$id = get_the_ID();
$track_url = get_post_meta($id, 'track_url', true);
$errored = 0;
if (get_post_status() == 'draft') {
$errored = 1;
} else {
$soundcloud_url = 'https://api.soundcloud.com/resolve?url=' . $track_url . '&format=json&consumer_key=' . $clientid;
$track_json = file_get_contents($soundcloud_url);
$track = json_decode($track_json);
if ($track == null || isset($track->errors) && isset($track->errors[0]) && $track->errors[0]->error_message == '404 - Not Found' || $track->errors[0]->error_message == 'HTTP Error: 403') {
$errored = 1;
$update = array('ID' => $id, 'post_status' => 'draft');
wp_update_post($update);
}
}
if ($errored > 0) {
echo '<span style="color:red;">SC Track is private & won\'t play: </span> ' . '<a href="' . get_edit_post_link() . '" target="_blank">' . get_the_title() . '</a><br/>';
$errors++;
}
}
if ($errors > 0) {
echo '<br/><em>These ' . $errors . ' posts are all drafts, but should probably be fixed or removed.</em>';
} else {
echo 'There are no broken tracks! That is SHOCKING :)';
}
}
示例7: registerPostType
/**
* Registering a post type
*
* @param string $type slug of the type
* @param string $singular singular name
* @param string $plural plural name
* @param array $config can override the defaults of this function (array_merge)
*/
public static function registerPostType($type, $singular, $plural, $config = array())
{
$labels = array('name' => $plural, 'singular_name' => $singular, 'add_new' => 'Erstellen', 'add_new_item' => $singular . ' erfassen', 'edit_item' => 'Bearbeite ' . $singular, 'new_item' => 'Neues ' . $singular, 'view_item' => $singular . ' ansehen', 'search_items' => $singular . ' suchen', 'not_found' => 'Keine ' . $plural . ' gefunden', 'not_found_in_trash' => 'Keine ' . $plural . ' im Papierkorb gefunden', 'parent_item_colon' => '');
$defaults = array('labels' => $labels, 'public' => true, 'has_archive' => true, 'plural_view_adminbar' => false);
$arguments = array_merge_recursive_distinct($defaults, $config);
if (isset($arguments['plural_view_adminbar']) && $arguments['plural_view_adminbar']) {
add_action('admin_bar_menu', function ($wp_admin_bar) use($type, $arguments) {
$object = get_queried_object();
if ($object->name == $type) {
$title = $object->labels->menu_name;
if (is_admin()) {
$url = get_post_type_archive_link($type);
} else {
$url = get_admin_url(null, 'edit.php?post_type=' . $type);
}
}
if ($object->post_type == $type) {
if (!is_admin()) {
$url = get_edit_post_link($object->ID);
$title = $arguments['labels']['edit_item'];
}
}
// Add admin bar entry
if ($url) {
$wp_admin_bar->add_node(array('id' => 'custom-button', 'title' => $title, 'href' => $url));
}
}, 95);
}
register_post_type($type, $arguments);
}
示例8: pending_submission_send_email
function pending_submission_send_email($new_status, $old_status, $post)
{
// Notifiy Admin that Contributor has writen a post
if ($new_status == 'pending' && user_can($post->post_author, 'edit_posts') && !user_can($post->post_author, 'publish_posts')) {
$pending_submission_email = get_option('pending_submission_notification_admin_email');
$admins = get_option('admin_email');
$url = get_permalink($post->ID);
$edit_link = get_edit_post_link($post->ID, '');
$preview_link = get_permalink($post->ID) . '&preview=true';
$username = get_userdata($post->post_author);
$subject = 'Nou article pendent: "' . $post->post_title . '"';
$message = 'Un nou article per revisar.';
$message .= "\r\n\r\n";
$message .= "Autor: {$username->user_login}\r\n";
$message .= "Títol: {$post->post_title}";
$message .= "\r\n\r\n";
$message .= "Edita: {$edit_link}\r\n";
$message .= "Visualitza: {$preview_link}";
$result = wp_mail($admins, $subject, $message);
} else {
if ($old_status == 'pending' && $new_status == 'publish' && user_can($post->post_author, 'edit_posts') && !user_can($post->post_author, 'publish_posts')) {
$username = get_userdata($post->post_author);
$url = get_permalink($post->ID);
$subject = "El vostre article ha estat publicat:" . " " . $post->post_title;
$message = '"' . $post->post_title . '"' . " ha estat aprovat i publicat. \r\n";
$message .= $url;
$result = wp_mail($username->user_email, $subject, $message);
}
}
}
示例9: appthemes_admin_quick_find_post
/**
* Quick find a post.
* @param object $wp_query A WP_Query object.
* @return void
*/
function appthemes_admin_quick_find_post($wp_query)
{
global $pagenow;
if ('edit.php' !== $pagenow) {
return;
}
if (empty($wp_query->query_vars['s'])) {
return;
}
$query = $wp_query->query_vars['s'];
if ('#' !== substr($query, 0, 1)) {
return;
}
$id = absint(substr($query, 1));
if (!$id) {
$wp_query->query_vars['s'] = 'Bad ID';
}
$post = get_post($id);
if ($post) {
$wp_query->query_vars['s'] = get_edit_post_link($id);
wp_redirect('post.php?action=edit&post=' . $id);
exit;
} else {
$wp_query->query_vars['s'] = 'Not Found';
}
}
示例10: jl_brd_dashboard_recent_drafts
function jl_brd_dashboard_recent_drafts($drafts = false)
{
if (!$drafts) {
$drafts_query = new WP_Query(array('post_type' => 'any', 'post_status' => array('draft', 'pending'), 'posts_per_page' => 150, 'orderby' => 'modified', 'order' => 'DESC'));
$drafts =& $drafts_query->posts;
}
if ($drafts && is_array($drafts)) {
$list = array();
foreach ($drafts as $draft) {
$url = get_edit_post_link($draft->ID);
$title = _draft_or_post_title($draft->ID);
$last_id = get_post_meta($draft->ID, '_edit_last', true);
$last_user = get_userdata($last_id);
$last_modified = '<i>' . esc_html($last_user->display_name) . '</i>';
$item = '<h4><a href="' . $url . '" title="' . sprintf(__('Edit ?%s?'), esc_attr($title)) . '">' . esc_html($title) . '</a>' . '<abbr> ' . $draft->post_status . ' ' . $draft->post_type . '</abbr>' . '<abbr style="display:block;margin-left:0;">' . sprintf(__('Last edited by %1$s on %2$s at %3$s'), $last_modified, mysql2date(get_option('date_format'), $draft->post_modified), mysql2date(get_option('time_format'), $draft->post_modified)) . '</abbr></h4>';
if ($the_content = preg_split('#\\s#', strip_shortcodes(strip_tags($draft->post_content), 11, PREG_SPLIT_NO_EMPTY))) {
$item .= '<p>' . join(' ', array_slice($the_content, 0, 10)) . (10 < count($the_content) ? '…' : '') . '</p>';
}
$list[] = $item;
}
?>
<ul>
<li><?php
echo join("</li>\n<li>", $list);
?>
</li>
</ul>
<?php
} else {
_e('There are no drafts at the moment');
}
}
示例11: render_orphans_row
function render_orphans_row($post, $classes)
{
$classes_string = implode(' ', $classes);
?>
<tr class="<?php
echo $classes_string;
?>
">
<td class="post-title">
<a href="<?php
echo get_edit_post_link($post->ID);
?>
"><?php
echo $post->post_title;
?>
</a>
</td>
<td class="post-is-parent">
<?php
echo $post->stage_children;
?>
</td>
<td class="post-trash">
<input name="post_id" type="hidden" value="<?php
echo $post->ID;
?>
">
<button class="button button-primary button-large">Trash</button>
</td>
</tr>
<?php
}
示例12: buddyblog_get_edit_url
/**
* Get the url of the Post for editing
* @param type $post_id
* @return type
*/
function buddyblog_get_edit_url($post_id = false)
{
$bp = buddypress();
$user_id = get_current_user_id();
if (!$user_id) {
return;
}
if (empty($post_id)) {
$post_id = get_the_ID();
}
//cheeck if current user can edit the post
$post = get_post($post_id);
//if the author of the post is same as the loggedin user or the logged in user is admin
if ($post->post_type != buddyblog_get_posttype()) {
return false;
}
if ($post->post_author != $user_id && !is_super_admin()) {
return;
}
$action_name = 'edit';
if (current_user_can(buddyblog_get_option('dashboard_edit_cap'))) {
return get_edit_post_link($post);
}
//if we are here, we can allow user to edit the post
return bp_core_get_user_domain($post->post_author) . $bp->buddyblog->slug . "/{$action_name}/" . $post->ID . '/';
}
示例13: ajax_redirect
/**
* Perform redirect depending on entity uri and target
*
* @since 3.2.0
*/
public function ajax_redirect()
{
if (!isset($_GET['uri'])) {
wp_die('Entity uri missing');
}
if (!isset($_GET['to'])) {
wp_die('Redirect target missing');
}
// Get the entity uri
$entity_uri = $_GET['uri'];
// Get the redirect target
$target = $_GET['to'];
if (null === ($entity_id = $this->entity_service->get_entity_post_by_uri($entity_uri))) {
wp_die('Entity not found');
}
switch ($target) {
case 'edit':
$redirect_url = get_edit_post_link($entity_id, 'none');
break;
case 'lod':
$redirect_url = self::LOD_ENDPOINT . '/lodview/?IRI=' . urlencode($entity_uri);
break;
case 'permalink':
$redirect_url = get_permalink($entity_id);
break;
default:
wp_die('Unsupported redirect target');
}
// Perform the redirect
wp_safe_redirect($redirect_url);
}
示例14: column_post_title
/** ************************************************************************
* Recommended. This is a custom column method and is responsible for what
* is rendered in any column with a name/slug of 'title'. Every time the class
* needs to render a column, it first looks for a method named
* column_{$column_title} - if it exists, that method is run. If it doesn't
* exist, column_default() is called instead.
*
* This example also illustrates how to implement rollover actions. Actions
* should be an associative array formatted as 'slug'=>'link html' - and you
* will need to generate the URLs yourself. You could even ensure the links
*
*
* @see WP_List_Table::::single_row_columns()
* @param array $item A singular item (one full row's worth of data)
* @return string Text to be placed inside the column <td> (movie title only)
**************************************************************************/
function column_post_title($item)
{
//Build row actions
$actions = array('edit_choices' => sprintf('<a href="#" class="edit-gd-choice-inline" id="edit-gd-choice-inline-%s" data-postid="%s">Edit Choices</a>', $item->ID, $item->ID), 'edit' => sprintf('<a href="%s">Edit Step</a>', get_edit_post_link($item->ID)), 'view' => sprintf('<a href="%s">View Step</a>', get_permalink($item->ID)), 'delete' => sprintf('<a href="?page=%s&action=%s&gd_list_progress_pt[]=%s">Delete</a>', $_REQUEST['page'], 'delete', $item->ID));
//Return the title contents
return sprintf('%1$s %2$s %3$s', '<span class="gd_post_title_editable" data-stepid="' . $item->ID . '">' . $item->post_title . '</span>', $this->row_actions($actions), $this->render_progress_pt_choice_form($item->ID));
}
示例15: render_comment
function render_comment(&$post, &$profile, &$parent)
{
require 'wp-content/language/lang_chooser.php';
//Loads the language-file
global $request;
$comments = "";
$comments .= '<hr />';
// $cctime = date( "g:i A" , strtotime($post->created) );
// $ccdate = date( get_settings('date_format'), strtotime($post->created) );
$ccurl = $request->url_for(array('resource' => 'posts', 'id' => $post->id));
$ccrurl = 'JavaScript:inline_comment(' . $post->id . ',' . $parent->id . ');';
$comments .= '<h4>';
$comments .= ' <span class="meta">';
// $comments .= $cctime.' <em>on</em> '.$ccdate;
$comments .= '<span class="actions">';
$comments .= '<a href="' . $ccurl . '">Permalink</a> | <a rel=\'nofollow\' class=\'comment-reply-link\' href="' . $ccrurl . '">' . $txt['wp_reply'] . '</a>';
if (get_profile_id() == $post->profile_id) {
$comments .= ' | <a href="' . get_edit_post_link($post) . '" class="post-edit-link" rel="' . $post->id . '">' . $txt['wp_Edit'] . '</a>';
$comments .= ' | <a href="' . get_edit_post_link($post, 'remove') . '" class="post-remove-link" rel="' . $post->id . '">' . $txt['wp_remove'] . '</a>';
}
$comments .= '</span>';
$comments .= '<br />';
$comments .= '<img alt=\'image\' src=\'' . profile_get_avatar($profile) . '\' class=\'avatar avatar-32\' height=\'32\' width=\'32\' />';
$comments .= '<a class="nick" href=\'' . base_path(true) . '' . $profile->nickname . '\'>' . $profile->nickname . '</a> ';
$comments .= laconica_time($post->created);
$comments .= '</span>';
$comments .= '</h4>';
$comments .= '<div class="commentcontent" id="commentcontent-' . $post->id . '">';
$comments .= '<p>' . render_notice($post->title, $post, $profile) . '</p>';
$comments .= '</div>';
return $comments;
}