Total: 6 Sections

If you want to change the slug for your 'business_listing' post type to 'business', then add this code in your 'code-snippets' plugin.

https://zemez.io/wordpress/support/knowledge-base/changing-custom-post-type-slug/

Step 1: Modify code to match your post type

add_filter( 'your-post-type_post_type_args', '_my_rewrite_slug' ); // Here replace "your-post-type" with the actual post type, e.g., "cherry_services", "cherry-projects"
            function _my_rewrite_slug( $args ) {
            $args['rewrite']['slug'] = 'our-services'; // Replace "our-services" with your preferable slug
            return $args;
        }

Step 2: Refresh permalinks

  • Go to permalinks page - /wp-admin/options-permalink.php
  • Click "SAVE"

Sample code that can be added directly into 'snippet' plugin - no need to image size plugins.

  1. This will create two custom image sizes and should show up in the media size dropdown selections.
// First we'll add support for featured images
// add_theme_support( 'post-thumbnails' );
// Then we'll add our 2 custom images
// add_image_size( 'featured-large', 1600, 400, true );
add_image_size( 'two-col-width', 500, 335 );
add_image_size( 'square', 200, 200, true );

// And then we'll add the custom size that spans the width of the blog to the Gutenberg image dropdown
add_filter( 'image_size_names_choose', 'jazzy_custom_image_sizes' );
function jazzy_custom_image_sizes( $sizes ) {
    return array_merge( $sizes, array(
        'two-col-width' => __( 'Two Col Width' ),
		'square' => __( 'Square' ),
    ) );
}
  1. Once added go to Tools > Regenerate Thumbnails
    (install Shortpixel https://wordpress.org/plugins/regenerate-thumbnails-advanced/ if not installed already)

https://premium.wpmudev.org/blog/wordpress-image-sizes/


Other Options/Research:

Use: Simple-image-sizes plugin
https://wordpress.org/plugins/simple-image-sizes/
Goto: Settings > Media to add/delete custom sizes.

Manual Process Docs:

https://havecamerawilltravel.com/photographer/wordpress-thumbnail-crop/

Hard Crop

/* Add new image sizes */
add_image_size( 'my200px-thumbnail', 200, 200, TRUE );

Other Options:

/*top left*/
add_image_size( 'wordpress-thumbnail', 200, 200, array( 'left', 'top' ) );
/*center left*/
add_image_size( 'wordpress-thumbnail', 200, 200, array( 'left', 'center' ) );
/*center*/
add_image_size( 'wordpress-thumbnail', 200, 200, array( 'center', 'center' ) );

ADD YOUR CUSTOM IMAGE SIZES TO THE MEDIA IMPORT SELECTOR

https://developer.wordpress.org/reference/functions/add_image_size/

https://www.makeuseof.com/tag/complete-guide-featured-thumbnails-image-sizes-wordpress/

You should change ‘your-specified-image-size` with the name that you set in the previous step. 

add_filter( 'image_size_names_choose', 'my_custom_image_sizes' );
 
function my_custom_image_sizes( $sizes ) {
    return array_merge( $sizes, array(
        'your-custom-size' => __( 'Your Custom Size Name' ),
    ) );
}

Note: To enable featured images the current theme must include add_theme_support( ‘post-thumbnails’ ); in its functions.php file. See also Post Thumbnails.

if ( has_post_thumbnail() ) { 
    the_post_thumbnail( 'your-custom-size' ); 
}

 

add_theme_support( 'your-custom-size');

 

https://www.facebook.com/groups/1626639680763454/permalink/2474601319300615/

<?php
// Disable Youzer template !
function yzc_disable_youzer_template() {
remove_filter( 'template_include', 'youzer_template', 99999 );
}
add_action( 'bp_init', 'yzc_disable_youzer_template', 9 );

 

 

function ele_disable_page_title( $return ) {
   return false;
}
add_filter( 'hello_elementor_page_title', 'ele_disable_page_title' );

Use code snippet plugin
https://wordpress.org/plugins/code-snippets/

- setting: 'run snippet everywhere'

Elementor Child Theme
https://github.com/elementor/hello-theme-child

Remove jquery-migrate with dependency check.

https://joewp.com/en/remove-jquery-migrate/

//Remove JQuery migrate
function remove_jquery_migrate($scripts)
{
    if (!is_admin() && isset($scripts->registered['jquery'])) {
        $script = $scripts->registered['jquery'];
        
        if ($script->deps) { // Check whether the script has any dependencies
            $script->deps = array_diff($script->deps, array(
                'jquery-migrate'
            ));
        }
    }
}

add_action('wp_default_scripts', 'remove_jquery_migrate');

 

This is useful for client with Admin access to not allow one click update of plugins.

Use ManageWP to do the updates.

remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );

 

DISCUSS 0 Comments
No comments