Some Code Improvement Help

  • Posted in : cvCard WP
  • isaumya
    Participant

    Hi this is a awesome theme,
    But here is some issues. In the portfolio overlay section, the the thumbnail image it uses is 400×300 which is great. See this screenshot: http://i.imgur.com/9RN3A5T.jpg This is Great and fine. No problem with this.
    But for the blog thumbnails they fetched as 720×540 and then reduced by using css. Its a lot of reduction happening in the front end. Take a look in this screenshot: http://i.imgur.com/Z8Hu2IU.jpg
    This is needed to be fetched as 400×300 like the portfolio feature image. But as it fetch 720 and then reduce that to 400, a lot of data is being fetched unnecessarily increasing the page size and load time.
    I’ve looked into the code to make the blog tile feature image to 400, but didnt find the place where to change the code. Please fix this in the theme and make it even more awesome and fast. This thing might looks very small, but this is a huge thing in terms of SEO.

    isaumya
    Participant

    Hope you guys will take a look into this and reply soon.

    isaumya
    Participant

    Solution – change needed in functions.php file
    Update this function values in the next update.

    if ( function_exists( ‘add_image_size’ ) )
    {
    add_image_size( ‘admin_feat_img’, 150 );

    add_image_size( ‘blog_feat_img’, 720); //In no circumstance (in any screen size) you need 1300 width as per your theme design. Change 1300 to 720

    add_image_size( ‘latest_posts_widget_feat_img’, 400); //720 is not needed either. Change it to 400

    add_image_size( ‘portfolio_widget_feat_img_1x’, 400 );
    add_image_size( ‘portfolio_widget_feat_img_2x’, 800 );
    }

    If you are reading this message please put a reply. I found the issue and I solved it. You people please update it into the next upadate.

    isaumya
    Participant

    Please make the changes in the next theme update. it is really needed.

    Mehmet S.
    Keymaster

    Hi, we will make some changes in the next update. Thanks for the feedback.

    isaumya
    Participant

    Thanks.

    isaumya
    Participant

    Also make sure to update this: http://www.pixelwars.org/forums/topic/this-theme-contains-malware/

    In the next update.

    isaumya
    Participant

    Hi,
    I just recieved the update notification of the theme, but no changelog was there to understand whats been updated also I’ve checked the functions.php and the image sized has not been reduced, instead they have been increased.

    See this :

    The fix I provided:

    if ( function_exists( ‘add_image_size’ ) )
    {
    add_image_size( ‘admin_feat_img’, 150 );
    add_image_size( ‘blog_feat_img’, 720);
    add_image_size( ‘latest_posts_widget_feat_img’, 400);
    add_image_size( ‘portfolio_widget_feat_img_1x’, 400 );
    add_image_size( ‘portfolio_widget_feat_img_2x’, 800 );
    }

    and what is present in the latest functions.php is ->

    if ( function_exists( ‘add_image_size’ ) )
    {
    //admin_feat_img is gone, not present in the theme
    add_image_size( ‘blog_feat_img’, 1300 ); //still using 1300 as I said 720 is enough for the theme design
    add_image_size( ‘latest_posts_widget_feat_img’, 720 ); // still at 720, needs to be 400
    add_image_size( ‘portfolio_widget_feat_img_1x’, 600 ); // increased to 600 from 400
    add_image_size( ‘portfolio_widget_feat_img_2x’, 900 ); // increased to 900 from 800
    }

    I dont understand. Maybe you guys haven’t made this changes in the update which I got notification of. I’m waiting for your reply before updating it.

    Mehmet S.
    Keymaster

    It is important for the retina screens.

    isaumya
    Participant

    Hi Sali,
    I do understand the reason, you didn’t do it. But I’m asking you that if I just copy paste this following code in my child theme functions.php as ->

    if ( function_exists( ‘add_image_size’ ) )
    {
    add_image_size( ‘admin_feat_img’, 150 );
    add_image_size( ‘blog_feat_img’, 720);
    add_image_size( ‘latest_posts_widget_feat_img’, 400);
    add_image_size( ‘portfolio_widget_feat_img_1x’, 400 );
    add_image_size( ‘portfolio_widget_feat_img_2x’, 800 );
    }

    Now will this overwrite the themes default value ? Also due to having good amount of traffic on my site I want to give my users the fastest possible experience. I do understand that this high images are very necessary in Apple Retina display but general user (hardly use mac) will never see the difference by themselves instead extra loading time. That is why I’ve decided to go with WP Retina 2x [Plugin] which will provide Retina images only when they needed, otherwise these image size are enough for normal user. So, if you please tell me how can I overwrite the values of the above function in my child theme functions.php I can actually initiate the update.

    Please reply.

    Mehmet S.
    Keymaster

    You can try it.

    isaumya
    Participant

    So, you are saying that just putting
    if ( function_exists( ‘add_image_size’ ) )
    {
    add_image_size( ‘admin_feat_img’, 150 );
    add_image_size( ‘blog_feat_img’, 720);
    add_image_size( ‘latest_posts_widget_feat_img’, 400);
    add_image_size( ‘portfolio_widget_feat_img_1x’, 400 );
    add_image_size( ‘portfolio_widget_feat_img_2x’, 800 );
    }

    in my own functions.php is enough to achieve the overwrite?

    Mehmet S.
    Keymaster

    Yes, it is.

    isaumya
    Participant

    Thank you very much Sali. I’m really grateful to you.

    Mehmet S.
    Keymaster

    You are welcome.

    isaumya
    Participant

    Also anything on the portfolio blank page thing?

    isaumya
    Participant

    Hi, man, none of them is actually working, no matter what I do the values are not getting overwritten. I’ve also tried everything mention in the following post. None of them works. Its still taking the part theme values.

    Starting with this:

    http://wordpress.stackexchange.com/questions/74934/remove-or-update-add-image-size,

    http://www.studiograsshopper.ch/code-snippets/remove-wordpress-defaultmedia-image-sizes/

    I even tried to achieve it by doing this

    update_option( ‘blog_feat_img’, 720 );
    but no matter what I do the theme is still loading my parent theme’s add_image_size() values.

    I’ve also written this following function to achieve this –

    function img_update() {
    add_image_size( ‘blog_feat_img’, 720 );
    add_image_size( ‘latest_posts_widget_feat_img’, 400 );
    add_image_size( ‘portfolio_widget_feat_img_1x’, 400 );
    add_image_size( ‘portfolio_widget_feat_img_2x’, 800 );
    }
    add_action( ‘after_setup_theme’, ‘img_update’, 11 );
    None of these is actually working. Any suggestions?

    isaumya
    Participant

    Anyways I got it.

    Mehmet S.
    Keymaster

    Ok. Good luck.

Viewing 19 posts - 1 through 19 (of 19 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register