Plugin Directory

Changeset 1073141


Ignore:
Timestamp:
01/22/2015 04:12:13 AM (11 years ago)
Author:
momen2009
Message:

Added the View Demo button in admin bar.

Location:
wp-post-demo/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-post-demo/trunk/readme.txt

    r1069963 r1073141  
    3333= 1.3 =
    3434* Move the View Demo button next to the Get Shortlink button.
     35
     36= 1.4 =
     37* Added the View Demo button in admin bar.
  • wp-post-demo/trunk/wp-post-demo.php

    r1069963 r1073141  
    44Plugin URI: http://www.elegants.biz/products/wp-post-demo/
    55Description: Plug-in to create simple to post demo page that is already published.
    6 Version: 1.3
     6Version: 1.4
    77Author: momen2009
    88Author URI: http://www.elegants.biz/
     
    7171}
    7272
     73function wp_post_demo_admin_bar_menu($wp_admin_bar){
     74    if($wp_admin_bar -> get_node("view") != null || $wp_admin_bar -> get_node("edit") != null){
     75        $title = sprintf(
     76            '<span class="ab-icon"></span><span class="ab-label">%s</span>',
     77            __('View Demo','wp-post-demo')
     78        );
     79        $permalink = add_query_arg('wp-post-demo', 'true', get_permalink(get_the_ID()));
     80        $wp_admin_bar->add_menu(array(
     81            'id'    => 'wp-post-demo',
     82            'meta'  => array(),
     83            'title' => $title,
     84            'href'  => $permalink
     85        ));
     86    }
     87}
     88
    7389add_filter("the_content","wp_post_demo_the_content", 10, 3 );
    7490add_action("admin_menu", "wp_post_demo_add_custom_box", 10, 3 );
    7591add_action("save_post","wp_post_demo_save_demo_editor", 10, 3 );
     92add_action('admin_bar_menu', "wp_post_demo_admin_bar_menu", 9999);
    7693?>
Note: See TracChangeset for help on using the changeset viewer.