Forum Replies Created

Viewing 15 replies - 61 through 75 (of 105 total)
  • Thread Starter DJABHipHop

    (@pressthemes1)

    @qriouslad Revisions Control bug still precent if I set Revisions Control to 0 is default to 10, but i can set it to -1 witch is odd AF

    Thread Starter DJABHipHop

    (@pressthemes1)

    nP

    DJABHipHop

    (@pressthemes1)

    @qriouslad wouldn’t it be easier to use the media uploader instead of a url field?

    DJABHipHop

    (@pressthemes1)

    @ale-maciel 1 & 2 is cool, but 2 is very useful to me as a WP developer.

    Thread Starter DJABHipHop

    (@pressthemes1)

    @qriouslad being able to readjust the crop point

    DJABHipHop

    (@pressthemes1)

    that belong in the free version along with a way to add prevent this from happening when replacing the media file. Or a way to black list certain files from being shown in the front end

    Thread Starter DJABHipHop

    (@pressthemes1)

    @tinnyfusion No not really, because you can check if the link contain the blog url you skip it complete.

    • This reply was modified 10 months ago by DJABHipHop.

    @qriouslad Why no add a way to enable Content Duplication for each custom post type instead?

    I’m guessing thats would not be useful in a portfolio, woocommerce site or music page, since the ere no author & just product, a grid past work or list /grid song demo, etc.

    @tinnyfusion @david-innes I’ve made all the columns sortable and add 3 new column 1 accessibility stats, 1 seo stats & one to show for file EXT witch are also sortable as well granted the accessibility & seo status column are no perfect nor sortable yet

    // Register custom columns for media library
    function asenha_add_more_media_columns($columns) {
        $columns['asenha-media-ext'] = __('Type', 'textdomain');
        $columns['seo-status'] = __('SEO', 'textdomain');
        $columns['accessibility-status'] = __('Accessibility', 'textdomain');
        return $columns;
    }
    add_filter('manage_media_columns', 'asenha_add_more_media_columns');
    
    // Populate content for custom columns in media library
    function asenha_add_more_media_column_content($column_name, $attachment_id) {
        switch ($column_name) {
            case 'asenha-media-ext':
                // Display file extension in uppercase
                $file_url = wp_get_attachment_url($attachment_id);
                $filetype = wp_check_filetype($file_url);
                echo strtoupper($filetype['ext']);
                break;
    
            case 'seo-status':
                // Check SEO status (alt text and caption)
                $alt_text = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
                $caption = get_post_field('post_excerpt', $attachment_id);
    
                if (!empty($alt_text) && !empty($caption)) {
                    // Display green checkmark icon if both alt text and caption are set
                    echo '<span class="dashicons dashicons-yes" style="color: green;"></span>';
                } elseif (!empty($alt_text) && empty($caption)) {
                    // Display yellow checkmark icon if either alt text or caption is set
                    echo '<span class="dashicons dashicons-yes" style="color: yellow;"></span>';
                } else {
                    // Display red x icon if neither alt text nor caption is set
                    echo '<span class="dashicons dashicons-no" style="color: red;"></span>';
                }
                break;
    
            case 'accessibility-status':
                // Check accessibility status (alt text)
                $alt_text = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
            
                if (!empty($alt_text)) {
                    // Display green checkmark icon if alt text is set
                    echo '<span class="dashicons dashicons-yes" style="color: green;"></span>';
                } else {
                    // Display red x icon if alt text is not set
                    echo '<span class="dashicons dashicons-no" style="color: red;"></span>';
                }
                break;
    
            default:
                // Handle default case (if column name doesn't match any of the above)
                echo '';
                break;
        }
    }
    add_action('manage_media_custom_column', 'asenha_add_more_media_column_content', 10, 2);
    
    /**
     * Make asenha-file-size sortable
     */
    function asenha_make_file_size_columns_sortable($sortable_columns) {
        $sortable_columns['asenha-file-size'] = 'asenha-file-size';
        $sortable_columns['asenha-media-ext'] = 'asenha-media-ext';
        $sortable_columns['asenha-id'] = 'asenha-id';
        return $sortable_columns;
    }
    add_filter('manage_upload_sortable_columns', 'asenha_make_file_size_columns_sortable');
    
    /**
     * Handle sorting asenha-file-size
     */
    function asenha_sort_media_by_file_size($query) {
        if (!is_admin() || !$query->is_main_query()) {
            return;
        }
    
        $orderby = $query->get('orderby');
    
        if ($orderby === 'file_size') {
            $query->set('meta_key', '_wp_attachment_filesize');
            $query->set('orderby', 'meta_value_num');
        }
    
        if ($orderby === 'id') {
            $query->set('meta_key', '_wp_attachment_id');
            $query->set('orderby', 'meta_value_num');
        }
    
        if ($orderby === 'ext') {
            $query->set('meta_key', '_wp_attachment_ext');
            $query->set('orderby', 'meta_value_text');
        }
    }
    add_action('pre_get_posts', 'asenha_sort_media_by_file_size');

    Try this code I’ve tested and it works 100%.

    /**
     * Make asenha-file-size sortable
     */
    function asenha_make_file_size_columns_sortable($sortable_columns) {
        $sortable_columns['asenha-file-size'] = 'asenha-file-size';
        return $sortable_columns;
    }
    add_filter('manage_upload_sortable_columns', 'asenha_make_file_size_columns_sortable');
    
    /**
     * Handle sorting asenha-file-size
     */
    function asenha_sort_media_by_file_size($query) {
        if (!is_admin() || !$query->is_main_query()) {
            return;
        }
    
        $orderby = $query->get('orderby');
    
        if ($orderby === 'file_size') {
            $query->set('meta_key', '_wp_attachment_filesize');
            $query->set('orderby', 'meta_value_num');
        }
    }
    add_action('pre_get_posts', 'asenha_sort_media_by_file_size');

    Here how it done just replace universal-theme with your themes text domain

    comments_number( __('0 Comments', 'universal-theme'), __('1 Comments', 'universal-theme'), __('% Comments ', 'universal-theme') );

    Skip this line as breaks the back end

    add_filter('script_loader_tag', 'add_async_defer', 10, 3); 

    I agree

    ? ? register_block_pattern(
    
    ? ? ? ? 'simple-basic-contact-form',
    
    ? ? ? ? array(
    
    ? ? ? ? ? ? 'title' => __('Simple Basic Contact Form', 'your-text-domain'),
    
    ? ? ? ? ? ? 'description' => __('A block pattern with a single column for the Simple Basic Contact Form plugin shortcode. Requires the Simple Basic Contact Form plugin to be installed and activated.', 'universal-theme'),
    
    ? ? ? ? ? ? 'content' => '<!-- wp:columns {"verticalAlignment":"center","isStackedOnMobile":false,"align":"full"} -->
    
    ? ? ? ? ? ? ? ? <div class="wp-block-columns alignfull are-vertically-aligned-center is-not-stacked-on-mobile"><!-- wp:column {"verticalAlignment":"center","width":"100%"} -->
    
    ? ? ? ? ? ? ? ? <div class="wp-block-column is-vertically-aligned-center" style="flex-basis:100%"><!-- wp:shortcode -->
    
    ? ? ? ? ? ? ? ? [simple_contact_form]
    
    ? ? ? ? ? ? ? ? <!-- /wp:shortcode --></div>
    
    ? ? ? ? ? ? ? ? <!-- /wp:column --></div>
    
    ? ? ? ? ? ? ? ? <!-- /wp:columns -->',
    
    ? ? ? ? ? ? 'categories'? => array('contact'),
    
    ? ? ? ? )
    
    ? ? );

    Try this to improve security & increase performance

    /**
    
    ?* Remove the 'type="text/css"' attribute from stylesheet link tags.
    
    ?*
    
    ?* @param string $tag The complete HTML tag for the stylesheet.
    
    ?* @param string $handle The name of the stylesheet.
    
    ?* @param string $src The URL of the stylesheet file.
    
    ?* @return string The modified HTML tag for the stylesheet.
    
    ?*/
    
    function preload_css($tag, $handle, $src){
    
    ? ? return str_replace('type="text/css"', "", $tag);
    
    }
    
    add_filter('style_loader_tag', 'preload_css', 10, 3);
    
    /**
    
    ?* Remove the 'type="text/javascript"' attribute from script link tags.
    
    ?*
    
    ?* @param string $tag The complete HTML tag for the script.
    
    ?* @param string $handle The name of the script.
    
    ?* @param string $src The URL of the script file.
    
    ?* @return string The modified HTML tag for the script.
    
    ?*/
    
    function preload_script($tag, $handle, $src){
    
    ? ? return str_replace('type="text/javascript"', "", $tag);
    
    }
    
    add_filter('script_loader_tag', 'preload_script', 10, 3);
    
    /**
    
    ?* Remove query strings from script and style URLs.
    
    ?*
    
    ?* @param string $src The URL of the script or style.
    
    ?* @return string The URL without query strings.
    
    ?*/
    
    function wpcode_snippet_remove_query_strings_split($src) {
    
    ? ? $output = preg_split( "/(&ver|\\?ver)/", $src ); // Split the URL by '&ver' or '?ver'
    
    ? ? return $output ? $output[0] : ''; // Return the URL without query strings
    
    }
    
    add_filter('script_loader_src', 'wpcode_snippet_remove_query_strings_split', 15);
    
    add_filter('style_loader_src', 'wpcode_snippet_remove_query_strings_split', 15);
    
    function add_async_defer($tag, $handle, $src) {
    
    ? ? return "<script async='async' defer='defer' src='".$src."'></script>";
    
    }
    
    add_filter('script_loader_tag', 'add_async_defer', 10, 3);
Viewing 15 replies - 61 through 75 (of 105 total)