本文整理汇总了PHP中wp函数的典型用法代码示例。如果您正苦于以下问题:PHP wp函数的具体用法?PHP wp怎么用?PHP wp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wp_template_loader
private function wp_template_loader()
{
global $pagenow;
$pagenow = 'index.php';
if (!defined('WP_USE_THEMES')) {
define('WP_USE_THEMES', true);
}
wp();
if ($_SERVER['REQUEST_URI'] === $this->user_trailingslashit(str_repeat('-/', 10))) {
$_SERVER['REQUEST_URI'] = $this->user_trailingslashit('/wp-login-php/');
}
require_once ABSPATH . WPINC . '/template-loader.php';
die;
}
开发者ID:IvanRF,项目名称:rename-wp-login,代码行数:14,代码来源:rename-wp-login.php
示例2: index
public function index()
{
static $wp_did_header;
global $wpdb, $current_site;
define('WP_ONLY', true);
if (!defined('ABSPATH')) {
if (!isset($wp_did_header)) {
define('WP_USE_THEMES', true);
$wp_did_header = true;
require_once dirname(base_path()) . '/app/article/wp-load.php';
wp();
require_once dirname(base_path()) . '/app/includes/template-loader.php';
}
//require_once dirname(base_path()) . '/app/article/index.php';
}
return view('main::index');
}
开发者ID:ycms,项目名称:framework,代码行数:17,代码来源:MainController.php
示例3: handle
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
if ($type !== self::MASTER_REQUEST) {
throw new \LogicException('Wordpress\\HttpKernel cannot handle SUB_REQUESTS');
}
unset($type);
$this->catch = $catch;
unset($catch);
$this->timezone = date_default_timezone_get();
$this->startOutputBuffer();
try {
$wp_the_query = null;
$this->storeGlobals();
$request->overrideGlobals();
if ($globalNames = @(include $this->wordpressGlobalNamesCacheFile)) {
foreach ($globalNames ?: array() as $name) {
@eval('global $' . $name . ';');
}
} else {
throw new \RuntimeException('The global names cache file has to be generated with "app/console startplatz:wordpress-integration:build-global-names-cache"');
}
define('WP_USE_THEMES', true);
$time_start = microtime(true);
require_once "{$this->wordpressRootDir}/wp-load.php";
global $wp_query;
$wp_query = $wp_the_query;
\wp();
require_once "{$this->wordpressRootDir}/wp-includes/template-loader.php";
$content = $this->endOutputBuffer();
$statusCode = is_404() ? 404 : 200;
$headers = $this->flushHeaders();
$this->restoreGlobals();
date_default_timezone_set($this->timezone);
return new Response($content, $statusCode, $headers);
} catch (\Exception $e) {
$this->endOutputBuffer();
$this->flushHeaders();
$this->restoreGlobals();
date_default_timezone_set($this->timezone);
if ($this->catch) {
return new Response($e->getMessage(), 500);
} else {
throw $e;
}
}
}
开发者ID:mstege,项目名称:wordpress-integration-bundle,代码行数:46,代码来源:HttpKernel.php
示例4: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
global $wpdb, $current_site, $wp_did_header;
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
if (!defined('ABSPATH') && PHP_SAPI != 'cli') {
if (!isset($wp_did_header)) {
$wp_did_header = true;
require_once ROOT . '/home/wp-load.php';
wp();
require WP_CORE_DIR . '/includes/template-loader.php';
}
//require_once dirname(base_path()) . '/app/article/index.php';
}
if (defined('ABSPATH')) {
}
}
开发者ID:ycms,项目名称:module-main,代码行数:22,代码来源:MainServiceProvider.php
示例5: provide
public function provide()
{
$this->setupLaravelEnvironment();
/*
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
// Process
wp();
// remove admin redirect action
remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
// Generate blank .php files
$this->prepareTemplates(false);
// Install high priority filter
add_filter('template_include', [$this, 'evaluateTemplate'], 1);
/* Loads the WordPress Template */
return $this->runScript('wp-includes/template-loader.php');
}
开发者ID:tvad911,项目名称:wordpress-plus,代码行数:20,代码来源:TemplateController.php
示例6: wpu_wp_template_load
function wpu_wp_template_load()
{
global $phpbbForum, $wpUtdInt, $wpUnited;
$phpbbForum->background();
// get the page
ob_start();
$oldGET = $_GET;
$_GET = array();
wpu_initialise_wp();
// items usually set by wordpress template loads:
define("WP_USE_THEMES", true);
global $wp_did_header;
$wp_did_header = true;
wp();
if (!$wpUnited->should_do_action('template-p-in-w')) {
$wpUtdInt->load_template();
}
$_GET = $oldGET;
$content = ob_get_contents();
ob_end_clean();
return $content;
}
开发者ID:snitchashor,项目名称:wp-united,代码行数:22,代码来源:wordpress-runner.php
示例7: provide
public function provide()
{
$this->setupLaravelEnvironment();
/*
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
// Process
wp();
// remove admin redirect action
remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
if (config('wordpress.themes.blade.precompile')) {
// Compile blade files
$this->prepareTemplates(true);
add_filter('template_include', [$this, 'renderPhpTemplate']);
} else {
$this->prepareTemplates(false);
add_filter('template_include', [$this, 'evaluateTemplate']);
}
/* Loads the WordPress Template */
require wordpress_path('wp-includes/template-loader.php');
}
开发者ID:sumi21japan,项目名称:wordpress-plus,代码行数:24,代码来源:TemplateController.php
示例8: wp_edit_attachments_query
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $q
* @return unknown
*/
function wp_edit_attachments_query($q = false)
{
if (false === $q) {
$q = $_GET;
}
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
$q['post_type'] = 'attachment';
$q['post_status'] = 'any';
$q['posts_per_page'] = 15;
$post_mime_types = array('image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')));
$post_mime_types = apply_filters('post_mime_types', $post_mime_types);
$avail_post_mime_types = get_available_post_mime_types('attachment');
if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
unset($q['post_mime_type']);
}
wp($q);
return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:schr,项目名称:wordpress,代码行数:27,代码来源:post.php
示例9: wp_edit_attachments_query
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $q
* @return unknown
*/
function wp_edit_attachments_query($q = false)
{
if (false === $q) {
$q = $_GET;
}
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
$q['post_type'] = 'attachment';
$q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : 'inherit';
$media_per_page = (int) get_user_option('upload_per_page', 0, false);
if (empty($media_per_page) || $media_per_page < 1) {
$media_per_page = 20;
}
$q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
$post_mime_types = get_post_mime_types();
$avail_post_mime_types = get_available_post_mime_types('attachment');
if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
unset($q['post_mime_type']);
}
wp($q);
return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:gigikiri,项目名称:bcnAutoWallpaperSite,代码行数:30,代码来源:post.php
示例10: wp
?>
.</p>
<?php
}
?>
</div>
<?php
}
?>
<div class="wrap">
<h2>
<?php
wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
if (is_month()) {
single_month_title(' ');
} elseif (is_search()) {
printf(__('Search for “%s”'), wp_specialchars($_GET['s']));
} else {
if (is_single()) {
printf(__('Comments on %s'), apply_filters("the_title", $post->post_title));
} elseif (!is_paged() || get_query_var('paged') == 1) {
_e('Last 15 Posts');
} else {
_e('Previous Posts');
}
}
?>
</h2>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:edit.php
示例11: wpmp_msma_post_list
function wpmp_msma_post_list()
{
$base = get_option('home');
wp('orderby=modified');
if (have_posts()) {
global $post;
print "<p>" . __("Select a post to edit:", 'wpmp') . "</p>";
add_filter('get_pagenum_link', 'wpmp_msma_get_pagenum_link');
while (have_posts()) {
the_post();
print "<p>" . "<strong><a href='{$base}/wp-admin/post.php?action=edit&post={$post->ID}'>" . get_the_title() . "</a></strong>" . "<br />" . get_the_modified_date() . "<br />" . wpmp_msma_post_status($post->post_status) . "</p>";
}
next_posts_link('Older');
previous_posts_link('Newer');
} else {
print "<p>" . __("There are no posts to edit.", 'wpmp') . "</p>";
}
}
开发者ID:nil-vn,项目名称:beautysite,代码行数:18,代码来源:mobile_admin.php
示例12: edit_data_query
/**
* Clone the core WP function, add the possibility to manage the post type
*
* @param string $q
* @return void
* @author Amaury Balmer
*/
public static function edit_data_query($q = false)
{
if (false === $q) {
$q = $_GET;
}
// Date
if (isset($q['m'])) {
$q['m'] = (int) $q['m'];
}
// Category
if (isset($q['cat'])) {
$q['cat'] = (int) $q['cat'];
}
// Quantity
$q['posts_per_page'] = isset($q['posts_per_page']) ? (int) $q['posts_per_page'] : 0;
if ($q['posts_per_page'] == 0) {
$q['posts_per_page'] = 15;
}
// Content type
$q['post_type'] = SimpleTags_Admin::$post_type;
// Post status
$post_stati = array('publish' => array(_x('Published', 'post'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')), 'future' => array(_x('Scheduled', 'post'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')), 'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')), 'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')), 'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')));
$post_stati = apply_filters('post_stati', $post_stati);
$avail_post_stati = get_available_post_statuses(SimpleTags_Admin::$post_type);
$post_status_q = '';
if (isset($q['post_status']) && in_array($q['post_status'], array_keys($post_stati))) {
$post_status_q = '&post_status=' . $q['post_status'];
$post_status_q .= '&perm=readable';
} elseif (!isset($q['post_status'])) {
$q['post_status'] = '';
}
if ('pending' === $q['post_status']) {
$order = 'ASC';
$orderby = 'modified';
} elseif ('draft' === $q['post_status']) {
$order = 'DESC';
$orderby = 'modified';
} else {
$order = 'DESC';
$orderby = 'date';
}
wp("post_type={$q['post_type']}&what_to_show=posts{$post_status_q}&posts_per_page={$q['posts_per_page']}&order={$order}&orderby={$orderby}");
return array($post_stati, $avail_post_stati);
}
开发者ID:rongandat,项目名称:best-picture,代码行数:51,代码来源:class.admin.mass.php
示例13: get_feed
/**
* Retrieve feed XML.
*
* @since 2.2.0
*
* @param int $page Page ID.
* @param string $post_type Optional, default is post. Post type.
* @return string
*/
function get_feed($page = 1, $post_type = 'post')
{
global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
log_app('function', "get_feed({$page}, '{$post_type}')");
ob_start();
$this->ENTRY_PATH = $post_type;
if (!isset($page)) {
$page = 1;
}
$page = (int) $page;
$count = get_option('posts_per_rss');
wp('posts_per_page=' . $count . '&offset=' . ($count * ($page - 1) . '&orderby=modified'));
$post = $GLOBALS['post'];
$posts = $GLOBALS['posts'];
$wp = $GLOBALS['wp'];
$wp_query = $GLOBALS['wp_query'];
$wpdb = $GLOBALS['wpdb'];
$blog_id = (int) $GLOBALS['blog_id'];
log_app('function', "query_posts(# " . print_r($wp_query, true) . "#)");
log_app('function', "total_count(# {$wp_query->max_num_pages} #)");
$last_page = $wp_query->max_num_pages;
$next_page = $page + 1 > $last_page ? NULL : $page + 1;
$prev_page = $page - 1 < 1 ? NULL : $page - 1;
$last_page = (int) $last_page == 1 || (int) $last_page == 0 ? NULL : (int) $last_page;
$self_page = $page > 1 ? $page : NULL;
?>
<feed xmlns="<?php
echo $this->ATOM_NS;
?>
" xmlns:app="<?php
echo $this->ATOMPUB_NS;
?>
" xml:lang="<?php
echo get_option('rss_language');
?>
" <?php
do_action('app_ns');
?>
>
<id><?php
$this->the_entries_url();
?>
</id>
<updated><?php
echo mysql2date('Y-m-d\\TH:i:s\\Z', get_lastpostmodified('GMT'), false);
?>
</updated>
<title type="text"><?php
bloginfo_rss('name');
?>
</title>
<subtitle type="text"><?php
bloginfo_rss("description");
?>
</subtitle>
<link rel="first" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url();
?>
" />
<?php
if (isset($prev_page)) {
?>
<link rel="previous" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url($prev_page);
?>
" />
<?php
}
if (isset($next_page)) {
?>
<link rel="next" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url($next_page);
?>
" />
<?php
}
?>
<link rel="last" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url($last_page);
//.........这里部分代码省略.........
开发者ID:thomashorta31,项目名称:BHS,代码行数:101,代码来源:wp-app.php
示例14: __
}
if (empty($title)) {
$title = __('Edit Pages');
}
$parent_file = 'edit-pages.php';
wp_enqueue_script('inline-edit-post');
$post_stati = array('publish' => array(__('Published|page'), __('Published pages'), _n_noop('Published <span class="count">(%s)</span>|page', 'Published <span class="count">(%s)</span>')), 'future' => array(__('Scheduled|page'), __('Scheduled pages'), _n_noop('Scheduled <span class="count">(%s)</span>|page', 'Scheduled <span class="count">(%s)</span>')), 'pending' => array(__('Pending Review|page'), __('Pending pages'), _n_noop('Pending Review <span class="count">(%s)</span>|page', 'Pending Review <span class="count">(%s)</span>')), 'draft' => array(__('Draft|page'), _c('Drafts|manage posts header'), _n_noop('Draft <span class="count">(%s)</span>|page', 'Drafts <span class="count">(%s)</span>')), 'private' => array(__('Private|page'), __('Private pages'), _n_noop('Private <span class="count">(%s)</span>|page', 'Private <span class="count">(%s)</span>')));
$query = array('post_type' => 'page', 'orderby' => 'menu_order title', 'what_to_show' => 'posts', 'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
$post_status_label = __('Pages');
if (isset($_GET['post_status']) && in_array($_GET['post_status'], array_keys($post_stati))) {
$post_status_label = $post_stati[$_GET['post_status']][1];
$query['post_status'] = $_GET['post_status'];
$query['perm'] = 'readable';
}
$query = apply_filters('manage_pages_query', $query);
wp($query);
if (is_singular()) {
wp_enqueue_script('admin-comments');
enqueue_comment_hotkeys_js();
}
require_once 'admin-header.php';
?>
<div class="wrap">
<?php
screen_icon();
?>
<h2><?php
echo wp_specialchars($title);
if (isset($_GET['s']) && $_GET['s']) {
printf('<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars(get_search_query()));
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:edit-pages.php
示例15:
<?php
if (empty($wp)) {
require_once('wp-config.php');
wp('feed=rss2&withcomments=1');
}
require (ABSPATH . WPINC . '/feed-rss2-comments.php');
?>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:10,代码来源:wp-commentsrss2.php
示例16: wp
<?php
if (empty($wp)) {
require_once 'wp-config.php';
wp('tb=1');
}
function trackback_response($error = 0, $error_message = '')
{
header('Content-Type: text/xml; charset=' . get_option('blog_charset'));
if ($error) {
echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
echo "<response>\n";
echo "<error>1</error>\n";
echo "<message>{$error_message}</message>\n";
echo "</response>";
die;
} else {
echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
echo "<response>\n";
echo "<error>0</error>\n";
echo "</response>";
}
}
// trackback is done by a POST
$request_array = 'HTTP_POST_VARS';
if (!$_GET['tb_id']) {
$tb_id = explode('/', $_SERVER['REQUEST_URI']);
$tb_id = intval($tb_id[count($tb_id) - 1]);
}
$tb_url = $_POST['url'];
$charset = $_POST['charset'];
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:wp-trackback.php
示例17: yit_load_portfolio_quick_view_ajax
function yit_load_portfolio_quick_view_ajax()
{
if (!isset($_REQUEST['item_id'])) {
die;
}
$item_id = intval($_REQUEST['item_id']);
// set the main wp query for the product
wp('p=' . $item_id . '&post_type=' . get_post_type($item_id));
// force classic layout
add_filter('yit_portfolio_layout', 'yit_force_classic_portfolio_layout');
?>
<link type="text/css" rel="stylesheet" href="<?php
echo YIT_THEME_TEMPLATES_URL . '/portfolios/single/css/style.css';
?>
" />
<?php
do_action('yit_primary');
die;
}
开发者ID:lieison,项目名称:IndustriasFenix,代码行数:19,代码来源:functions-theme.php
示例18: wp
<?php
/**
* Outputs the Atom feed XML format using the feed-atom.php file in wp-includes
* folder. This file only sets the feed format and includes the feed-atom.php.
*
* This file is no longer used in WordPress and while it is not deprecated now.
* This file will most likely be deprecated or removed in a later version.
*
* The link for the atom feed is /index.php?feed=atom with permalinks off.
*
* @package WordPress
*/
if (empty($wp)) {
require_once './wp-load.php';
wp('feed=atom');
}
require ABSPATH . WPINC . '/feed-atom.php';
开发者ID:alx,项目名称:blogsfera,代码行数:18,代码来源:wp-atom.php
示例19: yit_load_product_quick_view_ajax
function yit_load_product_quick_view_ajax()
{
if (!isset($_REQUEST['item_id'])) {
die;
}
$product_id = intval($_REQUEST['item_id']);
// set the main wp query for the product
wp('p=' . $product_id . '&post_type=product');
// remove parts from single product page
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10);
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40);
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50);
remove_all_actions('woocommerce_after_single_product_summary');
remove_all_actions('woocommerce_after_single_product');
// change template for variable products
if (isset($GLOBALS['yith_wccl'])) {
$GLOBALS['yith_wccl']->obj = new YITH_WCCL_Frontend(YITH_WCCL_VERSION);
$GLOBALS['yith_wccl']->obj->override();
}
//wp_head();
while (have_posts()) {
the_post();
?>
<?php
woocommerce_template_single_title();
?>
<?php
woocommerce_template_single_rating();
?>
<?php
woocommerce_template_single_price();
?>
<div class="single-product woocommerce">
<?php
wc_get_template_part('content', 'single-product');
?>
</div>
<?php
}
// end of the loop.
//wp_footer();
die;
}
开发者ID:lieison,项目名称:IndustriasFenix,代码行数:50,代码来源:woocommerce.php
示例20: load_wordpress_with_template
/**
* Runs through the entirety of the WP bootstrap process
*/
private function load_wordpress_with_template()
{
global $wp_query;
WP_CLI::get_runner()->load_wordpress();
// Set up the main WordPress query.
wp();
$interpreted = array();
foreach ($wp_query as $key => $value) {
if (0 === stripos($key, 'is_') && $value) {
$interpreted[] = $key;
}
}
WP_CLI::debug('Main WP_Query: ' . implode(', ', $interpreted), 'redis-debug');
define('WP_USE_THEMES', true);
add_filter('template_include', function ($template) {
$display_template = str_replace(dirname(get_template_directory()) . '/', '', $template);
WP_CLI::debug("Theme template: {$display_template}", 'redis-debug');
return $template;
}, 999);
// Template is normally loaded in global scope, so we need to replicate
foreach ($GLOBALS as $key => $value) {
global ${$key};
}
// Load the theme template.
ob_start();
require_once ABSPATH . WPINC . '/template-loader.php';
ob_get_clean();
}
开发者ID:pantheon-systems,项目名称:wp-redis,代码行数:31,代码来源:cli.php
注:本文中的wp函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论