本文整理汇总了PHP中get_post_format_strings函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_format_strings函数的具体用法?PHP get_post_format_strings怎么用?PHP get_post_format_strings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_format_strings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($args)
{
if (is_array($this->post_object_format) && isset($this->post_object_format['format'])) {
$this->post_object_format['format'] = get_post_format_strings();
}
if (!$this->response_format) {
$this->response_format =& $this->post_object_format;
}
parent::__construct($args);
}
开发者ID:popthestack,项目名称:jetpack,代码行数:10,代码来源:class.wpcom-json-api-post-v1-1-endpoint.php
示例2: get_post_formats
function get_post_formats()
{
// deprecated - see separate endpoint. get a list of supported post formats
$all_formats = get_post_format_strings();
$supported = $this->get_theme_support('post-formats');
$supported_formats = array();
if (isset($supported[0])) {
foreach ($supported[0] as $format) {
$supported_formats[$format] = $all_formats[$format];
}
}
return $supported_formats;
}
开发者ID:jrodd32,项目名称:mwux16,代码行数:13,代码来源:class.json-api-site-jetpack-base.php
示例3: A_show_post_formats
function A_show_post_formats($key, $details)
{
$table = maybe_unserialize($details->feed_meta);
echo "<tr>";
echo "<td valign='top' class='heading'>";
echo __('Post format for new posts', 'autoblogtext');
echo "</td>";
echo "<td valign='top' class=''>";
$formats = get_post_format_strings();
echo "<select name='abtble[postformat]' class='field'>";
foreach ($formats as $key => $format) {
echo "<option value='" . $key . "'";
echo $table['postformat'] == $key ? " selected='selected'" : "";
echo ">" . $format . "</option>";
}
echo "</select>" . "<a href='#' class='info' title='" . __('Select the post format the imported posts will have in the blog.', 'autoblogtext') . "'></a>";
echo "</td>";
echo "</tr>\n";
}
开发者ID:hscale,项目名称:webento,代码行数:19,代码来源:post.formats.php
示例4: _get_es_filters_from_args
/**
* Creates an array of ElasticSearch filters based on the post_id and args.
*
* @param int $post_id
* @param array $args
* @uses apply_filters, get_post_types, get_post_format_strings
* @return array
*/
protected function _get_es_filters_from_args($post_id, array $args)
{
$filters = array();
/**
* Filter the terms used to search for Related Posts.
*
* @module related-posts
*
* @since 2.8.0
*
* @param array $args['has_terms'] Array of terms associated to the Related Posts.
* @param string $post_id Post ID of the post for which we are retrieving Related Posts.
*/
$args['has_terms'] = apply_filters('jetpack_relatedposts_filter_has_terms', $args['has_terms'], $post_id);
if (!empty($args['has_terms'])) {
foreach ((array) $args['has_terms'] as $term) {
if (mb_strlen($term->taxonomy)) {
switch ($term->taxonomy) {
case 'post_tag':
$tax_fld = 'tag.slug';
break;
case 'category':
$tax_fld = 'category.slug';
break;
default:
$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
break;
}
$filters[] = array('term' => array($tax_fld => $term->slug));
}
}
}
/**
* Filter the Post Types where we search Related Posts.
*
* @module related-posts
*
* @since 2.8.0
*
* @param array $args['post_type'] Array of Post Types.
* @param string $post_id Post ID of the post for which we are retrieving Related Posts.
*/
$args['post_type'] = apply_filters('jetpack_relatedposts_filter_post_type', $args['post_type'], $post_id);
$valid_post_types = get_post_types();
if (is_array($args['post_type'])) {
$sanitized_post_types = array();
foreach ($args['post_type'] as $pt) {
if (in_array($pt, $valid_post_types)) {
$sanitized_post_types[] = $pt;
}
}
if (!empty($sanitized_post_types)) {
$filters[] = array('terms' => array('post_type' => $sanitized_post_types));
}
} else {
if (in_array($args['post_type'], $valid_post_types) && 'all' != $args['post_type']) {
$filters[] = array('term' => array('post_type' => $args['post_type']));
}
}
/**
* Filter the Post Formats where we search Related Posts.
*
* @module related-posts
*
* @since 3.3.0
*
* @param array $args['post_formats'] Array of Post Formats.
* @param string $post_id Post ID of the post for which we are retrieving Related Posts.
*/
$args['post_formats'] = apply_filters('jetpack_relatedposts_filter_post_formats', $args['post_formats'], $post_id);
$valid_post_formats = get_post_format_strings();
$sanitized_post_formats = array();
foreach ($args['post_formats'] as $pf) {
if (array_key_exists($pf, $valid_post_formats)) {
$sanitized_post_formats[] = $pf;
}
}
if (!empty($sanitized_post_formats)) {
$filters[] = array('terms' => array('post_format' => $sanitized_post_formats));
}
/**
* Filter the date range used to search Related Posts.
*
* @module related-posts
*
* @since 2.8.0
*
* @param array $args['date_range'] Array of a month interval where we search Related Posts.
* @param string $post_id Post ID of the post for which we are retrieving Related Posts.
*/
$args['date_range'] = apply_filters('jetpack_relatedposts_filter_date_range', $args['date_range'], $post_id);
if (is_array($args['date_range']) && !empty($args['date_range'])) {
//.........这里部分代码省略.........
开发者ID:pacificano,项目名称:pacificano,代码行数:101,代码来源:jetpack-related-posts.php
示例5: callback
function callback($path = '', $blog_id = 0)
{
$blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
if (is_wp_error($blog_id)) {
return $blog_id;
}
if (defined('IS_WPCOM') && IS_WPCOM) {
$this->load_theme_functions();
}
// Get a list of supported post formats.
$all_formats = get_post_format_strings();
$supported = get_theme_support('post-formats');
$supported_formats = $response['formats'] = array();
if (isset($supported[0])) {
foreach ($supported[0] as $format) {
$supported_formats[$format] = $all_formats[$format];
}
}
$response['formats'] = (object) $supported_formats;
return $response;
}
开发者ID:rbryerking,项目名称:skillcrush-wordpress,代码行数:21,代码来源:class.wpcom-json-api-get-site-endpoint.php
示例6: render_location_value
function render_location_value($options)
{
// vars
$options = wp_parse_args($options, array('group_id' => 0, 'rule_id' => 0, 'value' => null, 'param' => null));
// vars
$choices = array();
// some case's have the same outcome
if ($options['param'] == "page_parent") {
$options['param'] = "page";
}
switch ($options['param']) {
/*
* Basic
*/
case "post_type":
// all post types except attachment
$exclude = array('attachment');
$choices = acf_get_post_types($exclude);
$choices = acf_get_pretty_post_types($choices);
break;
case "user_type":
global $wp_roles;
$choices = $wp_roles->get_names();
if (is_multisite()) {
$choices['super_admin'] = __('Super Admin');
}
break;
/*
* Post
*/
/*
* Post
*/
case "post":
// get post types
$exclude = array('page', 'attachment');
$post_types = acf_get_post_types($exclude);
// get posts grouped by post type
$groups = acf_get_posts(array('post_type' => $post_types));
if (!empty($groups)) {
foreach (array_keys($groups) as $group_title) {
// vars
$posts = acf_extract_var($groups, $group_title);
// override post data
foreach (array_keys($posts) as $post_id) {
// update
$posts[$post_id] = acf_get_post_title($posts[$post_id]);
}
// append to $choices
$choices[$group_title] = $posts;
}
}
break;
case "post_category":
$terms = acf_get_taxonomy_terms('category');
if (!empty($terms)) {
$choices = array_pop($terms);
}
break;
case "post_format":
$choices = get_post_format_strings();
break;
case "post_status":
$choices = array('publish' => __('Publish', 'acf'), 'pending' => __('Pending Review', 'acf'), 'draft' => __('Draft', 'acf'), 'future' => __('Future', 'acf'), 'private' => __('Private', 'acf'), 'inherit' => __('Revision', 'acf'), 'trash' => __('Trash', 'acf'));
break;
case "post_taxonomy":
$choices = acf_get_taxonomy_terms();
// unset post_format
if (isset($choices['post_format'])) {
unset($choices['post_format']);
}
break;
/*
* Page
*/
/*
* Page
*/
case "page":
// get posts grouped by post type
$groups = acf_get_posts(array('post_type' => 'page'));
if (!empty($groups)) {
foreach (array_keys($groups) as $group_title) {
// vars
$posts = acf_extract_var($groups, $group_title);
// override post data
foreach (array_keys($posts) as $post_id) {
// update
$posts[$post_id] = acf_get_post_title($posts[$post_id]);
}
// append to $choices
$choices = $posts;
}
}
break;
case "page_type":
$choices = array('front_page' => __("Front Page", 'acf'), 'posts_page' => __("Posts Page", 'acf'), 'top_level' => __("Top Level Page (parent of 0)", 'acf'), 'parent' => __("Parent Page (has children)", 'acf'), 'child' => __("Child Page (has parent)", 'acf'));
break;
case "page_parent":
// refer to "page"
//.........这里部分代码省略.........
开发者ID:eea76,项目名称:hammer,代码行数:101,代码来源:field-group.php
示例7: get_theme_support
}
?>
</td>
</tr>
<?php
}
?>
<?php
if (current_theme_supports('post-formats')) {
?>
<?php
$post_formats = get_theme_support('post-formats');
if (is_array($post_formats[0])) {
$formatName = get_post_format_strings();
?>
<tr>
<td style="padding:0 0 10px 0;"><?php
echo __('Post Format', 'wp-autopost');
?>
:</td>
<td style="padding:0 0 10px 0;">
<input type="radio" name="post_format" value="" <?php
if ($config->post_format == '' || $config->post_format == null) {
echo 'checked="true"';
}
?>
/> <?php
echo $formatName['standard'];
?>
开发者ID:jiangwhua15,项目名称:game-content,代码行数:31,代码来源:wp-autopost-tasklist.php
示例8: ajax_acf_location
function ajax_acf_location($options = array())
{
// defaults
$defaults = array('key' => null, 'value' => null, 'param' => null);
// Is AJAX call?
if (isset($_POST['action']) && $_POST['action'] == "acf_location") {
$options = array_merge($defaults, $_POST);
} else {
$options = array_merge($defaults, $options);
}
// some case's have the same outcome
if ($options['param'] == "page_parent") {
$options['param'] = "page";
}
$choices = array();
$optgroup = false;
switch ($options['param']) {
case "post_type":
$choices = get_post_types(array('public' => true));
unset($choices['attachment']);
break;
case "page":
$pages = get_pages(array('numberposts' => -1, 'post_type' => 'page', 'sort_column' => 'menu_order', 'order' => 'ASC', 'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'), 'suppress_filters' => false));
foreach ($pages as $page) {
$title = '';
$ancestors = get_ancestors($page->ID, 'page');
if ($ancestors) {
foreach ($ancestors as $a) {
$title .= '- ';
}
}
$title .= apply_filters('the_title', $page->post_title, $page->ID);
// status
if ($page->post_status != "publish") {
$title .= " ({$page->post_status})";
}
$choices[$page->ID] = $title;
}
break;
case "page_type":
$choices = array('parent' => __("Parent Page", 'acf'), 'child' => __("Child Page", 'acf'));
break;
case "page_template":
$choices = array('default' => __("Default Template", 'acf'));
$templates = get_page_templates();
foreach ($templates as $k => $v) {
$choices[$v] = $k;
}
break;
case "post":
$posts = get_posts(array('numberposts' => '-1', 'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'), 'suppress_filters' => false));
foreach ($posts as $post) {
$title = apply_filters('the_title', $post->post_title, $post->ID);
// status
if ($post->post_status != "publish") {
$title .= " ({$post->post_status})";
}
$choices[$post->ID] = $title;
}
break;
case "post_category":
$category_ids = get_all_category_ids();
foreach ($category_ids as $cat_id) {
$cat_name = get_cat_name($cat_id);
$choices[$cat_id] = $cat_name;
}
break;
case "post_format":
$choices = get_post_format_strings();
break;
case "user_type":
global $wp_roles;
$choices = $wp_roles->get_names();
break;
case "options_page":
$choices = array(__('Options', 'acf') => __('Options', 'acf'));
$custom = apply_filters('acf_register_options_page', array());
if (!empty($custom)) {
$choices = array();
foreach ($custom as $c) {
$choices[$c['slug']] = $c['title'];
}
}
break;
case "taxonomy":
$choices = $this->parent->get_taxonomies_for_select(array('simple_value' => true));
$optgroup = true;
break;
case "ef_taxonomy":
$choices = array('all' => __('All', 'acf'));
$taxonomies = get_taxonomies(array('public' => true), 'objects');
foreach ($taxonomies as $taxonomy) {
$choices[$taxonomy->name] = $taxonomy->labels->name;
}
// unset post_format (why is this a public taxonomy?)
if (isset($choices['post_format'])) {
unset($choices['post_format']);
}
break;
case "ef_user":
//.........这里部分代码省略.........
开发者ID:robjcordes,项目名称:nexnewwp,代码行数:101,代码来源:field_group.php
示例9: inline_edit
//.........这里部分代码省略.........
_e('Not Sticky');
?>
</option>
</select>
</label>
<?php
} else {
// $bulk
?>
<label class="alignleft">
<input type="checkbox" name="sticky" value="sticky" />
<span class="checkbox-title"><?php
_e('Make this post sticky');
?>
</span>
</label>
<?php
}
// $bulk
?>
<?php
}
// 'post' && $can_publish && current_user_can( 'edit_others_cap' )
?>
</div>
<?php
if ($bulk && post_type_supports($screen->post_type, 'post-formats')) {
$all_post_formats = get_post_format_strings();
?>
<label class="alignleft" for="post_format">
<span class="title"><?php
_ex('Format', 'post format');
?>
</span>
<select name="post_format">
<option value="-1"><?php
_e('— No Change —');
?>
</option>
<?php
foreach ($all_post_formats as $slug => $format) {
?>
<option value="<?php
echo esc_attr($slug);
?>
"><?php
echo esc_html($format);
?>
</option>
<?php
}
?>
</select></label>
<?php
}
?>
</div></fieldset>
<?php
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:67,代码来源:class-wp-posts-list-table.php
示例10: ajax_render_location
function ajax_render_location($options = array())
{
// defaults
$defaults = array('group_id' => 0, 'rule_id' => 0, 'value' => null, 'param' => null);
$is_ajax = false;
if (isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'acf_nonce')) {
$is_ajax = true;
}
// Is AJAX call?
if ($is_ajax) {
$options = array_merge($defaults, $_POST);
} else {
$options = array_merge($defaults, $options);
}
// vars
$choices = array();
// some case's have the same outcome
if ($options['param'] == "page_parent") {
$options['param'] = "page";
}
switch ($options['param']) {
case "post_type":
// all post types except attachment
$choices = apply_filters('acf/get_post_types', array(), array('attachment'));
break;
case "page":
$post_type = 'page';
$posts = get_posts(array('posts_per_page' => -1, 'post_type' => $post_type, 'orderby' => 'menu_order title', 'order' => 'ASC', 'post_status' => 'any', 'suppress_filters' => false, 'update_post_meta_cache' => false));
if ($posts) {
// sort into hierachial order!
if (is_post_type_hierarchical($post_type)) {
$posts = get_page_children(0, $posts);
}
foreach ($posts as $page) {
$title = '';
$ancestors = get_ancestors($page->ID, 'page');
if ($ancestors) {
foreach ($ancestors as $a) {
$title .= '- ';
}
}
$title .= apply_filters('the_title', $page->post_title, $page->ID);
// status
if ($page->post_status != "publish") {
$title .= " ({$page->post_status})";
}
$choices[$page->ID] = $title;
}
// foreach($pages as $page)
}
break;
case "page_type":
$choices = array('front_page' => __("Front Page", 'acf'), 'posts_page' => __("Posts Page", 'acf'), 'top_level' => __("Top Level Page (parent of 0)", 'acf'), 'parent' => __("Parent Page (has children)", 'acf'), 'child' => __("Child Page (has parent)", 'acf'));
break;
case "page_template":
$choices = array('default' => __("Default Template", 'acf'));
$templates = get_page_templates();
foreach ($templates as $k => $v) {
$choices[$v] = $k;
}
break;
case "post":
$post_types = get_post_types();
unset($post_types['page'], $post_types['attachment'], $post_types['revision'], $post_types['nav_menu_item'], $post_types['acf']);
if ($post_types) {
foreach ($post_types as $post_type) {
$posts = get_posts(array('numberposts' => '-1', 'post_type' => $post_type, 'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'), 'suppress_filters' => false));
if ($posts) {
$choices[$post_type] = array();
foreach ($posts as $post) {
$title = apply_filters('the_title', $post->post_title, $post->ID);
// status
if ($post->post_status != "publish") {
$title .= " ({$post->post_status})";
}
$choices[$post_type][$post->ID] = $title;
}
// foreach($posts as $post)
}
// if( $posts )
}
// foreach( $post_types as $post_type )
}
// if( $post_types )
break;
case "post_category":
$category_ids = get_all_category_ids();
foreach ($category_ids as $cat_id) {
$cat_name = get_cat_name($cat_id);
$choices[$cat_id] = $cat_name;
}
break;
case "post_format":
$choices = get_post_format_strings();
break;
case "post_status":
$choices = array('publish' => __('Publish', 'acf'), 'pending' => __('Pending Review', 'acf'), 'draft' => __('Draft', 'acf'), 'future' => __('Future', 'acf'), 'private' => __('Private', 'acf'), 'inherit' => __('Revision', 'acf'), 'trash' => __('Trash', 'acf'));
break;
case "user_type":
global $wp_roles;
//.........这里部分代码省略.........
开发者ID:bsfignoni,项目名称:revistafilm,代码行数:101,代码来源:field_group.php
示例11: esc_attr_e
<ul class="clearfix">
<li class="post-format-pad"><a title="<?php
esc_attr_e('Standard', 'church-event');
?>
" href="<?php
echo esc_attr(add_query_arg('format_filter', 'standard', home_url()));
?>
" class="standard"><?php
echo do_shortcode('[icon name="' . WpvPostFormats::get_post_format_icon('standard') . '"]');
?>
</a></li>
<?php
$tooltip = empty($instance['tooltip']) ? __('View all %format posts', 'church-event') : esc_attr($instance['tooltip']);
foreach (get_post_format_strings() as $slug => $string) {
if (get_post_format_link($slug)) {
$post_format = get_term_by('slug', 'post-format-' . $slug, 'post_format');
if ($post_format->count > 0) {
echo '<li class="post-format-pad"><a title="' . esc_attr(str_replace('%format', $string, $tooltip)) . '" href="' . esc_attr(add_query_arg('format_filter', $slug, home_url())) . '" class="' . $slug . '">' . do_shortcode('[icon name="' . WpvPostFormats::get_post_format_icon($slug) . '"]') . '</a></li>';
}
}
}
?>
</ul>
开发者ID:petrfaitl,项目名称:wordpress-event-theme,代码行数:23,代码来源:post-formats.php
示例12: wp_getPostFormats
/**
* Retrieves a list of post formats used by the site.
*
* @since 3.1.0
*
* @param array $args {
* Method arguments. Note: arguments must be ordered as documented.
*
* @type int $blog_id (unused)
* @type string $username
* @type string $password
* }
* @return array|IXR_Error List of post formats, otherwise IXR_Error object.
*/
public function wp_getPostFormats($args)
{
$this->escape($args);
$username = $args[1];
$password = $args[2];
if (!($user = $this->login($username, $password))) {
return $this->error;
}
if (!current_user_can('edit_posts')) {
return new IXR_Error(403, __('You are not allowed access to details about this site.'));
}
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action('xmlrpc_call', 'wp.getPostFormats');
$formats = get_post_format_strings();
// find out if they want a list of currently supports formats
if (isset($args[3]) && is_array($args[3])) {
if ($args[3]['show-supported']) {
if (current_theme_supports('post-formats')) {
$supported = get_theme_support('post-formats');
$data = array();
$data['all'] = $formats;
$data['supported'] = $supported[0];
$formats = $data;
}
}
}
return $formats;
}
开发者ID:kadrim1,项目名称:metsayhistu,代码行数:42,代码来源:class-wp-xmlrpc-server.php
示例13: default_content_filter
/**
* Try to make a nice comment
*
* @param string $context the comment-content
* @param string $contents the HTML of the source
* @param string $target the target URL
* @param string $source the source URL
*
* @return string the filtered content
*/
public static function default_content_filter($content, $contents, $target, $source)
{
// get post format
$post_ID = url_to_postid($target);
$post_format = get_post_format($post_ID);
// replace "standard" with "Article"
if (!$post_format || 'standard' == $post_format) {
$post_format = 'Article';
} else {
$post_formatstrings = get_post_format_strings();
// get the "nice" name
$post_format = $post_formatstrings[$post_format];
}
$host = parse_url($source, PHP_URL_HOST);
// strip leading www, if any
$host = preg_replace('/^www\\./', '', $host);
// generate default text
$content = sprintf(__('This %s was mentioned on <a href="%s">%s</a>', 'webmention'), $post_format, esc_url($source), $host);
return $content;
}
开发者ID:petermolnar,项目名称:wordpress-webmention,代码行数:30,代码来源:webmention.php
示例14: page_selectors
public static function page_selectors()
{
global $wp_post_types, $wp_taxonomies;
$res = q2w3_include_obj::page_selectors();
foreach ($wp_post_types as $post_type) {
if (!in_array($post_type->name, q2w3_inc_manager::$restricted_post_types)) {
$res += array($post_type->name . '_all' => __('All', q2w3_inc_manager::ID) . ' ' . $post_type->labels->name);
$res += array('post_type_archive_' . $post_type->name => __('Archive', q2w3_inc_manager::ID) . ': ' . $post_type->labels->name);
$selectors = self::select_post_type($post_type->name);
if (!empty($selectors)) {
$res += $selectors;
}
}
}
foreach ($wp_taxonomies as $taxonomy) {
if (!in_array($taxonomy->name, q2w3_inc_manager::$restricted_taxonomies)) {
$res += array($taxonomy->name . '_all' => __('All', q2w3_inc_manager::ID) . ' ' . $taxonomy->labels->name);
$selectors = self::select_taxonomy($taxonomy->name);
if (!empty($selectors)) {
$res += $selectors;
}
}
}
$formats_orig = get_post_format_strings();
foreach ($formats_orig as $fkey => $fname) {
$res['post_format_' . $fkey] = __('PF', $plugin_id) . ': ' . $fname;
}
return $res;
}
开发者ID:davidHuanghw,项目名称:david_blog,代码行数:29,代码来源:q2w3_table_func.php
示例15: get_post_format_slugs
function get_post_format_slugs()
{
$slugs = array_keys(get_post_format_strings());
return array_combine($slugs, $slugs);
}
开发者ID:AppItNetwork,项目名称:yii2-wordpress-themes,代码行数:5,代码来源:post-formats.php
示例16: WPCOM_JSON_API_Update_Post_Endpoint
"id" : 123,
"key" : "test_meta_key",
"value" : "test_value",
}
},
"meta": {
"links": {
"self": "https:\\/\\/public-api.wordpress.com\\/rest\\/v1\\/sites\\/30434183\\/posts\\/1270",
"help": "https:\\/\\/public-api.wordpress.com\\/rest\\/v1\\/sites\\/30434183\\/posts\\/1270\\/help",
"site": "https:\\/\\/public-api.wordpress.com\\/rest\\/v1\\/sites\\/30434183",
"replies": "https:\\/\\/public-api.wordpress.com\\/rest\\/v1\\/sites\\/30434183\\/posts\\/1270\\/replies\\/",
"likes": "https:\\/\\/public-api.wordpress.com\\/rest\\/v1\\/sites\\/30434183\\/posts\\/1270\\/likes\\/"
}
}
}'));
new WPCOM_JSON_API_Update_Post_Endpoint(array('description' => 'Edit a Post', 'group' => 'posts', 'stat' => 'posts:1:POST', 'method' => 'POST', 'path' => '/sites/%s/posts/%d', 'path_labels' => array('$site' => '(int|string) The site ID, The site domain', '$post_ID' => '(int) The post ID'), 'request_format' => array('date' => "(ISO 8601 datetime) The post's creation time.", 'title' => '(HTML) The post title.', 'content' => '(HTML) The post content.', 'excerpt' => '(HTML) An optional post excerpt.', 'slug' => '(string) The name (slug) for the post, used in URLs.', 'author' => '(string) The username or ID for the user to assign the post to.', 'publicize' => '(array|bool) True or false if the post be publicized to external services. An array of services if we only want to publicize to a select few. Defaults to true.', 'publicize_message' => '(string) Custom message to be publicized to external services.', 'status' => array('publish' => 'Publish the post.', 'private' => 'Privately publish the post.', 'draft' => 'Save the post as a draft.', 'pending' => 'Mark the post as pending editorial approval.'), 'sticky' => '(bool) Mark the post as sticky?', 'password' => '(string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.', 'parent' => "(int) The post ID of the new post's parent.", 'categories' => "(string) Comma separated list of categories (name or id)", 'tags' => "(string) Comma separated list of tags (name or id)", 'format' => get_post_format_strings(), 'comments_open' => '(bool) Should the post be open to comments?', 'pings_open' => '(bool) Should the post be open to comments?', 'likes_enabled' => "(bool) Should the post be open to likes?", 'sharing_enabled' => "(bool) Should sharing buttons show on this post?", 'gplusauthorship_enabled' => "(bool) Should a Google+ account be associated with this post?", 'featured_image' => "(string) The post ID of an existing attachment to set as the featured image. Pass an empty string to delete the existing image.", 'media' => "(media) An array of images to attach to the post. To upload media, the entire request should be multipart/form-data encoded. Multiple media items will be displayed in a gallery. Accepts images (image/gif, image/jpeg, image/png) only.<br /><br /><strong>Example</strong>:<br />" . "<code>curl \\<br />--form 'title=Image' \\<br />--form 'media[]=@/path/to/file.jpg' \\<br />-H 'Authorization: BEARER your-token' \\<br />'https://public-api.wordpress.com/rest/v1/sites/123/posts/new'</code>", 'media_urls' => "(array) An array of URLs for images to attach to the post. Sideloads the media in for the post.", 'metadata' => "(array) Array of metadata objects containing the following properties: `key` (metadata key), `id` (meta ID), `previous_value` (if set, the action will only occur for the provided previous value), `value` (the new value to set the meta to), `operation` (the operation to perform: `update` or `add`; defaults to `update`). All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are available for authenticated requests with proper capabilities. Protected meta keys can be made available with the <code>rest_api_allowed_public_metadata</code> filter."), 'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/30434183/posts/1222/', 'example_request_data' => array('headers' => array('authorization' => 'Bearer YOUR_API_TOKEN'), 'body' => array('title' => 'Hello World (Again)', 'content' => 'Hello. I am an edited post. I was edited by the API', 'tags' => 'tests', 'categories' => 'API')), 'example_response' => '
{
"ID": 1222,
"author": {
"ID": 422,
"email": false,
"name": "Justin Shreve",
"URL": "http:\\/\\/justin.wordpress.com",
"avatar_URL": "http:\\/\\/1.gravatar.com\\/avatar\\/9ea5b460afb2859968095ad3afe4804b?s=96&d=identicon&r=G",
"profile_URL": "http:\\/\\/en.gravatar.com\\/justin"
},
"date": "2012-04-11T15:53:52+00:00",
"modified": "2012-04-11T19:44:35+00:00",
"title": "Hello World (Again)",
"URL": "http:\\/\\/opossumapi.wordpress.com\\/2012\\/04\\/11\\/hello-world-2\\/",
"short_URL": "http:\\/\\/wp.me\\/p23HjV-jI",
开发者ID:lokenxo,项目名称:familygenerator,代码行数:31,代码来源:json-endpoints.php
示例17: _get_es_filters_from_args
/**
* Creates an array of ElasticSearch filters based on the post_id and args.
*
* @param int $post_id
* @param array $args
* @uses apply_filters, get_post_types, get_post_format_strings
* @return array
*/
protected function _get_es_filters_from_args($post_id, array $args)
{
$filters = array();
$args['has_terms'] = apply_filters('jetpack_relatedposts_filter_has_terms', $args['has_terms'], $post_id);
if (!empty($args['has_terms'])) {
foreach ((array) $args['has_terms'] as $term) {
if (mb_strlen($term->taxonomy)) {
switch ($term->taxonomy) {
case 'post_tag':
$tax_fld = 'tag.slug';
break;
case 'category':
$tax_fld = 'category.slug';
break;
default:
$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
break;
}
$filters[] = array('term' => array($tax_fld => $term->slug));
}
}
}
$args['post_type'] = apply_filters('jetpack_relatedposts_filter_post_type', $args['post_type'], $post_id);
$valid_post_types = get_post_types();
if (is_array($args['post_type'])) {
$sanitized_post_types = array();
foreach ($args['post_type'] as $pt) {
if (in_array($pt, $valid_post_types)) {
$sanitized_post_types[] = $pt;
}
}
if (!empty($sanitized_post_types)) {
$filters[] = array('terms' => array('post_type' => $sanitized_post_types));
}
} else {
if (in_array($args['post_type'], $valid_post_types) && 'all' != $args['post_type']) {
$filters[] = array('term' => array('post_type' => $args['post_type']));
}
}
$args['post_formats'] = apply_filters('jetpack_relatedposts_filter_post_formats', $args['post_formats'], $post_id);
$valid_post_formats = get_post_format_strings();
$sanitized_post_formats = array();
foreach ($args['post_formats'] as $pf) {
if (array_key_exists($pf, $valid_post_formats)) {
$sanitized_post_formats[] = $pf;
}
}
if (!empty($sanitized_post_formats)) {
$filters[] = array('terms' => array('post_format' => $sanitized_post_formats));
}
$args['date_range'] = apply_filters('jetpack_relatedposts_filter_date_range', $args['date_range'], $post_id);
if (is_array($args['date_range']) && !empty($args['date_range'])) {
$args['date_range'] = array_map('intval', $args['date_range']);
if (!empty($args['date_range']['from']) && !empty($args['date_range']['to'])) {
$filters[] = array('range' => array('date_gmt' => $this->_get_coalesced_range($args['date_range'])));
}
}
$args['exclude_post_ids'] = apply_filters('jetpack_relatedposts_filter_exclude_post_ids', $args['exclude_post_ids'], $post_id);
if (!empty($args['exclude_post_ids']) && is_array($args['exclude_post_ids'])) {
foreach ($args['exclude_post_ids'] as $exclude_post_id) {
$exclude_post_id = (int) $exclude_post_id;
if ($exclude_post_id > 0) {
$filters[] = array('not' => array('term' => array('post_id' => $exclude_post_id)));
}
}
}
return $filters;
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:76,代码来源:jetpack-related-posts.php
示例18: comment_text_excerpt
public static function comment_text_excerpt($text, $comment = null, $args = array())
{
// only change text for pingbacks/trackbacks/webmentions
if (!$comment || '' === $comment->comment_type || !get_comment_meta($comment->comment_ID, 'semantic_linkbacks_canonical', true)) {
return $text;
}
// check comment type
$comment_type = get_comment_meta($comment->comment_ID, 'semantic_linkbacks_type', true);
if (!$comment_type || !in_array($comment_type, array_keys(SemanticLinkbacksPlugin::get_comment_type_strings()))) {
$comment_type = 'mention';
}
$_kind = get_the_terms($comment->comment_post_ID, 'kind');
if (!empty($_kind)) {
$kind = array_shift($_kind);
$kindstrings = self::get_strings();
$post_format = $kindstrings[$kind->slug];
} else {
$post_format = get_post_format($comment->comment_post_ID);
// replace "standard" with "Article"
if (!$post_format || 'standard' === $post_format) {
$post_format = 'Article';
} else {
$post_formatstrings = get_post_format_strings();
// get the "nice" name
|
请发表评论