Leon Freeman
Forum Replies Created
-
Forum: Localhost Installs
In reply to: Localhost redirects to live sitehi Sai29180
moving a website to local environment is little tricky, but it seems to me you’ve a great amount of knowledge, so you will be fine!
1) start everything over.
2) replace every url to your local url in your database file, and then import into database.
3) make changes in wp-config.php file for database name, user, password and host. (change host to “localhsot” if that something else).
4) make changes in .htaccess file in wordpress main directory, it’s same as the wp-config.php file is located.
note: .htaccess is a hidden file, so you cant see this file in normal file explorer, use ftp client to browse into it, don’t be confused if .htaccess file is not in the wordpress site folder, like you said in your post i’ve downloaded your site via cpanel, it is possible you’ve lost your original .htaccess file, because some cpanel does that, but its not big deal, you can open the web server via ftp client to download it or simply just create it a new one in you local webpress installation folder.
you can create this file in any text editor just make sure the name of the file is .htaccess and has no file extention like .php or html etc.add the code in .htaccess file:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress5) you might have to change your webpress installation folder and file permissions, in order to function properly like to installing or updating wordpress or plugins etc.
a) if using mac, paste this code in bottom of your wp-config.php file.
/* WordPress All Privileges for Localhost */ define('FTP_HOST', 'localhost'); define('FTP_USER', 'daemon'); define('FTP_PASS', 'xampp'); if(is_admin()) { add_filter('filesystem_method', create_function('$a', 'return "direct";' )); define( 'FS_CHMOD_DIR', 0751 ); }b) you need to set your wordpress site permissions to 751 or 777, what ever your needs are.
you can change this permissions manually or install some kind of app for it like BatChmod.that’s all if you’re moving a regular wordpress, if any any case you are moving a multisite, there will be additional steps, let me know if that’s the wordpress multisite!
Forum: Localhost Installs
In reply to: This is driving me crazy guysi think you are trying to embed media in text area, which probably doesn’t allow code in it the text area, however you can check that theme help docs if they allow some kind of short-code in text area.
hope this will help!Forum: Localhost Installs
In reply to: This is driving me crazy guysthere is nothing wrong with your code, but wherever you pasting that code is that’s not the right place to write code, is there an option to switch from a “visual” to “text” view, just like a same thing when you post or create page in wordpress?
Forum: Hacks
In reply to: How to Connect Multiple Databases for Search ResultsI would like to add this too, it might help you to under stand better that where i’m at.
As far is my understanding in regards to “$wpdb” that there is to initial steps to connect multiple databases.
Step #1: Database Connection
Which can be made by using the code:
global $new_wpdb;
$new_wpdb = new wpdb( $username, $password, $dbname, $servername);
$new_wpdb->show_errors();Step #2: Get Results
$results = $newdb->get_results( “SELECT <SOME FIELDS> FROM <TABLE NAME> WHERE <SOME CONDITION>” );
foreach ( $results as $result ) {
echo $result->fieldname;
}But the problem is i couldn’t able to make this code work, because i don’t know where this code goes, like it goes in “functions.php” file or “wp-includes/wp-db.php” file etc.?
And also what value has to be changed in the code above to make it work with my wordpress installation, (please see my first post for reference).
Forum: Plugins
In reply to: wpdb select doesn't work for searches containing single quotesi’m glade you made this code working on some point, i’m also looking to solve pretty similar problem, can you describe me that your code above in your post goes where (eg: in “functions.php” or somewhere eles?).
Forum: Fixing WordPress
In reply to: problem connecting with the $wpdbi also having a similar problem and posted a support page: https://ww.wp.xz.cn/support/topic/how-to-connect-multiple-databases-for-search-results
Try this:
1) When accessing the database in WordPress, you need to use the global variable “$wpdb”.
$newdb = new wpdb($DB_USER, $DB_PASSWORD, $DB_NAME, $DB_HOST);
$newdb->show_errors();2) Retrieve some data??? (which is another question, i guess)
Add the code snippet to your functions.php file or a specific page template, and then you can use $newdb just like you would $wpdb to access a second database and retrieve some data.
Source: http://bavotasan.com/2011/access-another-database-in-wordpress/