Plugin Directory

Changeset 1802752


Ignore:
Timestamp:
01/14/2018 06:51:40 PM (8 years ago)
Author:
imdr
Message:

done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • masy-gallery/trunk/inc/masygal-post-register.php

    r1797307 r1802752  
    3939}
    4040
     41add_filter( 'manage_masy-gallery_posts_columns', 'masygal_add_custom_columns' );
     42add_action( 'manage_masy-gallery_posts_custom_column' , 'custom_book_column', 10, 2 );
     43
     44function masygal_add_custom_columns($columns) {
     45    $columns['masonry_gallery'] = __( 'Masonry Gallery Shortcode', 'masy-gallery' );
     46    $columns['justified_gallery'] = __( 'Justified Gallery Shortcode', 'masy-gallery' );
     47    return $columns;
     48}
     49
     50function custom_book_column( $column, $post_id ) {
     51    ?>
     52    <style type="text/css">
     53        span.shortcode {
     54            display: block;
     55            margin: 2px 0;
     56        }
     57
     58        span.shortcode > input {
     59            background: inherit;
     60            color: inherit;
     61            font-size: 12px;
     62            border: none;
     63            box-shadow: none;
     64            padding: 4px 8px;
     65            margin: 0;
     66        }
     67    </style>
     68    <?php
     69    if($column =='masonry_gallery'){
     70        ?>
     71        <input type="text" onfocus="this.select();" class="large-text code" readonly="readonly" value='[masonry-gallery id="<?= $post_id ?>"]' />
     72        <?php
     73    }elseif($column =='justified_gallery'){
     74        ?>
     75        <input type="text" onfocus="this.select();" class="large-text code" readonly="readonly" value='[justified-gallery id="<?= $post_id ?>"]' />
     76        <?php
     77    }
     78}
    4179?>
Note: See TracChangeset for help on using the changeset viewer.