当前位置: 首页>>代码示例>>PHP>>正文


PHP wp函数代码示例

本文整理汇总了PHP中wp函数的典型用法代码示例。如果您正苦于以下问题:PHP wp函数的具体用法?PHP wp怎么用?PHP wp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 &#8220;%s&#8221;'), 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 &#8220;%s&#8221;') . '</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


注:本文中的wp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。