Plugin Directory

Changeset 2086696


Ignore:
Timestamp:
05/13/2019 10:35:24 AM (7 years ago)
Author:
franciscopalacios
Message:

new version

Location:
postem-ipsum/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • postem-ipsum/trunk/README.txt

    r2085211 r2086696  
    2121- Featured images: coloured block images to check your templates. You can select a color or choose randomly. You can set width and height for the posts thumbnail.
    2222- Terms can be selected by the user, or choosen randomly.
     23- Post Format Selection or Random
    2324- Woocommerce Products: If you have Woocommerce instaled, you can create random products, select range price, and so on.
    2425- Terms and categories: You can create terms/categories for the selected taxonomy.
     
    4344
    4445== Changelog ==
     46= 2.0.3 =
     47* Added Post Format selection
    4548= 2.0.2 =
    4649* Fix small issues
  • postem-ipsum/trunk/admin/assets/js/postem_ipsum_admin_main.js

    r2048859 r2086696  
    1010    var cat_random = 0;
    1111    var author_random = 0;
     12    var format_random = 0;
    1213    var bg_random = 0;
    1314    var price_min = document.getElementById('price_slider-padding-value-min'),
     
    224225            author_random = 0;
    225226        }
     227    });
     228
     229    // Elegimos format aletatori0?
     230    $(document).on("change", "#format_random", function () {
     231
     232        if ($('input[name="format_random"]').is(':checked')) {
     233
     234            $("#postem_ipsum_format").prop("disabled", true);
     235
     236            format_random = 1;
     237        } else {
     238
     239            $("#postem_ipsum_format").prop("disabled", false);
     240
     241            format_random = 0;
     242        }
     243
     244
    226245    });
    227246
     
    563582                    cat_random: cat_random,
    564583                    author_random: author_random,
     584                    format_random: format_random,
    565585                    postem_ipsum_term: terms,
    566586                })
     
    591611                        .then(function () {
    592612                            $('body').loadingModal('destroy');
    593                             location.reload();
     613                            //location.reload();
    594614                        });
    595615                });
  • postem-ipsum/trunk/admin/postem-ipsum-admin.php

    r2079734 r2086696  
    354354            $author        = isset( $variables['postem_ipsum_author'] ) ? sanitize_text_field( $variables['postem_ipsum_author'] ) : "";
    355355
     356            $format_random = isset( $_POST["format_random"] ) ? sanitize_text_field( $_POST["format_random"] ) : "0";
     357            $format        = isset( $variables['postem_ipsum_format'] ) ? sanitize_text_field( $variables['postem_ipsum_format'] ) : "";
     358
     359
     360
    356361
    357362            // Cogemos todas las categorias por si queremos coger una aleatoria
     
    448453                        'post_excerpt' => sanitize_textarea_field( $short_description ),
    449454                    ) );
     455
     456                    // Insert post format
     457                    $all_formats = array( 0 , 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio' );
     458                    if($format_random == '1'){
     459                        $format = $all_formats[ rand( 0, count($all_formats) - 1 ) ];
     460                        set_post_format($post_id, $format ); //sets the given post to the 'gallery' format
     461                    }
     462                    else{
     463                        set_post_format($post_id, $format ); //sets the given post to the 'gallery' format
     464                    }
     465
    450466
    451467                    if ( $cat_random == "1" ) {
  • postem-ipsum/trunk/admin/views/postem_ipsum_settings.php

    r2048859 r2086696  
    7272
    7373                        <tr>
     74                            <th scope="row"><?php _e( 'Select Post Format', POSTEM_IPSUM_TEXT_DOMAIN ); ?></th>
     75                            <td>
     76                                <label><?php _e( "Random", POSTEM_IPSUM_TEXT_DOMAIN ); ?>: </label>
     77                                <input type="checkbox" name="format_random" id="format_random">
     78                                <select name="postem_ipsum_format" id="postem_ipsum_format">
     79                                    <option value="0" selected><?php _e( 'Select a post format', POSTEM_IPSUM_TEXT_DOMAIN ); ?></option>
     80                                    <option value="chat">Chat</option>
     81                                    <option value="gallery">Gallery</option>
     82                                    <option value="image">Image</option>
     83                                    <option value="link">Link</option>
     84                                    <option value="quote">Quote</option>
     85                                    <option value="status">Status</option>
     86                                    <option value="video">Video</option>
     87                                    <option value="audio">Audio</option>
     88                                </select>
     89                            </td>
     90                        </tr>
     91
     92                        <tr>
    7493                            <th scope="row"><?php _e( 'How many posts', POSTEM_IPSUM_TEXT_DOMAIN ); ?></th>
    7594                            <td>
  • postem-ipsum/trunk/postem-ipsum.php

    r2048859 r2086696  
    44 * Plugin URI:
    55 * Description:       Plugin to create some random posts from scratch
    6  * Version:           2.0.2
     6 * Version:           2.0.3
    77 * Author:            Fco Palacios
    88 * Author URI:
Note: See TracChangeset for help on using the changeset viewer.