insert php plugins not working Wordpress - wordpress

In my projects, there are many links of forms, certificates. If suppose client want to migrate the project from one domain to another, automatically links should be updated. For that purpose, I have used Insert php plugin in wordpress. Also I have activated that plugin as per the given instructions. Unfortunately shortcode is also displaying in frontend. How should i get homeurl in frontend using this plugin.

Please don't use this plugin. I think enabling PHP in WordPress content is a high security risk. If the only thing you need is the home url, we you don't user relative paths? Then you are using always the right URL.
If that is not an option, consider creating a shortcode for replacing it with the home url.
//[home_url]
function home_url_shortcode( $atts ){
return home_url();
}
add_shortcode( 'home_url', 'home_url_shortcode' );
Place this in your themes functions.php and use it with [home_url]
Besides the solution of the above. If you migrate a WordPress project you should run a search/replace on the database for the old and the new domain. WordPress uses the full domain on multiple occasions. So this is not a solid solution.
https://wordpress.org/plugins/wp-migrate-db/
https://deliciousbrains.com/wp-migrate-db-pro/

Related

Wordpress - how to migrate and keep post URLs

I want to migrate my WP blog to a new hosting service. All the blog post URLs are plain URLs in the form sitename.com/?p=9999. I want to keep the same at the new hosting service. I started my blog several years ago and did not understand the difference between plain URLs and SEO-friendly URLs. Since then I have posted links to individual posts in various places and do not want those links to break. How can I accomplish this?
You can use All In One WP migration tool to migrate your website to another hosting.
When you use this tool it copies all the files and database into a .wpress file and you can use that same file to other hosting to import your website and because it keeps the URL structure to default ( so, your blog URLs should not change )
And if it doesn't work then you have to change the URL slug of every post and you can also use redirection.

Wordpress - Changing Wordpress in Place to a New Domain

I have Wordpress install at
scottmollon.com/williammessner-loebs
The files are in public_html/williammessnerloebs
But we wanted to get him his own domain.
So I got bloebs.com, and set it up as an Add-On Domain with my host provider (A2 Hosting).
I configured bloebs.com to point to /public_html/williammessnerloebs
So if you go bloebs.com you correctly see the wordpress site.
But if you click on a post it takes you to scottmollon.com/williammessnerloebs/2019/10/10/appearances/
for example.
I'd like to have all the urls be bloebs.com urls.
I tried changing the site url and home url in my Wordpress general settings, but that just breaks everything. Pages load with no formatted or styled content or images. I've fixed it by editing those urls back to scottmollon.com urls in my database.
Is there anyway I can accomplish what I hope to do?
The first step you took was the right. But there is some more to do:
Change your site url and home url. You can do this in the backend in general settings, or you can edit your wp-config.php file and add (maybe you have https):
define( 'WP_HOME', 'https://bloebs.com' );
define( 'WP_SITEURL', 'http://bloebs.com' );
Log into your backend (you will be logged out at first) and go to your general settings to check if the new url is set. Also go to "permalinks", make your choice and hit save.
Install a Plugin to overwrite the urls in your database, like https://wordpress.org/plugins/go-live-update-urls/ In this plugin you just need to enter your old wordpress url and then your new url. You do not need to overwrite plugin files, so keep that unchecked.
After that, everything sould be working fine. You can delete the plugin again, because you don't need it anymore.
If you have any urls in your theme files, that you are not getting dynamically but have inserted them by hand, you have to edit this by hand. The Plugin "Go live..." will only overwrite the urls in your database.
Hope this helps you out.

How to integrate a wordpress blog into an existing react website ? (as a www.xxxx.com/blog)

I would like a blog (that have been created, fully with wordpress) to be accessible via my already existing react website (www.xxxx.com) as (www.xxx.com/blog). Is that possible ? I have been searching over the internet to find a solution but could not find any with react/js...
Thank you !
WordPress is PHP and MySQL, not Javascript (React). But check if your host allows PHP/MySQL allongisde React.
The WordPress Codex has all the info you need on Integrating WordPress with Your Website (WordPress Codex). You will need PHP and MySQL. See Hosting Requirements (WordPress Codex).
First, assume you have an existing site at http://myexample.com. Next,
create a new sub-directory (folder) at your site and call it 'blog'
(you could use something other than blog, but you must create this
sub-directory). So you now have an empty sub-directory at
http://myexample.com/blog/. Now, download WordPress and upload all of
its files into this new folder, and install WordPress.
Then, use the header on your index.php file in /blog/ :
<?php
require('/the/path/to/your/wp-blog-header.php');
get_header();
?>
Read Integrating WordPress with Your Website (WordPress Codex)
Easiest but not the best way would be to use iframe tag. For doing this you specify local page with your blog as src.

Wordpress, using different theme: Subdomain or Multisite?

In my new job, our main website is using wordpress at www.company.com.
I'm building a company intranet that I'd like to use a different wordpress theme for, and don't want to mess up the main website. I was thinking that I should create a subdomain (i.e. intranet.company.com) and install wordpress there so that I can use a different theme, but now I'm reading about something called Multisite and I'm just super confused as to what I'm supposed to do.
Is it better to go the multisite route, or just create a subdomain and install wordpress there so that I can use a different theme?
Thank you.
multisite network is a collection of sites that all share the same WordPress installation. They can also share plugins and themes.
The individual sites in the network are virtual sites in the sense that they do not have their own directories on your server, although they do have separate directories for media uploads within the shared installation, and they do have separate tables in the database.
for details
http://codex.wordpress.org/Create_A_Network
SO in your case if you can create subdomain. then you can also install new wordpress on your subdomain.
just diff is. you need to upload plugin .theme.. etc all from your new admin.
and yes you can use another theme etc for your subdomain.
Step -1 create addon subdomain
step -2 install new wp on subdomin. and set up database
step -3. uplaod new theme and then use diff theme in subdomain
You can't literally use another theme on the same installation, but "theme" is just an abstraction after all, it can be made of an unlimited number of completely different templates, so... What you CAN do is trick Wordpress into thinking it's the same theme. A bit quirky, but otherwise fairly easy.
Big caveat: If you're looking to install an off-the-shelf theme, it's probably not worth the trouble, most likely some components down the road will break. Another caveat: Urls will become duplicate, so you may want to either properly set up wp-config to account for this, or rewrite them on the fly or maybe just set up canonicals
But if it's something purpose made, or a very simple cleanly-crafted theme or just prototyping, it works nicely.
So you have your fresh subdomain. All you have to do here is create an index.php, with a single line pointing to your main installation:
require ('/your/path/to/wp/wp-blog-header.php' );
Great progress already! At this point, your subdomain mirrors your website.
Now you want to display something else there. Add this to your functions.php:
add_filter( 'template_include', 'subdomain_theme', 99 );
function subdomain_theme( $template ) {
$uri = $_SERVER['SERVER_NAME'];
if (strpos($uri,'yoursubdomain.') !== FALSE) {
$new_template = '/your/path/to/wp/wp-content/themes/your-subdomain-theme/index.php';
if ( '' != $new_template ) {
return $new_template ;
}
}
return $template;
}
And now you have your 'basic theme' up and running!
If you want to use more templates than just index.php, you'll have to rebuild some of the wp template logic. So, create a new file in your theme directory and point to it. The relevant line from above becomes:
$new_template = '/your/path/to/wp/wp-content/themes/your-subdomain-theme/whatever.php';
And inside whatever.php point to each actual template in part:
if(is_single()) {include('/home/standard.wp/wp-content/themes/feeds/single.php');}
elseif (is_home()) { // ... easy from here
And there's your subdomain separate theme running on the same no-multisite wp instance.

Wordpress Multisite: Mobile theme on its own wordpress install reading / sync with main database

I don't want to use any plugin that redirect to mobile version (as theme is not activated and brings in lots of issues)
For now i made a new network site for the mobile theme, but when going to a post its going to the main site theme (and if i add plugin to forward main site to mobile version it kinda of works, but brings in many issues).
So best sulotion would be to have exact same replica of the main multisite wordpress on a subdomain, just with mobile theme activated for all sites in network..
problem how i can i do it?also to keep posts on mobile version in sync with the main site?
Many thanks!
and hope i was clear..
You probably don't want to run a WP Multisite - you can share users and the Wordpress install, but the posts, meta values, etc are in separate tables. If you want to run the site on a single content repository (your posts), same users, etc but just with a different theme at different domains, I would use multiple installs pointed to the same database with the mobile site pointing to a different domain by overriding the WP_HOME and WP_SITE_URL constants and a filter on get_option() (using 'option_' . $option where $option is template, stylesheet, and current_theme) to override the theme that is loaded - look at your database values with the mobile them selected to figure out what values you want to return. You have the issue of keeping the code updated between the two installs, which shouldn't be too hard to accomplish with version control (which is a good idea anyway), using a different repository for the file on the mobile site that overrides the option values, an #include perhaps.

Resources