How to reduce Wordpress post loading time (Single post) - php

I have some post in the wordpress website which has a lot of content. I have a post which is taking 30-35 second to load. Content of that page is coming from a single post and includes lot of shortcodes. Problem is I am not able to reduce the loading time which is most challenging for me. I used custom lazy loader but no luck. Any suggestions/recommendation will be highly appreciated.

I have resolved the problem by improving the code. There was some problem in amazon api which we created it. And if you hit amazon server again and again it will block your ip address. So to prevent for that there was sleep() function added which send the request to amazon after few second. I remove that one and it is working perfectly.

First off I suggest using a CDN. A good one that I use is Stackpath
Then I would also use Cloudflare
Finally and once signed up for these 2 I would follow this 2017 updated blog post
Another suggestion is to install the kraken.io plugin and signup for this as well buddy.
All of these together will speed up the entire website.

Related

How to save an html static page using PHP on Wordpress

I have a wordpress site. In my site there I have this one specific page that shows a lot of content. This content is based on many custom post types. I have built the page by writing a specific php file for that page called patio; i.e. page-patio.php.
The problem is that since the logic is complex it takes the server about 30 seconds to respond, I have optimized images and everything else that loads at the time; but I see that what takes too long is the server response.
I could try to optimize at server level, but I am seeing that it does not make any sense that all that complex logic and database reading should by done every time a user wants to display the page. The data changes once a day, maybe more often in the future.
I want to run a cron that executes a php snippet. Then that PHP snippet would prepare the page, i.e. write the html. So when a user clicks on the page I should just show that static html page and with javascript let him navigate the content.
Anyone found a solution for this?
Good morning.
Is it a server problem, or number of CSS, JS and cookies? Is it a shared server?
Maybe you change your Theme for one that use pure javascript, or a few libraries JS and CSS be better. Be right about problem: if it's with server, or number of libraries and cookies, or both situation. However, if you can't change anything, you can contract a better server service for your application.
I gave up using wordpress to priorize page performance.
I was able to solve my issue very nicely, thanks to this 10 year old post:
Link to Stackoverflow post on saving to html page
I created a cron event that runs periodically that runs a PHP Snippet; I use the Code Snippet plugin to create the event:
if ( ! wp_next_scheduled( 'iKid_cron_twicedaily' ) ) {
wp_schedule_event( time(), 'twicedaily', 'iKid_cron_twicedaily' );
}
add_action('iKid_cron_twicedaily','iKid_Static');
And then the same plugin to create the iKid_Static function.
This function uses the ob_start() and file_put_contents('yourpage.html', ob_get_contents()) commands to write the html page on my server.
And then on my actual page I code:
$content = file_get_contents($cacheFile);
echo $content;
This way my users now get all the information on that page in just 2 seconds, down from about 30 seconds.
I will be able to improve this surely when I move to a better server, but for now that is a great improvement for me.

How to auto fill Text box in php (Similar to Facebook)

What I am trying to do is to make something similar to what I see all the time on almost any website. The button that says Share to facebook. The goal for me is to let my guests share the item they are viewing in my store (Ran on prestashop) on their blog I run (Running on Oxwall).
The goal is for the button to not only link to a blog post submission webpage but to already have the subject line filled out with the item they are sharing's name and the blog post to display the information about the item. I would like to try and do all this using PHP. I am not sure how to go about doing it but I am sure that I could pass the value. Please note that I can mod BOTH the blog site and the shop as I run both and want to connect them.
As an extra bonus I am also running a forum using phpbb3 if I could do the same thing but onto that as well I would greatly thank you. I am trying to interlink everything into one big network. I know its not an easy task but I am sure there is an easy way to pass data onto the other site so that this can be done.
Facebook a 2 tools to get items informations in the page, it parses the page looking for the most common tags and it uses OpenGraph.
You can also provide product informations in the head of your page (between head tags), then blog side, you retrieve only the contents and parse it as XML.
I advise you to cache this data to avoid useless connections between websites and awful overloads while parsing.
You can use your own specifications, Open Graph or another standard, but i advise to use a standard.

Page loading issue with wordpress

My system is in wordpress -php.
Home page load so many images from third party server(itunes store) . It's take to long time in page load.
Can anybody guide me how to resolve this problem Like we first load all the contents and then after load all images.
At least customers can see the page with content.
Have you installed a Cache plugin on your wordpress like W3 Total Cache?
http://wordpress.org/extend/plugins/w3-total-cache/
If not, you can try to use Ajax to load your images from third party, then your content will be shown directly and your third party images will load without slowing the loading of the content.
Check this : http://api.jquery.com/load/ (Don't forget to use Jquery.noconflict() )
Or you can try this plugin : http://wordpress.org/extend/plugins/advanced-ajax-page-loader/
Honestly when you are depending on third party for piece of content page loading time will be always a issue. I will recommend you to use breeze cache plugin as well as multi regional WordPress Hosting which eventually help your website load basics elements from cache. Secondly closely watch out for rending issue because many WordPress website delay are just because of few lines of code mysteriously typed which can be tested on pingdom or page insight. All the best mate. Cheers

If the client accepts the plugin, can I know his navigation?

I'm trying to make a page divided in 2 frames. One that shows an external page... a shop for example,and other(mine) that offers related content to what is being shown in the external page.
I've been searching how to know the URL of the frame, but it can't be done due to security reasons(XSS, clickjacking, etc).
But I know it has to be one way to know it. I recently read that some plugins like the facebook's, have the ability to know where the client is while he is navigating.
I hope that my intention is clear. Do you know if this is possible?
Without having the site's owner install some JS on their site, you will find it very hard to find a cross-browser way to do this. FB do have people include a script and this is how they are able to access information cross domain.
You may be able to create plugins to do this, however you will have to create one per browser.

How to take my PHP form handler pages into WordPress to connect with PayPal API

I'm trying to integrate a form like this into Wordpress
This form works perfectly with the PayPal API sandbox. However, when I tried to move this work over to the WP site of my organization, globalcitizenyear.org/donate/donation-form-2/, I keep coming up short.
Anyone have any tips to keep in mind when doing this? What steps would you take first to make this happen in Wordpress - any details on what to avoid, or what potential hangups might be?
Make a page called page-donation-form-2.php and load this code into it. You can leave in the get_header() and get_footer() tags if you want to have the site wrapper around the outside.
Make sure to change your form action also. And remember, that since this is in WordPress now, you will need to avoid some reserved form elements. Full list here.
If you have any trouble, please post your code here.

Categories