本文整理汇总了PHP中WPSEO_Meta::keyword_usage方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Meta::keyword_usage方法的具体用法?PHP WPSEO_Meta::keyword_usage怎么用?PHP WPSEO_Meta::keyword_usage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Meta
的用法示例。
在下文中一共展示了WPSEO_Meta::keyword_usage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: item_to_response
/**
* Map the posts to a response array
*
* @param WP_Post $item The post for which to build the analyzer data.
*
* @return array
*/
protected function item_to_response($item)
{
$focus_keyword = WPSEO_Meta::get_value('focuskw', $item->ID);
$content = $item->post_content;
/**
* Filter the post content for use in the SEO score recalculation.
*
* @param string $content Content of the post. Modify to reflect front-end content.
* @param WP_Post $item The Post object the content comes from.
*/
$content = apply_filters('wpseo_post_content_for_recalculation', $content, $item);
// Apply shortcodes.
$content = do_shortcode($content);
return array('post_id' => $item->ID, 'text' => $content, 'keyword' => $focus_keyword, 'url' => urldecode($item->post_name), 'pageTitle' => apply_filters('wpseo_title', wpseo_replace_vars($this->get_title($item->ID, $item->post_type), $item)), 'meta' => apply_filters('wpseo_metadesc', wpseo_replace_vars($this->get_meta_description($item->ID, $item->post_type), $item)), 'keyword_usage' => array($focus_keyword => WPSEO_Meta::keyword_usage($focus_keyword, $item->ID)));
}
示例2: get_focus_keyword_usage
/**
* Counting the number of given keyword used for other posts than given post_id
*
* @return array
*/
private function get_focus_keyword_usage()
{
$post = $this->get_metabox_post();
if (is_object($post)) {
$keyword = WPSEO_Meta::get_value('focuskw', $post->ID);
return array($keyword => WPSEO_Meta::keyword_usage($keyword, $post->ID));
}
return array();
}
示例3: post_to_response
/**
* @param WP_Post $post The post for which to build the analyzer data.
*
* @return array
*/
private function post_to_response(WP_Post $post)
{
$focus_keyword = WPSEO_Meta::get_value('focuskw', $post->ID);
return array('post_id' => $post->ID, 'text' => $post->post_content, 'keyword' => $focus_keyword, 'url' => urldecode($post->post_name), 'pageTitle' => apply_filters('wpseo_title', wpseo_replace_vars($this->get_title($post->ID, $post->post_type), $post)), 'meta' => apply_filters('wpseo_metadesc', wpseo_replace_vars($this->get_meta_description($post->ID, $post->post_type), $post)), 'keyword_usage' => array($focus_keyword => WPSEO_Meta::keyword_usage($focus_keyword, $post->ID)));
}
示例4: ajax_get_keyword_usage
/**
* Retrieves the keyword for the keyword doubles.
*/
function ajax_get_keyword_usage()
{
$post_id = filter_input(INPUT_POST, 'post_id');
$keyword = filter_input(INPUT_POST, 'keyword');
wp_die(WPSEO_Utils::json_encode(WPSEO_Meta::keyword_usage($keyword, $post_id)));
}
示例5: ajax_get_keyword_usage
/**
* Retrieves the keyword for the keyword doubles.
*/
function ajax_get_keyword_usage()
{
$post_id = filter_input(INPUT_POST, 'post_id');
$keyword = filter_input(INPUT_POST, 'keyword');
if (!current_user_can('edit_post', $post_id)) {
die('-1');
}
wp_die(wp_json_encode(WPSEO_Meta::keyword_usage($keyword, $post_id)));
}
示例6: get_focus_keyword_usage
/**
* Counting the number of given keyword used for other posts than given post_id
*
* @return array
*/
private function get_focus_keyword_usage()
{
$keyword = WPSEO_Meta::get_value('focuskw', $this->post->ID);
return array($keyword => WPSEO_Meta::keyword_usage($keyword, $this->post->ID));
}