Ready to get started?Download WordPress


Help needed with function to get size of post_thumbnail set by admin in Settings (1 post)

  1. supergab
    Posted 3 years ago #


    I use the following code in functions.php in order to load jQuery and set variables that I need to use in my jQuery script (width and height of the post thumbnail).

    if( !is_admin()){
       wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"), false, '');
       wp_localize_script( 'jquery', 'MyThumbSize', array( 'width' => '240px','height' => '160px' ) );

    I would like to know if it is possible to automatically obtain these values from a function and what would be the syntax (Since I'm not a good coder).

    I know these settings are set by the admin the dashboard under Media Settings.

Topic Closed

This topic has been closed to new replies.

About this Topic