• September 15, 2018

    http://www.wpbeginner.com/wp-themes/how-to-set-oembed-max-width-in-wordpress-3-5-with-content_width/

    Well, this option is no longer there in WordPress 3.5. The decision was made to make things simpler. There is no harm in auto-enabling oEmbeds in WordPress. If it is not enabled by default, beginners often get confused. The core devs also decided to get rid of the oEmbed max width and height fields in favor of using theme’s content width and make the height 1.5 times the content width. If your theme doesn’t have the content width defined, then your oEmbed sizes will be a lot smaller. This is exactly what happened to one of the sites we manage. The theme that was being used did not have $content_width specified.
    How to Fix the oEmbed Width Issue in WordPress 3.5

    Open your theme’s functions.php file, and add the following code:

    โค๊ด: [Select]

    if ( ! isset( $content_width ) ) $content_width = 600;
    Remember to change the number 600 appropriately for your theme. It is the maximum width in pixels for your content area.

    Once you do this, WordPress will automatically use that for the maximum width of your oEmbed elements (youtube videos, slideshare, etc).

    For anybody who can’t get this working or if Youtube videos and other iframe content are not getting resized, you will need to add the following code to your style.css

    /* Make sure embeds and iframes fit their containers */
    embed,
    iframe,
    object {
    max-width: 100%;
    }

    Hope this helps. And Syed, thanks for the great post!

    How to set the size of automatic embeds for your entire WordPress site in WP 3.5 and above:

    Add this code to your theme’s functions.php document, setting your own width and height of course.

    โค๊ด: [Select]

    add_filter( 'embed_defaults', 'bigger_embed_size' );

    function bigger_embed_size()
    {
    return array( 'width' => 600, 'height' => 430 );
    }

    How to set the size of automatic embeds for your entire WordPress site in versions before 3.5:

    Login as the WordPress admin and go to Settings: Media. There you’ll see boxes for setting your maximum embed height and width. This will change the width of your embeds throughout your whole site. It’s retroactive so if you change theses settings, they’ll impact embeds even on posts and pages you authored before making the update.

    wordpress Videos YouTube default width height

    http://stackoverflow.com/questions/17033662/changing-the-default-wordpress-youtube-embeded-video-dimensions

    http://wpguru.co.uk/2014/05/how-to-change-the-width-of-an-automatic-oembed-in-wordpress/


เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories


Uncategorized