• Resolved daynew

    (@daynew)


    I have added this plugin and everything works perfect. I am using the AMAZONPRODUCTS shortcode in posts with a little bit of CSS.

    Now my site seems to be loading really slow. Could this have anything to do with this plugin and calling to the API? Just wanted to check incase I am doing something wrong that could help with this issue.

    thanks.

    https://wordpress.org/plugins/amazon-product-in-a-post-plugin/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Can you send me a link to the site and I will look at it to see.

    If you are using many products on a page, and have them in a separate shortcode – they will each need to be calling the API, so, yes, that could slow down the site. The best way to add multiple items on a page is in one shortcode, if possible, by separating them with a comma. Like so:

    [AMAZONPRODUCTS asin="XXXXXXXXXXX,XXXXXXXXXXX,XXXXXXXXXX"]

    This will complete the API call as one call and load quicker.

    Regards,
    Don

    Thread Starter daynew

    (@daynew)

    ok…The most I have posted is two on a page, but they are in different spots. We do have other ads and things on the site. It is located here: http://www.parentingpad.com

    Thread Starter daynew

    (@daynew)

    I think I have it figured it out. It seems to be CSS issues that I created.

    Thread Starter daynew

    (@daynew)

    Actually it is still happening.

    It seems to be somehow related to appip_style loading.

    Any ideas? It has taken the site for 3sec load time to over 60secs with this plugin and the CSS loading.

    I sent you some code yesterday to fix the issue (or I thought I did, but ended up sending to someone else).

    Here is the code – add this to your functions.php to change the loading of the styles:

    // START CODE COPY
    if(function_exists('aws_prodinpost_addhead')){
        remove_action('wp_head', 'aws_prodinpost_addhead',10);
        add_action('wp_enqueue_scripts', 'aws_prodinpost_addhead_new',10);
        function aws_prodinpost_addhead_new(){
                $ajax_nonce = wp_create_nonce( 'appip_style_verify' );
                wp_enqueue_style('appip-dynamic',admin_url('admin-ajax.php').'?action=appip_dynaminc_css_custom&nonce='.$ajax_nonce,array(),null);
                wp_enqueue_style('appip-lightbox', plugins_url().'/amazon-product-in-a-post-plugin/css/amazon-lightbox.css', array(),null);
        }
    }
    function appip_dynaminc_css_custom() {
          check_ajax_referer( 'appip_style_verify', 'nonce', true );
          $usemine    = get_option('apipp_product_styles_mine', false);
          $data       = $usemine ? get_option('apipp_product_styles', '') : get_option('apipp_product_styles_default', '') ;
          echo $data;
          exit;
    }
    add_action('wp_ajax_appip_dynaminc_css_custom', 'appip_dynaminc_css_custom');
    add_action('wp_ajax_nopriv_appip_dynaminc_css_custom', 'appip_dynaminc_css_custom');
    // END CODE COPY

    Let me know if you still have issues.

    Regards,
    Don

    This was added to 3.5.3 version, so you should no longer need this function.

    Additionally, if you want to keep your own styles in your theme folder, you can copy the styles in the options and then create a file called appip-styles.css and put in your theme folder root or in a css folder in the theme folder. The plugin will look for the root file first, then the css file and if neither are present, it will load dynamic styles.

    This will speed up the page load in most cases.

    Warmest regards,
    Don

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Site slowing down..’ is closed to new replies.