本文整理汇总了PHP中url_to_postid函数的典型用法代码示例。如果您正苦于以下问题:PHP url_to_postid函数的具体用法?PHP url_to_postid怎么用?PHP url_to_postid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了url_to_postid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: cap_redirect_short_urls
/**
* This function handles the actual redirection to the target.
*/
function cap_redirect_short_urls()
{
global $post;
if (is_singular('cap_short_urls')) {
// Check for the existance of legacy url information. Lead with that if present.
if (get_post_meta($post->ID, 'legacy_url_redirect_target', true)) {
$legacy_url = get_post_meta($post->ID, 'legacy_url_redirect_target', true);
// Let's get the actual domain from the legacy url...
$parse = parse_url($legacy_url);
$domain = $parse['host'];
// ... if it is thinkprogress.org then proceed with idenfication of the post targeted. Otherwise just do a straight up redirect.
if ('thinkprogress.org' === $domain || 'www.thinkprogress.org' === $domain) {
// We could probably just get away with passing the old url in however... we want to make sure that if in the future the target posts permalink is changed then this short url will still work. So to that end we're going to use url_to_postid() to get the ID of the target post to past into get_permalink().
$post_id = url_to_postid($legacy_url);
$target = get_permalink($post_id);
// This will add the ID of the short url post to the target post so that the get_shortlink function will work. It will only do so once bc it checks for unique existence.
add_post_meta($post_id, 'post_short_url_target', '' . $post->ID . '', true);
} else {
$target = $legacy_url;
}
} elseif (get_post_meta($post->ID, 'url_redirect_target', true)) {
$target = get_post_meta($post->ID, 'url_redirect_target', true);
} elseif (get_post_meta($post->ID, 'post_redirect_target', true)) {
$target = get_permalink(get_post_meta($post->ID, 'post_redirect_target', true));
} else {
$target = get_bloginfo('url');
}
wp_redirect($target);
exit;
echo '<!--Short URL Away-->';
}
}
开发者ID:amprog,项目名称:cap-short-urls,代码行数:35,代码来源:cap-url-shortener.php
示例2: get_top_pages
public static function get_top_pages($range = 7, $amount = 20, $post_type = 'post')
{
$cache_key = $post_type . '-' . $range . '-' . $amount;
if (false === ($posts = self::get_cache_value($cache_key, 'piwik_most_viewed'))) {
$parameters = array('period' => 'range', 'date' => date('Y-m-d', strtotime('-' . $range . ' day')) . ',' . date('Y-m-d', strtotime('+1 day')), 'flat' => 1, 'filter_limit' => $amount + 20, 'filter_sort_order' => 'DESC', 'filter_sort_column' => 'nb_hits');
$data = self::request('Actions.getPageUrls', $parameters);
$posts = array();
if (!is_wp_error($data) && !is_object($data)) {
foreach ($data as $item) {
$post_id = url_to_postid($item['url']);
if ($post_id) {
$post = get_post($post_id);
if ($post->post_type == $post_type) {
$posts[] = $post_id;
}
}
if (count($posts) >= $amount) {
break;
}
}
}
self::set_cache_value($cache_key, $posts, 'piwik_most_viewed', self::$timeout);
}
return $posts;
}
开发者ID:markoheijnen,项目名称:wp-piwik-more-stats,代码行数:25,代码来源:api.php
示例3: get_entries
function get_entries($process_comment_func = NULL)
{
if (function_exists('set_magic_quotes_runtime')) {
set_magic_quotes_runtime(0);
}
$xml = simplexml_load_file('compress.zlib://' . $this->file);
// simple "are we a disqus export?" check
if (!$xml || $xml->getName() !== 'disqus') {
return false;
}
foreach ($xml->thread as $thread) {
$attributes = $thread->attributes('dsq', true);
$threadid = (int) $attributes['id'];
$link = (string) $thread->link;
if (empty($this->thread_to_post_id[$threadid])) {
if (trailingslashit($link) == trailingslashit(get_option('siteurl'))) {
$this->thread_to_post_id[$threadid] = (int) get_option('page_on_front');
} else {
$this->thread_to_post_id[$threadid] = url_to_postid($link);
// echo "<li>URL to postid: <code>", $link, "</code> - <code>", $this->thread_to_post_id[$threadid], "</code></li>";
}
}
}
if ($process_comment_func) {
foreach ($xml->post as $comment) {
call_user_func($process_comment_func, $comment);
}
}
return true;
}
开发者ID:kemayo,项目名称:wp-disqus-importer,代码行数:30,代码来源:disqus-importer.php
示例4: build
/**
* Build object from posts
*
* @param String $posts of HTML to parse
*
* @return Mixed collection of posts
*/
public static function build($posts)
{
$collection = [];
$document = new \DOMDocument();
$document->loadHTML($posts);
$iterator = 0;
$articles = $document->getElementsByTagName("li");
foreach ($articles as $article) {
$post = new \StdClass();
$links = $article->getElementsByTagName("a");
$images = $article->getElementsByTagName("img");
$excerpts = $article->getElementsByTagName("small");
foreach ($links as $link) {
if (0 == $iterator % 2) {
$iterator++;
continue;
}
$iterator++;
$post->link = $link->getAttributeNode('href')->value;
$post->title = $link->textContent;
$post->category = get_the_category(url_to_postid($post->link))[0]->name;
}
foreach ($images as $image) {
$post->image = $image->getAttributeNode('src')->value;
}
foreach ($excerpts as $excerpt) {
$post->excerpt = $excerpt->textContent;
}
$collection[] = $post;
}
return $collection;
}
开发者ID:jsoningram,项目名称:offgrid-framework,代码行数:39,代码来源:FactoryRelated.php
示例5: _getPostIdsByConfig
protected static function _getPostIdsByConfig($key, $type)
{
if (!$key) {
$key = self::getCurrentPageKey();
}
$cid = $key . $type;
if (isset(self::$idsCache[$cid])) {
return self::$idsCache[$cid];
}
$option = self::getOption($key);
if (!isset($option[$type]) || !$option[$type]) {
return array();
}
$post_ids = array();
date_default_timezone_set('America/Sao_Paulo');
/*Realiza busca de posts no vetor de posts destacados*/
foreach ($option[$type] as $post) {
/*Não exibe posts expirados*/
if ($post['data_expiracao'] == "" || !(strtotime($post['data_expiracao']) < strtotime(date('d/m/Y H:i', time())))) {
$url = trim($post['url']);
$post_id = url_to_postid($url);
if ($post_id) {
$post_ids[] = $post_id;
}
}
}
self::$idsCache[$cid] = $post_ids;
return $post_ids;
}
开发者ID:hacklabr,项目名称:cultural,代码行数:29,代码来源:destaques.php
示例6: heib_get_post
function heib_get_post()
{
global $heib__Response;
if (!is_null($heib__Response) && is_a($heib__Response, 'HEIBResponse')) {
$query = $heib__Response->query();
$contextUrl = isset($query['contextUrl']) ? $query['contextUrl'] : '';
$contextUrl = stripslashes($contextUrl);
if ($contextUrl !== '') {
if ($postId = url_to_postid($contextUrl)) {
$post = get_post($postId);
//setup the current post
setup_postdata($GLOBALS['post'] =& $post);
return $post;
}
} else {
//no contextUrl is provide, return a random post a example
$post = query_posts('orderby=rand&showposts=1');
if ($post) {
//setup the current post
setup_postdata($GLOBALS['post'] =& $post[0]);
}
return $post ? $post[0] : null;
}
}
//no post found
return null;
}
开发者ID:hungtran0203,项目名称:he-ib,代码行数:27,代码来源:post.php
示例7: check_for_cache
function check_for_cache()
{
if (isset($_GET['force_skip_caching'])) {
return;
}
// only for is_single()
$postID = url_to_postid("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
if (is_numeric($postID) == false) {
return;
}
$cacheDirectory = dirname(__FILE__) . "/files/";
if (file_exists($cacheDirectory . "{$postID}.html") == true) {
$postContent = file_get_contents($cacheDirectory . "{$postID}.html");
echo $postContent;
exit;
} else {
$url = get_site_url() . "?p={$postID}&force_skip_caching=true";
try {
$postContent = $this->doFetchUrl($url);
$cacheFile = fopen($cacheDirectory . "{$postID}.html", "w");
fwrite($cacheFile, $postContent);
$this->doRedirect($cacheDirectory, $postID);
} catch (Exception $e) {
return;
}
}
}
开发者ID:MythicAngel,项目名称:Wordpress-Solutions,代码行数:27,代码来源:index.php
示例8: redirect
public function redirect()
{
// Keyword to check for in URL
$keyword = urlencode(WPUltimateRecipe::option('print_template_keyword', 'print'));
if (strlen($keyword) <= 0) {
$keyword = 'print';
}
// Current URL
$schema = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
$url = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// Check if URL ends with /print
preg_match("/^(.*?)\\/{$keyword}()\$/", $url, $url_data);
if (empty($url_data)) {
// Check if URL ends with /print/parameters
preg_match("/^(.*?)\\/{$keyword}\\/(.*?)\$/", $url, $url_data);
}
if (isset($url_data[1])) {
$post_id = url_to_postid($url_data[1]);
$post = get_post($post_id);
if ($post_id == 0) {
// Check for plain permalinks
$slug = substr(strrchr($url_data[1], '='), 1);
if ($slug) {
$post = get_page_by_path($slug, OBJECT, WPURP_POST_TYPE);
}
}
if ($post && $post->post_type == WPURP_POST_TYPE) {
$recipe = new WPURP_Recipe($post);
$this->print_recipe($recipe, $url_data[2]);
exit;
}
}
}
开发者ID:robertoperata,项目名称:bbqverona.com,代码行数:33,代码来源:print.php
示例9: Record_User_Event
function Record_User_Event()
{
$Path = ABSPATH . 'wp-load.php';
include_once $Path;
global $wpdb;
global $ewd_feup_user_events_table_name;
$User_ID = $_POST['User_ID'];
$Event_Value = $_POST['Target'];
$Event_Location = $_POST['Location'];
$Event_Location_ID = url_to_postid($Event_Location);
if ($Event_Location_ID != 0) {
$Event_Location_Title = get_the_title($Event_Location_ID);
} else {
$Event_Location_Title = $Event_Location;
}
$Event_Type = Get_Event_Type($Event_Value);
$Event_Target_ID = url_to_postid($Event_Value);
if ($Event_Target_ID == 0) {
$Event_Target_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid=%s", $Event_Value));
}
if ($Event_Target_ID != 0) {
$Event_Target_Title = get_the_title($Event_Target_ID);
} else {
$Event_Target_Title = $Event_Value;
}
Add_User_Event($User_ID, $Event_Type, $Event_Location, $Event_Location_ID, $Event_Location_Title, $Event_Value, $Event_Target_ID, $Event_Target_Title);
}
开发者ID:otkinsey,项目名称:wp-nsds,代码行数:27,代码来源:Process_Ajax.php
示例10: get_oembed_response
/**
* Callback for our API endpoint.
*
* Returns the JSON object for the post.
*
* @param WP_REST_Request $request Full details about the request.
*
* @return WP_Error|WP_REST_Response
*/
public function get_oembed_response(WP_REST_Request $request)
{
$post_id = url_to_postid($request['url']);
/**
* Filter the determined post id.
*
* @param int $post_id The post ID.
* @param string $url The requestd URL.
*/
$post_id = apply_filters('rest_oembed_request_post_id', $post_id, $request['url']);
if (0 === $post_id) {
return new WP_Error('rest_oembed_invalid_url', __('Invalid URL.', 'oembed-api'), array('status' => 404));
}
// Todo: Perhaps just default to json if something invalid is provided.
if (!in_array($request['format'], array('json', 'xml'))) {
return new WP_Error('rest_oembed_invalid_format', __('Invalid format.', 'oembed-api'), array('status' => 501));
}
/**
* Current post object.
*
* @var WP_Post $post
*/
$post = get_post($post_id);
/**
* User object for the post author.
*
* @var WP_User $author
*/
$author = get_userdata($post->post_author);
/**
* Filter the allowed minimum width for the oEmbed response.
*
* @param int $width The minimum width. Defaults to 200.
*/
$minwidth = apply_filters('rest_oembed_minwidth', 200);
/**
* Filter the allowed maximum width for the oEmbed response.
*
* @param int $width The maximum width. Defaults to 600.
*/
$maxwidth = apply_filters('rest_oembed_maxwidth', 600);
$width = $request['maxwidth'];
if ($width < $minwidth) {
$width = $minwidth;
} else {
if ($width > $maxwidth) {
$width = $maxwidth;
}
}
// Todo: this shouldn't be hardcoded.
$height = ceil($width / 16 * 9);
/**
* Filters the oEmbed response data.
*
* @param array $data The response data.
*/
$data = apply_filters('rest_oembed_response_data', array('version' => '1.0', 'provider_name' => get_bloginfo('name'), 'provider_url' => get_home_url(), 'author_name' => $author->display_name, 'author_url' => get_author_posts_url($author->ID, $author->user_nicename), 'title' => $post->post_title, 'type' => 'rich', 'width' => $width, 'height' => $height, 'html' => get_post_embed_html($post, $width, $height)));
return $data;
}
开发者ID:pfefferle,项目名称:oEmbed-API,代码行数:68,代码来源:endpoint.php
示例11: url_to_blog_card_tag
function url_to_blog_card_tag($url)
{
if (!$url) {
return;
}
$url = strip_tags($url);
//URL
$id = url_to_postid($url);
//IDを取得(URLから投稿ID変換)
if (!$id) {
return;
}
//IDを取得できない場合はループを飛ばす
global $post;
$post_id = get_post($id);
setup_postdata($post_id);
$exce = $post_id->post_excerpt;
$title = $post_id->post_title;
//タイトルの取得
$date = mysql2date('Y-m-d H:i', $post_id->post_date);
//投稿日の取得
$excerpt = get_content_excerpt($post_id->post_content, get_excerpt_length());
//抜粋の取得
if (is_wordpress_excerpt() && $exce) {
//Wordpress固有の抜粋のとき
$excerpt = $exce;
}
//新しいタブで開く場合
$target = is_blog_card_target_blank() ? ' target="_blank"' : '';
//$hatebu_url = preg_replace('/^https?:\/\//i', '', $url);
//はてブを表示する場合
$hatebu_tag = is_blog_card_hatena_visible() ? '<div class="blog-card-hatebu"><a href="//b.hatena.ne.jp/entry/' . $url . '"' . $target . '><img src="//b.hatena.ne.jp/entry/image/' . $url . '" alt="はてブ数" /></a></div>' : '';
//サイトロゴを表示する場合
$favicon_tag = '';
if (is_favicon_enable() && get_the_favicon_url()) {
//ファビコンが有効か確認
//ファビコンをイメージたいのでそのまま表示する
//$favicon_tag = '<span class="blog-card-favicon"><img src="'.get_the_favicon_url().'" class="blog-card-favicon-img" alt="ファビコン" /></span>';
//はてなファビコンAPIを利用する
//$favicon_tag = '<span class="blog-card-favicon"><img src="http://favicon.st-hatena.com/?url='.site_url().'" class="blog-card-favicon-img" alt="ファビコン" /></span>';
//GoogleファビコンAPIを利用する
//http://www.google.com/s2/favicons?domain=nelog.jp
$favicon_tag = '<span class="blog-card-favicon"><img src="http://www.google.com/s2/favicons?domain=' . get_this_site_domain() . '" class="blog-card-favicon-img" alt="ファビコン" /></span>';
}
$site_logo_tag = is_blog_card_site_logo_visible() ? '<div class="blog-card-site">' . $favicon_tag . '<a href="' . home_url() . '"' . $target . '>' . get_this_site_domain() . '</a></div>' : '';
$date_tag = '';
if (is_blog_card_date_visible()) {
$date_tag = '<div class="blog-card-date">' . $date . '</div>';
}
//サムネイルの取得(要100×100のサムネイル設定)
$thumbnail = get_the_post_thumbnail($id, 'thumb100', array('class' => 'blog-card-thumb-image', 'alt' => $title));
if (!$thumbnail) {
//サムネイルが存在しない場合
$thumbnail = '<img src="' . get_template_directory_uri() . '/images/no-image.png" alt="' . $title . '" class="blog-card-thumb-image" />';
}
//取得した情報からブログカードのHTMLタグを作成
$tag = '<div class="blog-card internal-blog-card"><div class="blog-card-thumbnail"><a href="' . $url . '" class="blog-card-thumbnail-link"' . $target . '>' . $thumbnail . '</a></div><div class="blog-card-content"><div class="blog-card-title"><a href="' . $url . '" class="blog-card-title-link"' . $target . '>' . $title . '</a></div><div class="blog-card-excerpt">' . $excerpt . '</div></div><div class="blog-card-footer">' . $site_logo_tag . $hatebu_tag . $date_tag . '</div></div>';
return $tag;
}
开发者ID:musashi0128,项目名称:wordpress,代码行数:59,代码来源:blog-card.php
示例12: bayfront_header_style
function bayfront_header_style()
{
$header_image = get_header_image();
if (empty($header_image)) {
return;
}
?>
<style type="text/css">
<?php
if (is_single() && get_post_type() == 'property') {
?>
<?php
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
?>
#container-wrap-header {
background: none;
}
<?php
} else {
?>
<?php
// Get post id
$url = explode('?', 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
$ID = url_to_postid($url[0]);
$page_template = get_post_meta(get_the_ID(), '_wp_page_template', true);
?>
<?php
if ($page_template == 'page-templates/properties-subpage.php') {
?>
<?php
$url = wp_get_attachment_url(get_post_thumbnail_id($post_id));
?>
#container-wrap-header {
background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)), url(<?php
echo $url;
?>
) no-repeat center;
background-size: cover;
}
<?php
} else {
?>
#container-wrap-header {
background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)), url(<?php
header_image();
?>
) no-repeat center;
background-size: cover;
}
<?php
}
}
?>
</style>
<?php
}
开发者ID:phucanh92,项目名称:vietlong,代码行数:59,代码来源:functions.php
示例13: op_remove_enigmapro_js
function op_remove_enigmapro_js()
{
$checkIfLEPage = get_post_meta(url_to_postid("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']), '_optimizepress_pagebuilder', true);
if ($checkIfLEPage || $_GET['page'] == 'optimizepress-page-builder' || defined('OP_LIVEEDITOR')) {
remove_action('wp_enqueue_scripts', 'weblizar_scripts', 10);
remove_action('wp_footer', 'weblizar_footer_js', 10);
}
}
开发者ID:OptimizePress,项目名称:op-enigma-pro-fix,代码行数:8,代码来源:op-enigma-pro-fix.php
示例14: op_allow_bbforum
function op_allow_bbforum()
{
$forumPage = get_post(url_to_postid("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']));
if ($forumPage->post_type == 'forum') {
op_update_option('blog_enabled', 'Y');
op_update_option('installed', 'Y');
}
}
开发者ID:OptimizePress,项目名称:op-bbpress-fix,代码行数:8,代码来源:op-bbpress-fix.php
示例15: flush
/**
* Clear something from the cache
*
* @param array $args
* @param array $vars
*/
function flush($args = array(), $vars = array())
{
if (function_exists('w3tc_pgcache_flush')) {
$args = array_unique($args);
do {
$cache_type = array_shift($args);
switch ($cache_type) {
case 'db':
case 'database':
if (w3tc_dbcache_flush()) {
WP_CLI::success('The object cache is flushed successfully.');
} else {
WP_CLI::error('Flushing the object cache failed.');
}
break;
case 'minify':
if (w3tc_minify_flush()) {
WP_CLI::success('The object cache is flushed successfully.');
} else {
WP_CLI::error('Flushing the object cache failed.');
}
break;
case 'object':
if (w3tc_objectcache_flush()) {
WP_CLI::success('The object cache is flushed successfully.');
} else {
WP_CLI::error('Flushing the object cache failed.');
}
break;
case 'post':
default:
if (isset($vars['post_id'])) {
if (is_numeric($vars['post_id'])) {
w3tc_pgcache_flush_post($vars['post_id']);
} else {
WP_CLI::error('This is not a valid post id.');
}
w3tc_pgcache_flush_post($vars['post_id']);
} elseif (isset($vars['permalink'])) {
$id = url_to_postid($vars['permalink']);
if (is_numeric($id)) {
w3tc_pgcache_flush_post($id);
} else {
WP_CLI::error('There is no post with this permalink.');
}
} else {
if (isset($flushed_page_cache) && $flushed_page_cache) {
break;
}
$flushed_page_cache = true;
w3tc_pgcache_flush();
}
}
} while (!empty($args));
} else {
WP_CLI::error('The W3 Total Cache could not be found, is it installed?');
}
}
开发者ID:roelven,项目名称:wp-cli,代码行数:64,代码来源:total-cache.php
示例16: jr_mt_convert_url_arrays
function jr_mt_convert_url_arrays($settings)
{
global $jr_mt_url_types;
foreach ($jr_mt_url_types as $setting_key) {
if (isset($settings[$setting_key]) && is_array($settings[$setting_key])) {
foreach ($settings[$setting_key] as $url_key => $url_array) {
$url = $url_array['url'];
if (jr_mt_same_prefix_url(JR_MT_HOME_URL, $url)) {
$new_url_array['url'] = $url_array['url'];
$new_url_array['theme'] = $url_array['theme'];
$rel_url = jr_mt_relative_url($url, JR_MT_HOME_URL);
$new_url_array['rel'] = $rel_url;
/* Create the URL Prep array for each of the current Site Aliases,
including the Current Site URL
*/
$new_url_array['prep'] = array();
foreach ($settings['aliases'] as $index => $alias) {
$new_url_array['prep'][] = jr_mt_prep_url($alias['url'] . '/' . $rel_url);
}
/* Only for URL type Setting, not Prefix types.
*/
if ('url' === $setting_key) {
/* Try and figure out ID and WordPress Query Keyword for Type, if possible and relevant
*/
if (0 === ($id = url_to_postid($url)) && version_compare(get_bloginfo('version'), '4', '>=')) {
$id = attachment_url_to_postid($url);
}
if (!empty($id)) {
$new_url_array['id'] = (string) $id;
if (NULL !== ($post = get_post($id))) {
switch ($post->post_type) {
case 'post':
$new_url_array['id_kw'] = 'p';
break;
case 'page':
$new_url_array['id_kw'] = 'page_id';
break;
case 'attachment':
$new_url_array['id_kw'] = 'attachment_id';
break;
}
}
}
}
$settings[$setting_key][$url_key] = $new_url_array;
} else {
/* Error:
Cannot convert, as URL is from a different Site Home URL,
so have to delete this URL entry.
*/
unset($settings[$setting_key][$url_key]);
jr_mt_messages('Setting deleted during Conversion to Version 6 format because Site URL has changed');
}
}
}
}
return $settings;
}
开发者ID:venturepact,项目名称:blog,代码行数:58,代码来源:upgradev6.php
示例17: getLoginRedirectPermalink
/**
* Find the correct login redirect permalink
*
* @param string $to redirect url
*
* @return string redirect url
*/
public function getLoginRedirectPermalink($to)
{
$ID = url_to_postid($to);
$translatedID = pll_get_post($ID);
if ($translatedID) {
return get_permalink($translatedID);
}
return $to;
}
开发者ID:Frost-Bite,项目名称:woo-poly-integration,代码行数:16,代码来源:Login.php
示例18: __construct
public function __construct($post_id = -1)
{
// maybe bugs with this
$post_id = $post_id != -1 ? $post_id : ($post_id = url_to_postid(wp_get_referer()));
$this->buddypress_id = get_post_meta($post_id, 'buddypress_id', true);
$forum_id = bbp_get_group_forum_ids($this->buddypress_id);
$forum_id = !empty($forum_id) ? $forum_id[0] : null;
$this->forumId = $forum_id;
$this->translation = $this->_getTranslationList();
}
开发者ID:Bnei-Baruch,项目名称:Forum-bbpres-,代码行数:10,代码来源:forum-bbpAjaxIntegrator.php
示例19: _scripts
function _scripts()
{
wp_register_script('jquery', get_stylesheet_directory_uri() . '/bower_components/jquery/dist/jquery.min.js');
wp_enqueue_script('my-scripts', get_stylesheet_directory_uri() . '/build/js/scripts.min.js', array('angularjs', 'angularjs-route', 'angularjs-sanitize'));
wp_enqueue_script('scripts', get_template_directory_uri() . '/build/js/scripts.min.js', array('jquery'), '20120206', true);
// Load all of the styles that need to appear on all pages
wp_enqueue_style('custom', get_template_directory_uri() . '/app/css/style.css');
$url = explode('?', 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
$post_id = url_to_postid($url[0]);
$vcode = get_field('hero_yt_video_id', $post_id);
wp_localize_script('scripts', 'vcode', $vcode);
}
开发者ID:Grainy,项目名称:paulc,代码行数:12,代码来源:functions.php
示例20: ppp_apply_wpme
/**
* Convert a link to WP.me
* @param string $link The link, before shortening
* @return string The link, after shortening through wp.me
*/
function ppp_apply_wpme($link)
{
if (class_exists('Jetpack') && Jetpack::is_module_active('shortlinks')) {
$id = url_to_postid($link);
$result = wpme_get_shortlink($id);
if (!empty($result)) {
return $result;
} else {
return $link;
}
}
return $link;
}
开发者ID:sumobi,项目名称:post-promoter-pro,代码行数:18,代码来源:wpme-functions.php
注:本文中的url_to_postid函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论