Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1235718
    AnneInnes
    Participant

    Hi
    I found this useful thread to stop images appearing in many sizes. https://community.theme.co/forums/topic/stop-x-from-generating-different-images-sizes/
    My questions is how exactly do I edit the functions.php file in the Child Theme?
    Thanks

    #1235737
    Thai
    Moderator

    Hi There,

    You just need to add the following code at the end of your functions.php file:

    function x_setup_theme() {
    
    	//
    	// Localization.
    	//
    	// Translations can be added to the /framework/lang/ directory.
    	//
    
    	load_theme_textdomain( '__x__', X_TEMPLATE_PATH . '/framework/lang' );
    
    	//
    	// Automatic feed links.
    	//
    	// Adds RSS feed links to <head> for posts and comments.
    	//
    
    	add_theme_support( 'automatic-feed-links' );
    
    	//
    	// Post formats.
    	//
    	// Adds support for a variety of post formats.
    	//
    
    	add_theme_support( 'post-formats', array( 'link', 'gallery', 'quote', 'image', 'video', 'audio' ) );
    
    	//
    	// WordPress menus.
    	//
    	// This theme uses wp_nav_menu() in two locations.
    	//
    
    	register_nav_menus( array(
    	  'primary' => __( 'Primary Menu', '__x__' ),
    	  'footer'  => __( 'Footer Menu', '__x__' )
    	) );
    
    	//
    	// Featured images.
    	//
    	// Theme support for featured images and thumbnail sizes.
    	//
    
    	add_theme_support( 'post-thumbnails' );
    
    	//
    	// WooCommerce.
    	//
    	// Theme support for the WooCommerce plugin.
    	//
    
    	add_theme_support( 'woocommerce' );
    
    	//
    	// Allow shortcodes in widgets.
    	//
    
    	add_filter( 'widget_text', 'do_shortcode' );
    
    	//
    	// Remove unnecessary stuff.
    	//
    	// 1. Version number (for security).
    	// 2. Really simple discovery.
    	// 3. Windows live writer.
    	// 4. Post relational links.
    	//
    
    	remove_action( 'wp_head', 'wp_generator' );                    // 1
    	remove_action( 'wp_head', 'rsd_link' );                        // 2
    	remove_action( 'wp_head', 'wlwmanifest_link' );                // 3
    	remove_action( 'wp_head', 'start_post_rel_link' );             // 4
    	remove_action( 'wp_head', 'index_rel_link' );                  // 4
    	remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); // 4
    
    }
    add_action( 'after_setup_theme', 'x_setup_theme' );

    Regards!

    #1235853
    AnneInnes
    Participant

    Hi
    Thanks for this but how do I edit the functions.php file?
    Thanks

    #1235886
    Thai
    Moderator

    Hi There,

    Please navigate to this link: http://yourdomain.com/wp-admin/theme-editor.php?file=functions.php&theme=x-child

    Hope it helps πŸ™‚

    #1235893
    AnneInnes
    Participant

    Hi, that link maybe broken – doesnt show anything about X and says the domain is for sale.
    Please advise
    Thanks

    #1235904
    AnneInnes
    Participant

    Ive now edited the functions.php file in wp-contents/themes/x/functions.php but it still makes the files appear in triplicate
    Thanks

    #1235960
    Thai
    Moderator

    Hi There,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1237534
    AnneInnes
    Participant

    Hi its a dev site using MAMP so the live one isnt showing these issues. In the dashboard media library I can see one copy of each image however in the uploads folder there are still 3 copies of any new images I add
    Thanks

    #1237547
    Lely
    Moderator

    Hi There,

    Unfortunately, we really need to access your site via FTP and wordpress admin to check where the issue is coming from. It will be hard to recommend something if we didn’t see the setup.

    #1237554
    AnneInnes
    Participant
    This reply has been marked as private.
    #1237576
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! Please keep in mind that by default, when you upload an image, WordPress will generate a thumbnail, medium and a large size. To know more about this, please check it here: https://codex.wordpress.org/Settings_Media_Screen

    This is basically a pretty basic setting in WordPress and the reason why you have 3 copies of the images something with the following filename:
    – image-name-150×150.jpg
    – image-name-300×300.jpg
    – image-name-1024×1024.jpg

    Removing these three image sizes would mean modifying WordPress defaults which is not advisable.

    Hope this explains it.

    #1237602
    AnneInnes
    Participant

    ok many thanks

    #1237623
    Thai
    Moderator

    If you need anything else please let us know.

  • <script> jQuery(function($){ $("#no-reply-1235718 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>