Plugin Directory

Changeset 3282154


Ignore:
Timestamp:
04/25/2025 10:25:36 PM (11 months ago)
Author:
ampwptools
Message:

modified script to only include the button on the post editor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • accelerate-patterns/tags/1.0.3/script/acceleratePatternsClass.js

    r3282147 r3282154  
    1010jQuery(document).ready(function(){ accpatternsEditorToolbarButton(); });
    1111function accpatternsEditorToolbarButton() {
    12     var aria = 'Create a custom pattern using the selected blocks.';
    13     var html = '<ul id="ab-top-accpatterns" class="ab-top-menu" role="menu" style="color:white;">';
    14         html += '<li id="wp-admin-bar-accpatterns-create" class="menupop with-avatar" role="group">';
    15             html += '<div id="accpatternsPatternButton" onclick="accpatternsCreatePattern();" class="ab-item" style="padding:0 8px;cursor:pointer;" alt="'+aria+'" title="'+aria+'" aria-label="'+aria+'"><i class="ab-icon dashicons dashicons-superhero"></i> Create Pattern</div>';
    16         html += '</li>';
    17     html += '</ul>';
    18     jQuery('#wp-toolbar').append( html );
     12    if(document.body.classList.contains('post-php')){
     13        var aria = 'Create a custom pattern using the selected blocks.';
     14        var html = '<ul id="ab-top-accpatterns" class="ab-top-menu" role="menu" style="color:white;">';
     15            html += '<li id="wp-admin-bar-accpatterns-create" class="menupop with-avatar" role="group">';
     16                html += '<div id="accpatternsPatternButton" onclick="accpatternsCreatePattern();" class="ab-item" style="padding:0 8px;cursor:pointer;" alt="'+aria+'" title="'+aria+'" aria-label="'+aria+'"><i class="ab-icon dashicons dashicons-superhero"></i> Create Pattern</div>';
     17            html += '</li>';
     18        html += '</ul>';
     19        jQuery('#wp-toolbar').append( html );
     20    }
    1921}
    2022function accpatternsCreatePattern() {
Note: See TracChangeset for help on using the changeset viewer.