Plugin Directory

Changeset 3004853


Ignore:
Timestamp:
12/03/2023 09:00:57 PM (16 months ago)
Author:
firmcatalyst
Message:

version 1.7

Location:
fcp-first-screen-css/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • fcp-first-screen-css/trunk/README.md

    r2973720 r3004853  
    11# First Screen CSS & Settings
    22
    3 This is a professional tool to manipulate enqueued styles and scripts on your website and add custom CSS to first screen and not first screen optionally. Use it to improve your Core Web Vitals score or just add custom styling.
     3This is a professional tool to manipulate enqueued Styles and Scripts on your website; add custom CSS to the first screen and not first screen optionally, choose where to apply. Use it to improve your Core Web Vitals score or just add custom styling.
    44
    55## Features
     
    99* Apply changes to all posts of a specific type
    1010* Apply changes to the blog or any post-type archive
    11 * Inline, defer, or de-register Styles or JS
     11* Inline, defer, or de-register / disable Styles and Scripts
     12* Edit CSS easily with the CodeMirror visual editor
    1213* Automatic CSS minification
    13 * Edit CSS easily with the CodeMirror visual editor
     14* Instructions to get CSS
    1415
    1516## Demo
     
    2021
    2122* Install and activate the plugin.
    22 * Navigate to "First Screen CSS" in the left sidebar of your wp-admin.
    23 * Click "Add New."
     23* Navigate to "CSS Settings" in the left sidebar of your wp-admin.
     24* Click "Add New"
    2425* Input your CSS or adjust the settings.
    25 * Choose where to apply the changes and publish.
     26* Choose where to apply the changes and Publish.
     27* Repeat to apply a different set of settings to other posts.
  • fcp-first-screen-css/trunk/changelog.txt

    r2973591 r3004853  
     1= 1.7 =
     2
     3* Added the option to apply Settings by Template
     4* Added useful functions to CodeMirror editor
     5
    16= 1.6 =
    27
  • fcp-first-screen-css/trunk/first-screen.php

    r2985554 r3004853  
    22/*
    33Plugin Name: First Screen CSS & Settings
    4 Description: This is a professional tool to manipulate enqueued styles and scripts on your website and add custom CSS to first screen and not first screen optionally. Use it to improve your Core Web Vitals score or just add custom styling.
    5 Version: 1.6.4
     4Description: This is a professional tool to manipulate enqueued Styles and Scripts on your website; add custom CSS to the first screen and not first screen optionally, choose where to apply. Use it to improve your Core Web Vitals score or just add custom styling.
     5Version: 1.7.0
    66Requires at least: 5.8
    7 Tested up to: 6.3
     7Tested up to: 6.4
    88Requires PHP: 7.4
    99Author: Vadim Volkov, Firmcatalyst
     
    6565}
    6666
     67// ++Ctrl + H
     68// ++make the difference between first and second codemirrors more visible
     69// ++highlight the developers mode as it can be the source of rage
     70// ++add those metas to the table too
    6771// ++first field placeholder make more obvious
    6872// ++switch selects to checkboxes or multiples
  • fcp-first-screen-css/trunk/inc/admin/main.php

    r2982085 r3004853  
    1616add_action( 'init', function() {
    1717    $shorter = [
    18         'name' => 'First Screen CSS & Settings',
    19         'plural' => 'First Screen CSS',
     18        'name' => 'CSS Settings Set',
     19        'plural' => 'CSS Settings',
    2020        'public' => false,
    2121    ];
  • fcp-first-screen-css/trunk/inc/admin/meta-print.php

    r2982085 r3004853  
    9191    // get post types to print options
    9292    list( 'public' => $public_post_types, 'archive' => $archives_post_types ) = get_all_post_types();
     93    $all_templates = get_all_templates();
    9394
    9495    ?><p><strong>Apply to the post types:</strong></p><?php
     
    108109    ]);
    109110
    110     ?>
    111     <p>To apply this CSS Settings to a <strong>specific post</strong>, navigate to the desired post editor and choose this Setting from the dropdown menu located in the right sidebar.</p>
     111    if ($all_templates) {
     112        ?><p><strong>Apply to the Templates</strong> (doesn't depend on the options above):</p><?php
     113
     114        checkboxes( (object) [
     115            'name' => 'post-templates',
     116            'options' => get_all_templates(),
     117            'value' => get_post_meta( $post->ID, FCPFSC_PREF.'post-templates' )[0] ?? '',
     118        ]);
     119    }
     120
     121    ?>
     122    <p>To apply this CSS Settings to a <strong>specific post</strong>, navigate to the desired post post-editor and choose this Setting from the dropdown menu located in the right sidebar.</p>
    112123    <?php
    113124
     
    191202function css_type_meta_tools() {
    192203    ?>
    193     <p>The set of CSS Settings above take effect once published and applied to any post, post-type or archieve of your website. To undo the impact save the post as a draft or&nbsp;delete&nbsp;it.</p>
     204    <p>The set of CSS Settings above take effect once published and applied to any post, post-type or archive of your website. To undo the impact save the post as a draft or&nbsp;delete&nbsp;it.</p>
    194205    <p>You can <strong>extract the First-screen CSS</strong> of any page using these scripts. The instructions are provided inside.</p>
    195206    <ul>
  • fcp-first-screen-css/trunk/inc/admin/meta-save.php

    r2973591 r3004853  
    1919
    2020    if ( $post->post_type === FCPFSC_SLUG ) {
    21         $fields = [ 'post-types', 'post-archives', 'development-mode', 'inline-style-names', 'inline-script-names', 'defer-style-names', 'defer-script-names', 'deregister-style-names', 'deregister-script-names', 'rest-css', 'rest-css-defer' ];
     21        $fields = [ 'post-types', 'post-archives', 'post-templates', 'development-mode', 'inline-style-names', 'inline-script-names', 'defer-style-names', 'defer-script-names', 'deregister-style-names', 'deregister-script-names', 'rest-css', 'rest-css-defer' ];
    2222    } else {
    2323        $fields = [ 'id', 'id-exclude' ];
     
    118118        case ( 'post-archives' ):
    119119            return array_intersect( $value, array_keys( get_all_post_types()['archive'] ) );
     120        break;
     121        case ( 'post-templates' ):
     122            return array_intersect( $value, array_keys( get_all_templates() ) );
    120123        break;
    121124        case ( 'development-mode' ):
  • fcp-first-screen-css/trunk/inc/apply/main.php

    r2973591 r3004853  
    2525
    2626    if ( is_singular( $post_type ) ) {
    27         // get css by post id
     27    // get css by post id
    2828        if ( $css_id = get_post_meta( $qo->ID, FCPFSC_PREF.'id' )[0] ?? null ) {
    2929            $csss[] = $css_id;
    3030        }
    3131
    32         // get css by post-type
     32    // get css by post-type
    3333        //if ( (int) get_option('page_on_front') !== (int) $qo->ID ) { // exclude the front-page, as they stand out, mostly
    3434        $csss = array_merge( $csss, get_fcpfsc_ids( FCPFSC_PREF.'post-types', $post_type ) );
    3535        //}
    3636    }
     37
     38    // get css by archive
    3739    if ( is_home() || is_archive() && ( !$post_type || $post_type === 'page' ) ) {
    3840        // get css for blog
     
    4446    }
    4547
     48    // get css by template
     49    $template = get_page_template_slug( $qo->ID );
     50    if ( $template ) { // not default '' and not not-applied false
     51        $csss = array_merge( $csss, get_fcpfsc_ids( FCPFSC_PREF.'post-templates', $template ) );
     52    }
     53   
     54
     55
    4656    if ( empty( $csss ) ) { return; }
    4757
    48     // filter by post_status, post_type, development-mode
     58    // filter by css-post_status, post_type, development-mode
    4959    $csss = filter_csss( $csss );
    5060
  • fcp-first-screen-css/trunk/inc/functions.php

    r2973591 r3004853  
    3232}
    3333
     34function get_all_templates() {
     35    return array_flip( \get_page_templates() );
     36}
     37
    3438function css_minify($css) {
    3539    $preg_replace = function($regexp, $replace, $string) { // avoid null result so that css still works even though not fully minified
  • fcp-first-screen-css/trunk/readme.txt

    r2985554 r3004853  
    33Tags: css, first screen, style, web vitals, inline, defer, deregister
    44Requires at least: 5.8
    5 Tested up to: 6.3
     5Tested up to: 6.4
    66Requires PHP: 7.4
    7 Stable tag: 1.6.4
     7Stable tag: 1.7.0
    88Author: Vadim Volkov, Firmcatalyst
    99Author URI: https://firmcatalyst.com
     
    1111License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1212
    13 First Screen CSS & Settings
     13Manipulate enqueued Styles and Scripts on the website; add custom CSS optionally
    1414
    1515== Description ==
    1616
    17 This is a professional tool to manipulate enqueued styles and scripts on your website and add custom CSS to first screen and not first screen optionally. Use it to improve your Core Web Vitals score or just add custom styling.
     17This is a professional tool to manipulate enqueued Styles and Scripts on your website; add custom CSS to the first screen and not first screen optionally, choose where to apply. Use it to improve your Core Web Vitals score or just add custom styling.
    1818
    1919= Features =
     
    2323* Apply changes to all posts of a specific type
    2424* Apply changes to the blog or any post-type archive
    25 * Inline, defer, or de-register Styles or JS
     25* Inline, defer, or de-register / disable Styles and Scripts
    2626* Edit CSS easily with the CodeMirror visual editor
    2727* Automatic CSS minification
     28* Instructions to get CSS
    2829
    2930= Demo =
     
    3435
    3536* Install and activate the plugin.
    36 * Navigate to "First Screen CSS" in the left sidebar of your wp-admin.
    37 * Click "Add New."
     37* Navigate to "CSS Settings" in the left sidebar of your wp-admin.
     38* Click "Add New" Settincs Set
    3839* Input your CSS or adjust the settings.
    39 * Choose where to apply the changes and publish.
     40* Choose where to apply the changes and Publish.
     41* Repeat to apply a different set of settings to other posts.
    4042
    4143== Installation ==
     
    5355
    5456== Upgrade Notice ==
     57
     58= 1.7 =
     59
     60* Added the option to apply Settings by Template
     61* Added useful functions to CodeMirror editor
    5562
    5663= 1.6 =
Note: See TracChangeset for help on using the changeset viewer.