What I'd like to do is to have two or more WP databses under the same instalation, each with its own posts, and dynamically switch between them at loading time.
For example, instead of directly plugging WP when a visitor loads the site, first run a PHP script for geo-location and based on this script's result to tell WP which database to load up.
I know about switch_blog but I understand it's a backend technique as it's expensive to run on the front-end.
Thanks
Related
(I am not sure if this is the proper place for this post. If not, just let me know where to repost it. I don't have a lot of experience with PHP. I 'know' just enough to be dangerous.)
I am using the CMS, HTMLy, and am trying to list the archives on a separate page, instead of a side column.
In the main page the following command is used to display the archives in the column:
<?php echo archive_list() ?>
However, I am having a problem getting the PHP to display the list on a web page. The system uses markdown (.md) so I can't run it from there.
Any suggestions?
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.
I am creating web portal in WordPress for that I am using i-craft WordPress theme. But my website page loading very slow at initial load that is before loading of all content. Its taking 8 - 10 sec to initial load. I know this is happening due to lots php code with lots of functions and loops. I want to remove all unnecessary code or php file. As my website belongs to only single theme and I don't want to add post functionality etc. so which file/php code/information in database I have to remove that will helps website to load initially faster. Or is there any way to make loading very fast without removing code or files.
You can use
https://gtmetrix.com
on here you can check your site analytic report .and you want to do minify your css and js file.and also images .
I'm building a webapp which main purpose is displaying widgets on a display. These widgets have an variable size, so not every widget is even high or wide (But they are using standards like for example a grid system). Now I'm looking for the best way to save which widgets are used, and where they are placed. For example by using something like Gridstack the user can drag and place the widgets in an admin panel, but how should I save this? And how can I recall this and put in a empty Bootstrap page for example. Working with the Bootstrap Grid system would be great aswell.
I did some research on Google and here but didn't find any plugins or ways to do this.
I'm using 'Gridster' at the moment which this Gridstack is built off of/inspired by, so it probably won't be able to save for you.
You'll need to do that, either by sending it back via AJAX or storing in local storage. As it looks similar, you should be able to find a 'serialization' function which should wrap it up ready for you to send to your PHP via AJAX.
You may need to scan through the widgets and wrap them up in your own JSON string, such as the row/column/sizex/sizey which is all the grid system really needs to "add" a widget when its first loaded up, so as long as you can feed that back in you should be good to go.
I am a beginner at using mysql/phpmyadmin, and have never used a cms before. I'm trying to get my head around how I could possibly add a 'similar posts' type script - but instead of showing posts, I would like to show some similar images (similar projects) when viewing each project page of my website.
My website setup is fairly simple:
main html page
profile html page
portfolio php page -> has thumbnail images with links to php generated url project pages
project page -> a dynamic php page that generates pages from pagination
contact html page.
The project php page has a jquery slideshow, project title and project overview text. The page uses three sql database tables for the data (slideshow images/text, page id for the pagination and one for normalisation), and uses pagination to change the data, creating a page for each project.
I'd really appreciate any ideas/opinions on how I could go about doing this - with sql, or am better off using a CMS (if so, do you know of a really simple one that could suit my website setup?).
If you're mainly wondering how you determine similarity, then you can do that with a text search in MySQL. I also found this page if you want to go to the trouble of building a tagging database schema. The former is simpler, but the latter is a really useful if you want to practice joins.