Plugin Directory

Changeset 3093095


Ignore:
Timestamp:
05/27/2024 11:01:51 AM (22 months ago)
Author:
osompress
Message:

update to 2.0

Location:
genesis-author-pro
Files:
38 added
3 edited

Legend:

Unmodified
Added
Removed
  • genesis-author-pro/trunk/classes/class.Genesis_Author_Pro_Book_Meta.php

    r1565016 r3093095  
    252252                'name'        => 'button_1',
    253253                'label'       => __( 'Button 1', 'genesis-author-pro' ),
    254                 'description' => __( 'This will create a button on the book page that can be used as a link for purchase, download, etc.', 'genesis-author-pro' ),
     254                'description' => __( 'In Genesis Child Themes this will create a button on the book page that can be used as a link for purchase, download, etc.<br>In other themes, this will be the URL of the "Book Bottom #" block.', 'genesis-author-pro' ),
    255255                'type'        => 'button',
    256256            ),
     
    258258                'name'        => 'button_2',
    259259                'label'       => __( 'Button 2', 'genesis-author-pro' ),
    260                 'description' => __( 'This will create a button on the book page that can be used as a link for purchase, download, etc.', 'genesis-author-pro' ),
     260                'description' => __( 'In Genesis Child Themes this will create a button on the book page that can be used as a link for purchase, download, etc.<br>In other themes, this will be the URL of the "Book Bottom #" block.', 'genesis-author-pro' ),
    261261                'type'        => 'button',
    262262            ),
     
    264264                'name'        => 'button_3',
    265265                'label'       => __( 'Button 3', 'genesis-author-pro' ),
    266                 'description' => __( 'This will create a button on the book page that can be used as a link for purchase, download, etc.', 'genesis-author-pro' ),
     266                'description' => __( 'In Genesis Child Themes this will create a button on the book page that can be used as a link for purchase, download, etc.<br>In other themes, this will be the URL of the "Book Bottom #" block.', 'genesis-author-pro' ),
    267267                'type'        => 'button',
    268268            ),
  • genesis-author-pro/trunk/plugin.php

    r3082020 r3093095  
    22/*
    33
    4 Plugin Name: Genesis Author Pro
     4Plugin Name: Osom Author Pro
    55Plugin URI: https://wordpress.org/plugins/genesis-author-pro/
    6 Description: Adds default Book CPT to any Genesis HTML5 theme.
    7 Version: 1.2.2
     6Description: Adds a Book CPT and fields to display theme beatifully.
     7Version: 2.0
    88Author: OsomPress
    99Author URI: https://www.osompress.com/
     
    1111Domain Path /languages/
    1212
    13 */
     13 */
    1414
    1515if ( !defined( 'ABSPATH' ) ) {
     
    3838 * @return void
    3939 */
    40 function gapro_autoloader($class) {
     40function gapro_autoloader( $class ) {
    4141
    4242    $classes = array(
     
    5252    );
    5353
    54     if( isset( $classes[$class] ) ) {
    55         require_once( GENESIS_AUTHOR_PRO_CLASSES_DIR . $classes[$class] );
     54    if ( isset( $classes[$class] ) ) {
     55        require_once GENESIS_AUTHOR_PRO_CLASSES_DIR . $classes[$class];
    5656    }
    5757
     
    6161register_activation_hook( __FILE__, array( 'Genesis_Author_Pro_Activation', 'activate' ) );
    6262
    63 define( 'GENESIS_AUTHOR_PRO_CLASSES_DIR'  , dirname(        __FILE__ ) . '/classes/'  );
    64 define( 'GENESIS_AUTHOR_PRO_FUNCTIONS_DIR', dirname(        __FILE__ ) . '/functions/' );
    65 define( 'GENESIS_AUTHOR_PRO_TEMPLATES_DIR', dirname(        __FILE__ ) . '/templates/' );
    66 define( 'GENESIS_AUTHOR_PRO_RESOURCES_URL', plugin_dir_url( __FILE__ ) . 'resources/'  );
     63define( 'GENESIS_AUTHOR_PRO_CLASSES_DIR', dirname( __FILE__ ) . '/classes/' );
     64define( 'GENESIS_AUTHOR_PRO_FUNCTIONS_DIR', dirname( __FILE__ ) . '/functions/' );
     65define( 'GENESIS_AUTHOR_PRO_TEMPLATES_DIR', dirname( __FILE__ ) . '/templates/' );
     66define( 'GENESIS_AUTHOR_PRO_RESOURCES_URL', plugin_dir_url( __FILE__ ) . 'resources/' );
    6767
    6868add_action( 'init', array( 'Genesis_Author_Pro_CPT', 'init' ), 1 );
     
    7474 * @return void
    7575 */
    76 function author_pro_init(){
    77 
    78     add_action( 'load-post.php'             , array( 'Genesis_Author_Pro'    , 'maybe_do_book_meta'                )        );
    79     add_action( 'load-post-new.php'         , array( 'Genesis_Author_Pro'    , 'maybe_do_book_meta'                )        );
    80     add_action( 'load-edit-tags.php'        , array( 'Genesis_Author_Pro'    , 'maybe_enqueue_scripts'             )        );
    81     add_filter( 'bulk_post_updated_messages', array( 'Genesis_Author_Pro'    , 'bulk_updated_messages'            ), 10, 2 );
    82     add_action( 'save_post'                 , array( 'Genesis_Author_Pro'    , 'maybe_do_save'                    ), 10, 2 );
     76function author_pro_init() {
     77
     78    add_action( 'load-post.php', array( 'Genesis_Author_Pro', 'maybe_do_book_meta' ) );
     79    add_action( 'load-post-new.php', array( 'Genesis_Author_Pro', 'maybe_do_book_meta' ) );
     80    add_action( 'load-edit-tags.php', array( 'Genesis_Author_Pro', 'maybe_enqueue_scripts' ) );
     81    add_filter( 'bulk_post_updated_messages', array( 'Genesis_Author_Pro', 'bulk_updated_messages' ), 10, 2 );
     82    add_action( 'save_post', array( 'Genesis_Author_Pro', 'maybe_do_save' ), 10, 2 );
    8383
    8484}
     
    9393 * @return void
    9494 */
    95 function genesis_author_pro_init(){
     95function genesis_author_pro_init() {
    9696
    9797    $archive_page_hook = sprintf( 'load-%1$s_page_genesis-cpt-archive-%1$s', 'books' );
    98     add_action( 'init'                      , array( 'Genesis_Author_Pro_CPT', 'maybe_remove_genesis_sidebar_form' ), 11    );
    99     add_action( 'admin_init'                , array( 'Genesis_Author_Pro_CPT', 'remove_genesis_layout_options'     ), 11    );
     98    add_action( 'init', array( 'Genesis_Author_Pro_CPT', 'maybe_remove_genesis_sidebar_form' ), 11 );
     99    add_action( 'admin_init', array( 'Genesis_Author_Pro_CPT', 'remove_genesis_layout_options' ), 11 );
    100100    add_filter( 'template_include', array( 'Genesis_Author_Pro_Template', 'maybe_include_template' ) );
    101     add_action( $archive_page_hook          , array( 'Genesis_Author_Pro'    , 'maybe_enqueue_scripts'             )        );
    102     add_action( 'widgets_init'              , array( 'Genesis_Author_Pro'    , 'widgets_init'                      )        );
     101    add_action( $archive_page_hook, array( 'Genesis_Author_Pro', 'maybe_enqueue_scripts' ) );
     102    add_action( 'widgets_init', array( 'Genesis_Author_Pro', 'widgets_init' ) );
    103103
    104104}
     
    106106// Add image size
    107107add_action( 'after_setup_theme', array( 'Genesis_Author_Pro_CPT', 'maybe_add_image_size' ) );
     108
     109// Register block bindings for Author Pro metadata
     110add_action( 'init', 'osom_author_pro_register_block_bindings' );
     111function osom_author_pro_register_block_bindings() {
     112    $bindings = array(
     113        'osom-author-pro/book-featured-text'    => array(
     114            'label' => __( 'Featured Text', 'genesis-author-pro' ),
     115            'key'   => 'featured_text',
     116        ),
     117        'osom-author-pro/book-price'            => array(
     118            'label' => __( 'Book Price', 'genesis-author-pro' ),
     119            'key'   => 'price',
     120        ),
     121        'osom-author-pro/book-isbn'             => array(
     122            'label' => __( 'Book ISBN', 'genesis-author-pro' ),
     123            'key'   => 'isbn',
     124        ),
     125        'osom-author-pro/book-publisher'        => array(
     126            'label' => __( 'Book Publisher', 'genesis-author-pro' ),
     127            'key'   => 'publisher',
     128        ),
     129        'osom-author-pro/book-editor'           => array(
     130            'label' => __( 'Book Editor', 'genesis-author-pro' ),
     131            'key'   => 'editor',
     132        ),
     133        'osom-author-pro/book-edition'          => array(
     134            'label' => __( 'Book Edition', 'genesis-author-pro' ),
     135            'key'   => 'edition',
     136        ),
     137        'osom-author-pro/book-publication-date' => array(
     138            'label' => __( 'Book Publication Date', 'genesis-author-pro' ),
     139            'key'   => 'publication_date',
     140        ),
     141        'osom-author-pro/book-available-in'     => array(
     142            'label' => __( 'Book Available In', 'genesis-author-pro' ),
     143            'key'   => 'available',
     144        ),
     145        'osom-author-pro/book-button-1-uri'     => array(
     146            'label' => __( 'Book Button 1', 'genesis-author-pro' ),
     147            'key'   => 'button_1_uri',
     148        ),
     149        'osom-author-pro/book-button-2-uri'     => array(
     150            'label' => __( 'Book Button 2', 'genesis-author-pro' ),
     151            'key'   => 'button_2_uri',
     152        ),
     153        'osom-author-pro/book-button-3-uri'     => array(
     154            'label' => __( 'Book Button 3', 'genesis-author-pro' ),
     155            'key'   => 'button_3_uri',
     156        ),
     157    );
     158
     159    foreach ( $bindings as $block_type => $binding ) {
     160        register_block_bindings_source( $block_type, array(
     161            'label'              => $binding['label'],
     162            'get_value_callback' => function ( $source_args ) use ( $binding ) {
     163                return osom_author_pro_get_metadata_value( $binding['key'] );
     164            },
     165        ) );
     166    }
     167}
     168
     169// Retrieve metadata value based on key
     170function osom_author_pro_get_metadata_value( $key ) {
     171    // Get the current post ID
     172    $post_id = get_the_ID();
     173
     174    // Get the _genesis_author_pro meta value
     175    $meta_value = get_post_meta( $post_id, '_genesis_author_pro', true );
     176
     177    // Extract the value based on key
     178    $value = $meta_value[$key] ?? __( 'Value not set', 'genesis-author-pro' );
     179
     180    if ( $key == 'publication_date' ) {
     181        $value = date_i18n( get_option( 'date_format' ), $value );
     182    }
     183
     184    return esc_html( $value );
     185}
     186
     187// Register block variations for Author Pro
     188add_filter( 'get_block_type_variations', 'osom_author_pro_block_type_variations', 10, 2 );
     189function osom_author_pro_block_type_variations( $variations, $block_type ) {
     190
     191    if ( 'core/paragraph' === $block_type->name ) {
     192        $variations[] = array(
     193            'name'       => 'book-featured-text',
     194            'title'      => 'Featured Text',
     195            'icon'       => 'book-alt',
     196            'category'   => 'author-pro',
     197            'keywords'   => array( 'book', 'author', 'featured' ),
     198            'attributes' => array(
     199                'metadata'    => array(
     200                    'bindings' => array(
     201                        'content' => array(
     202                            'source' => 'osom-author-pro/book-featured-text',
     203                            'args'   => array(
     204                                'key' => 'featured_text',
     205                            ),
     206                        ),
     207                    ),
     208                    'name'     => 'Featured Text',
     209                ),
     210                'placeholder' => __( 'Featured text' ),
     211            ),
     212        );
     213    }
     214
     215    if ( 'core/paragraph' === $block_type->name ) {
     216        $variations[] = array(
     217            'name'       => 'book-price',
     218            'title'      => 'Book Price',
     219            'icon'       => 'money-alt',
     220            'category'   => 'author-pro',
     221            'attributes' => array(
     222                'metadata'    => array(
     223                    'bindings' => array(
     224                        'content' => array(
     225                            'source' => 'osom-author-pro/book-price',
     226                            'args'   => array(
     227                                'key' => 'price',
     228                            ),
     229                        ),
     230                    ),
     231                    'name'     => 'Price',
     232                ),
     233                'placeholder' => __( 'Book price' ),
     234            ),
     235            'keywords'   => array( 'book', 'author', 'price' ),
     236        );
     237    }
     238
     239    if ( 'core/paragraph' === $block_type->name ) {
     240        $variations[] = array(
     241            'name'       => 'book-isbn',
     242            'title'      => 'ISBN',
     243            'icon'       => 'book-alt',
     244            'category'   => 'author-pro',
     245            'keywords'   => array( 'book', 'author', 'isbn' ),
     246            'attributes' => array(
     247                'metadata'    => array(
     248                    'bindings' => array(
     249                        'content' => array(
     250                            'source' => 'osom-author-pro/book-isbn',
     251                            'args'   => array(
     252                                'key' => 'isbn',
     253                            ),
     254                        ),
     255                    ),
     256                    'name'     => 'ISBN',
     257                ),
     258                'placeholder' => __( 'ISBN' ),
     259            ),
     260        );
     261    }
     262
     263    if ( 'core/paragraph' === $block_type->name ) {
     264        $variations[] = array(
     265            'name'       => 'book-publisher',
     266            'title'      => 'Book Publisher',
     267            'icon'       => 'building',
     268            'category'   => 'author-pro',
     269            'keywords'   => array( 'book', 'author', 'publisher' ),
     270            'attributes' => array(
     271                'metadata'    => array(
     272                    'bindings' => array(
     273                        'content' => array(
     274                            'source' => 'osom-author-pro/book-publisher',
     275                            'args'   => array(
     276                                'key' => 'publisher',
     277                            ),
     278                        ),
     279                    ),
     280                    'name'     => 'Publisher',
     281                ),
     282                'placeholder' => __( 'Book publisher' ),
     283            ),
     284        );
     285    }
     286
     287    if ( 'core/paragraph' === $block_type->name ) {
     288        $variations[] = array(
     289            'name'       => 'book-editor',
     290            'title'      => 'Book Editor',
     291            'icon'       => 'edit',
     292            'category'   => 'author-pro',
     293            'keywords'   => array( 'book', 'author', 'editor' ),
     294            'attributes' => array(
     295                'metadata'    => array(
     296                    'bindings' => array(
     297                        'content' => array(
     298                            'source' => 'osom-author-pro/book-editor',
     299                            'args'   => array(
     300                                'key' => 'editor',
     301                            ),
     302                        ),
     303                    ),
     304                    'name'     => 'Editor',
     305                ),
     306                'placeholder' => __( 'Book editor' ),
     307            ),
     308        );
     309    }
     310
     311    if ( 'core/paragraph' === $block_type->name ) {
     312        $variations[] = array(
     313            'name'       => 'book-edition',
     314            'title'      => 'Book Edition',
     315            'icon'       => 'book',
     316            'category'   => 'author-pro',
     317            'keywords'   => array( 'book', 'author', 'edition' ),
     318            'attributes' => array(
     319                'metadata'    => array(
     320                    'bindings' => array(
     321                        'content' => array(
     322                            'source' => 'osom-author-pro/book-edition',
     323                            'args'   => array(
     324                                'key' => 'edition',
     325                            ),
     326                        ),
     327                    ),
     328                    'name'     => 'Edition',
     329                ),
     330                'placeholder' => __( 'Book edition.' ),
     331            ),
     332        );
     333    }
     334
     335    if ( 'core/paragraph' === $block_type->name ) {
     336        $variations[] = array(
     337            'name'       => 'book-publication-date',
     338            'title'      => 'Book Publication Date',
     339            'icon'       => 'calendar-alt',
     340            'category'   => 'author-pro',
     341            'keywords'   => array( 'book', 'author', 'publication date', 'date' ),
     342            'attributes' => array(
     343                'metadata'    => array(
     344                    'bindings' => array(
     345                        'content' => array(
     346                            'source' => 'osom-author-pro/book-publication-date',
     347                            'args'   => array(
     348                                'key' => 'publication_date',
     349                            ),
     350                        ),
     351                    ),
     352                    'name'     => 'Publication Date',
     353                ),
     354                'placeholder' => __( 'Publication date' ),
     355            ),
     356        );
     357    }
     358
     359    if ( 'core/paragraph' === $block_type->name ) {
     360        $variations[] = array(
     361            'name'       => 'book-available-in',
     362            'title'      => 'Book Available In',
     363            'icon'       => 'admin-site-alt3',
     364            'category'   => 'author-pro',
     365            'keywords'   => array( 'book', 'author', 'available' ),
     366            'attributes' => array(
     367                'metadata'    => array(
     368                    'bindings' => array(
     369                        'content' => array(
     370                            'source' => 'osom-author-pro/book-available-in',
     371                            'args'   => array(
     372                                'key' => 'available',
     373                            ),
     374                        ),
     375                    ),
     376                    'name'     => 'Available In',
     377                ),
     378                'placeholder' => __( 'Available formats' ),
     379            ),
     380        );
     381    }
     382
     383    if ( 'core/button' === $block_type->name ) {
     384        $variations[] = array(
     385            'name'       => 'book-button-1',
     386            'title'      => 'Book Button 1',
     387            'icon'       => 'book',
     388            'category'   => 'author-pro',
     389            'keywords'   => array( 'book', 'author', 'button' ),
     390            'attributes' => array(
     391                'metadata'    => array(
     392                    'bindings' => array(
     393                        'url'  => array(
     394                            'source' => 'osom-author-pro/book-button-1-uri',
     395                            'args'   => array(
     396                                'key' => 'button_1_uri',
     397                            ),
     398                        ),
     399                    ),
     400                    'name'     => 'Button 1',
     401                ),
     402                'placeholder' => __( 'Button 1' ),
     403            ),
     404        );
     405    }
     406
     407    if ( 'core/button' === $block_type->name ) {
     408        $variations[] = array(
     409            'name'       => 'book-button-2',
     410            'title'      => 'Book Button 2',
     411            'icon'       => 'book',
     412            'category'   => 'author-pro',
     413            'keywords'   => array( 'book', 'author', 'button' ),
     414            'attributes' => array(
     415                'metadata'    => array(
     416                    'bindings' => array(
     417                        'url' => array(
     418                            'source' => 'osom-author-pro/book-button-2-uri',
     419                            'args'   => array(
     420                                'key' => 'button_2_uri',
     421                            ),
     422                        ),
     423                    ),
     424                    'name'     => 'Button 2',
     425                ),
     426                'placeholder' => __( 'Button 2' ),
     427            ),
     428        );
     429    }
     430
     431    if ( 'core/button' === $block_type->name ) {
     432        $variations[] = array(
     433            'name'       => 'book-button-3',
     434            'title'      => 'Book Button 3',
     435            'icon'       => 'book',
     436            'category'   => 'author-pro',
     437            'keywords'   => array( 'book', 'author', 'button' ),
     438            'attributes' => array(
     439                'metadata'    => array(
     440                    'bindings' => array(
     441                        'url' => array(
     442                            'source' => 'osom-author-pro/book-button-3-uri',
     443                            'args'   => array(
     444                                'key' => 'button_3_uri',
     445                            ),
     446                        ),
     447                    ),
     448                    'name'     => 'Button 3',
     449                ),
     450                'placeholder' => __( 'Button 3' ),
     451            ),
     452        );
     453    }
     454
     455    return $variations;
     456}
     457
     458// Adding Osom Author Pro block category
     459add_filter( 'block_categories_all', 'osom_author_pro_block_category', 10, 2 );
     460function osom_author_pro_block_category( $categories, $post ) {
     461
     462    array_unshift( $categories, array(
     463        'slug'  => 'author-pro',
     464        'title' => 'Author Pro',
     465        'icon'  => 'book',
     466    ) );
     467
     468    return $categories;
     469}
     470
     471// Register block patterns
     472add_action( 'init', 'osom_author_pro_register_block_patterns' );
     473function osom_author_pro_register_block_patterns() {
     474    register_block_pattern(
     475        'osom-author-pro/two-columns-book-template',
     476        array(
     477            'title'       => __( 'Two columm book template', 'genesis-author-pro' ),
     478            'description' => __( 'Displays book featured image on one column and the book info as list on the other', 'genesis-author-pro' ),
     479            'content'     => '<!-- wp:columns -->
     480            <div class="wp-block-columns"><!-- wp:column -->
     481            <div class="wp-block-column"><!-- wp:post-featured-image {"aspectRatio":"auto","height":"400px"} /--></div>
     482            <!-- /wp:column -->
     483           
     484            <!-- wp:column {"verticalAlignment":"center","style":{"spacing":{"blockGap":"0px"}}} -->
     485            <div class="wp-block-column is-vertically-aligned-center"><!-- wp:paragraph {"align":"center","placeholder":"Featured text","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-featured-text","args":{"key":"featured_text"}}},"name":"Featured Text"},"style":{"spacing":{"padding":{"right":"0","left":"0","top":"0","bottom":"0"},"margin":{"top":"0","bottom":"0"}},"typography":{"letterSpacing":"1.5px","textTransform":"capitalize","fontStyle":"normal","fontWeight":"700"}},"fontSize":"small"} -->
     486            <p class="has-text-align-center has-small-font-size" style="margin-top:0;margin-bottom:0;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0;font-style:normal;font-weight:700;letter-spacing:1.5px;text-transform:capitalize"></p>
     487            <!-- /wp:paragraph -->
     488           
     489            <!-- wp:post-terms {"term":"book-authors","style":{"spacing":{"padding":{"top":"var:preset|spacing|10","bottom":"var:preset|spacing|10"}},"typography":{"fontStyle":"normal","fontWeight":"700"}},"className":"is-style-default","fontSize":"medium"} /-->
     490           
     491            <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
     492            <div class="wp-block-group"><!-- wp:paragraph -->
     493            <p><strong>Price</strong>:</p>
     494            <!-- /wp:paragraph -->
     495           
     496            <!-- wp:paragraph {"placeholder":"Book price","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-price","args":{"key":"price"}}},"name":"Price"}} -->
     497            <p></p>
     498            <!-- /wp:paragraph --></div>
     499            <!-- /wp:group -->
     500           
     501            <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20","margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
     502            <div class="wp-block-group" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><!-- wp:paragraph -->
     503            <p><strong>Edition</strong>: </p>
     504            <!-- /wp:paragraph -->
     505           
     506            <!-- wp:paragraph {"placeholder":"Book edition.","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-edition","args":{"key":"edition"}}},"name":"Edition"}} -->
     507            <p></p>
     508            <!-- /wp:paragraph --></div>
     509            <!-- /wp:group -->
     510           
     511            <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20","margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
     512            <div class="wp-block-group" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><!-- wp:paragraph -->
     513            <p><strong>ISBN</strong>: </p>
     514            <!-- /wp:paragraph -->
     515           
     516            <!-- wp:paragraph {"placeholder":"ISBN","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-isbn","args":{"key":"isbn"}}},"name":"ISBN"}} -->
     517            <p></p>
     518            <!-- /wp:paragraph --></div>
     519            <!-- /wp:group -->
     520           
     521            <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20","margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
     522            <div class="wp-block-group" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><!-- wp:paragraph -->
     523            <p><strong>Editor</strong>: </p>
     524            <!-- /wp:paragraph -->
     525           
     526            <!-- wp:paragraph {"placeholder":"Book editor","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-editor","args":{"key":"editor"}}},"name":"Editor"}} -->
     527            <p></p>
     528            <!-- /wp:paragraph --></div>
     529            <!-- /wp:group -->
     530           
     531            <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20","margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
     532            <div class="wp-block-group" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><!-- wp:paragraph -->
     533            <p><strong>Publisher</strong>: </p>
     534            <!-- /wp:paragraph -->
     535           
     536            <!-- wp:paragraph {"placeholder":"Book publisher","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-publisher","args":{"key":"publisher"}}},"name":"Publisher"}} -->
     537            <p></p>
     538            <!-- /wp:paragraph --></div>
     539            <!-- /wp:group -->
     540           
     541            <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20","margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
     542            <div class="wp-block-group" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><!-- wp:paragraph -->
     543            <p><strong>Publication date</strong>: </p>
     544            <!-- /wp:paragraph -->
     545           
     546            <!-- wp:paragraph {"placeholder":"Publication date","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-publication-date","args":{"key":"publication_date"}}},"name":"Publication Date"}} -->
     547            <p></p>
     548            <!-- /wp:paragraph --></div>
     549            <!-- /wp:group -->
     550           
     551            <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20","margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
     552            <div class="wp-block-group" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><!-- wp:paragraph -->
     553            <p><strong>Available in</strong>: </p>
     554            <!-- /wp:paragraph -->
     555           
     556            <!-- wp:paragraph {"placeholder":"Available formats","metadata":{"bindings":{"content":{"source":"osom-author-pro/book-available-in","args":{"key":"available"}}},"name":"Available In"}} -->
     557            <p></p>
     558            <!-- /wp:paragraph --></div>
     559            <!-- /wp:group -->
     560           
     561            <!-- wp:buttons -->
     562            <div class="wp-block-buttons"><!-- wp:button {"placeholder":"Button 1","metadata":{"bindings":{"url":{"source":"osom-author-pro/book-button-1-uri","args":{"key":"button_1_uri"}}},"name":"Button 1"}} /-->
     563           
     564            <!-- wp:button {"placeholder":"Button 2","metadata":{"bindings":{"url":{"source":"osom-author-pro/book-button-2-uri","args":{"key":"button_2_uri"}}},"name":"Button 2"}} /-->
     565           
     566            <!-- wp:button {"placeholder":"Button 3","metadata":{"bindings":{"url":{"source":"osom-author-pro/book-button-3-uri","args":{"key":"button_3_uri"}}},"name":"Button 3"}} /--></div>
     567            <!-- /wp:buttons --></div>
     568            <!-- /wp:column --></div>
     569            <!-- /wp:columns -->',
     570            'categories'  => array( 'Osom Author Pro' ),
     571            'keywords'    => array( 'author', 'book', 'osom' ),
     572        )
     573    );
     574    // Register pattern category
     575    register_block_pattern_category(
     576        'Osom Author Pro',
     577        array( 'label' => __( 'Osom Author Pro', 'genesis-author-pro' ) )
     578    );
     579}
     580
     581// Hide book button text field on non Genesis themes
     582add_action( 'admin_head', 'osom_custom_admin_css' );
     583function osom_custom_admin_css() {
     584    // Check if the parent theme is Genesis Framework
     585    $parent_theme = wp_get_theme()->parent();
     586    if ( !$parent_theme || 'Genesis' !== $parent_theme->get( 'Name' ) ) {
     587        echo '
     588        <style>
     589        #genesis_author_pro_book_meta table table tr:nth-child(2) {
     590            display: none;
     591        }
     592        </style>';
     593    }
     594}
  • genesis-author-pro/trunk/readme.txt

    r3082032 r3093095  
    1 === Genesis Author Pro ===
     1=== Osom Author Pro ===
    22Contributors: nick_thegeek, dreamwhisper, laurenmancke, studiopress, marksabbath, jivedig, osompress, esther_sola, nahuai
    33Tags: genesis, authors, books
    44Requires at least: 5.0
    55Tested up to: 6.5
    6 Stable tag: 1.2.2
     6Stable tag: 2.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 Adds a book library to any WordPress theme.
    11 In Genesis child theme also attractively display book details in single and archive views.
     10The Osom Author Pro plugin creates a library which allows you to add books to any WordPress theme.
    1211
    1312== Description ==
    1413
    15 The Genesis Author Pro plugin creates a library which allows you to add books to your site. The books can have custom information added including:
     14The Osom Author Pro plugin creates a library which allows you to add books to any WordPress theme.
     15
     16In WordPress themes using the Block Editor, you'll be able to display the book details (Price, ISBN, author...) using native blocks and a dedicated block pattern. Additionally, in Genesis child themes it also provides layouts for a single and archive views.
     17
     18= WordPress Themes with Block Editor =
     19
     20The Osom Author Pro adds a new category called "Author Pro" containing a native block for each custom book information:
    1621
    1722* Featured Text
     
    2530* Three custom buttons
    2631
     32More over, the plugin adds a dedicated block pattern including all these new native blocks.
     33
    2734In addition to the custom book data, there are three taxonomies created: "Author," "Series," and "Tags." These allow you and your site visitors to sort and organize the books in your library.
    28 
    29 The Genesis Author Pro Featured Book widget will allow you to select a book from the library and feature it in any widgeted area of your website.
    30 
    31 Optional output from the widget includes:
    32 
    33 * Widget Title
    34 * Book Title
    35 * By Line
    36 * Book Image
    37 * Featured Text
    38 * Content options including: Full content, limited content, and the excerpt for a custom synopsis.
    39 * Price
    40 * Custom link to the single book page
    4135
    4236The Author is handled via the custom taxonomy instead of following the post author. This allows you to have multiple book authors and put books in the library without creating new members on your site. Multiple authors should be output in the byline without the Oxford comma like:
     
    5751The date will be stored in a computer readable format and then output following the date format set in the WordPress options.
    5852
    59 For Genesis child themes also offer templates that are built into the plugin with default CSS to create the basic layout for all child themes. Templates follow standard WP template hierarchy so if the template is in the child theme, that will override the template in the plugin. Templates include:
     53
     54= In Genesis Themes =
     55
     56The Osom Author Pro Featured Book widget will allow you to select a book from the library and feature it in any widgeted area of your website.
     57
     58Optional output from the widget includes:
     59
     60* Widget Title
     61* Book Title
     62* By Line
     63* Book Image
     64* Featured Text
     65* Content options including: Full content, limited content, and the excerpt for a custom synopsis.
     66* Price
     67* Custom link to the single book page
     68
     69For Genesis child themes it also offer templates that are built into the plugin with default CSS to create the basic layout for all child themes. Templates follow standard WP template hierarchy so if the template is in the child theme, that will override the template in the plugin. Templates include:
    6070
    6171* single-books.php
     
    6777== Installation ==
    6878
    69 
    70791. Upload `genesis-author-pro` directory to the `/wp-content/plugins/` directory
    71801. Activate the plugin through the 'Plugins' menu in WordPress
    7281
     82== Frequently Asked Questions ==
     83
     84= I don't see the dedicated button blocks under the "Author Pro" category, where are they?  =
     85
     86The dedicated Author Pro buttons 1, 2 and 3 will appear in your block panel to be selected when you are inside a native button block. If you are not inside a button block you will not see them.
     87
     88To help you find all Author Pro Blocks, we created an Author Pro pattern that includes all Author Pro blocks.
     89
     90== Screenshots ==
     91 
     921. Blocks to display Book fields under Author Pro category.
     932. Block pattern available from the editor inserter.
     943. Book block pattern.
     954. Book block pattern with information filled and small design modifications.
     965. Book fields on the editor.
    7397
    7498== Changelog ==
     99
     100= 2.0 =
     101* Name change from Genesis Author Pro to Osom Author Pro, since the functionality it's not longer tied to Genesis child themes. Genesis users fear not, all the existing functionality will work as usual but you will find new options.
     102* Added the ability to display the book details (Price, ISBN, author...) using native blocks.
     103* You will find, on the block editor, a new category called "Author Pro" containing all the new available blocks.
    75104
    76105= 1.2.2 =
Note: See TracChangeset for help on using the changeset viewer.