Plugin Directory

Changeset 1345260


Ignore:
Timestamp:
02/07/2016 03:23:35 PM (10 years ago)
Author:
hogetan
Message:

fixed a bug at 0.4.3.

Location:
add-page-from-template/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • add-page-from-template/trunk/add-page-from-template.php

    r1345256 r1345260  
    55 * Description(en): Add pages from template files.
    66 * Description: Creates virtural page from template file.
    7  * Version: 0.4.3
     7 * Version: 0.4.3.1
    88 * Author: Yousan_O
    99 * Author URI: http://www.l2tp.org
     
    5858        public static function activation_callback() {
    5959            self::getInstance(); // We need instance
    60             self::$instance->loader->update_rewrite_rules();
    61             update_option( 'apft_plugin_activated', true );
    62             flush_rewrite_rules();
     60            if ( self::$instance instanceof AP_Loader ) {
     61                self::$instance->loader->update_rewrite_rules();
     62                update_option( 'apft_plugin_activated', true );
     63                flush_rewrite_rules();
     64            }
    6365        }
    6466
  • add-page-from-template/trunk/includes/class-loader.php

    r1345038 r1345260  
    6666     * @see get_default_post_to_edit()
    6767     */
    68     private function setGlobalPost() {
     68    private function setGlobalPost(AP_Template $template) {
    6969        /** @var WP_Post */
    7070        global $post;
     
    7777        $postObj->post_date_gmt = '';
    7878        $postObj->post_password = '';
    79         $postObj->post_name = '';
     79        $postObj->post_title = $template->title;
     80        $postObj->post_name = sanitize_title($template->title);
    8081        $postObj->post_type = 'page';
    8182        $postObj->post_status = 'publish';
     
    149150                //add_action('pre_get_posts', array(self::$instance, 'pre_get_posts'));
    150151                $this->setPagename($template->pagename);
    151                 $this->setGlobalPost();
     152                $this->setGlobalPost($template);
    152153                $this->setGlobalQuery();
    153154                if ($templatePath = apply_filters('template_include', $templatePath)) {
  • add-page-from-template/trunk/readme.txt

    r1345256 r1345260  
    5353== Changelog ==
    5454
     55= Version 0.4.3.1 =
     56* Fixed: Set title correctly.
     57
    5558= Version 0.4.3 =
    5659* Upgraded: Show title from template file.
  • add-page-from-template/trunk/tests/pages/page-hoge.php

    r1345256 r1345260  
    77 * Time: 4:24 PM
    88 */
    9 
     9get_header();
    1010?>
    1111Hoooowy Gay!
Note: See TracChangeset for help on using the changeset viewer.