How to make angular html5 routing to work with wordpress - wordpress

Hey I'm integrating an angular 6+ app into a web page created by wordpress.
I have made it that the app is running and everything, but can't seem to solve the issue where when you open a route of the angular app by clicking on a link outside wordpress or pasting the url in the address bar, wordpress says 404.
I have it like so:
http://example.com/angularApp // This url opens fine
angularApp is a page created by WP (I have hosted scripts and styles in there)
When I try to open http://example.com/angularApp/somecustom route Wordpress tells me that there is nothing on that url.
I saw that I need to use some kind of rewriting but could not get a good example. Can you please help me?

I added the rewrite rule into the functions.php file located in the theme folder which made it work.
I have the following code added to the function et_setup_theme():
add_action('init', 'custom_rewrite_basic_angularApp');
function custom_rewrite_basic_icoranker() {
add_rewrite_rule(
'angularAppRoute',
'index.php?page_id=116414',
'top'
);
}
where angularAppRoute is the page route that I have hosted my angular app into.
http://example.com/angularAppRoute
Hope this helps someone else as well.

Related

Cannot add or edit current pages in Wordpress

I keep getting this page whenever I try to edit or add a new page. I cannot do anything to edit my Wordpress pages. My website currently uses WordPress 5.3.2 and it also uses the new Avada theme 6.2. It has been like this all day. What I see when I click to edit through fusion builder or the regular wordpress editor
I can assume that there is an issue with CSS files delivery, it looks like the styles files (css files) are not being opened on your website page.
Possible reasons that might cause this are:
404 error: means all .css files are being called from the wrong URL which might happen if you changed your website URL recently.
You might have moved your website to SSL which changes the http:// to https://.
Possible solutions:
Try to clean your website cache.
Try to access your website using the private session within your browser.
Can you please share your website url?
You can try looking at the browser console to see what error is occurring.
In the recent version of Wordpress this is causing performance errors at its core:
Try adding the line below to your wp.config file below that IF:
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
define('CONCATENATE_SCRIPTS', false);
I had an error that did not load JQuery, when clicking on any button to upload files not working. So after I added the last line it worked.

javascript is not running in wordpress

I have problem with running javascript codes in may pages.
I tried testing my code in xampp and it was working.
but I can not see them when I add them to my pages or my posts in my host and I installed wordpress again and it wasn't working.
Please help me
There are a few ways you can include JavaScript files in WordPress, I will give you one example using your child theme.
First you need to validate whether or not you actually have a child theme. Use FTP to login to you server and go to the wp-contents/themes directory. There you will see all your installed themes (in your case betheme). If you do not have a child theme follow these steps:
Create a new directory in your themes folder (betheme-child).
Upload your JavaScript file in this directory (for example script.js)
Create a new file called functions.php and add the following code to it: (surrounded by php opening and closing tags):
add_action('wp_enqueue_scripts', 'enqueue_child_scripts');
function enqueue_child_scripts() {
wp_enqueue_script('child-script', get_template_directory_uri() . '/script.js');
}
Login to your wp-admin and navigate to your themes
Enable your child theme instead of your normal theme.
Go to the front-page of your website, look at the page source and check if your JavaScript file is being loaded.
If you are using cloudflare, turn off minify JS.

Error displaying oEmbed Wordpress

I've a problem with my wordpress website. When I insert some url for being embedded, it's not working fine.
Here is the issue URL : https://www.duosia.id/windows/cara-mengekstrak-files-menggunakan-winrar-dengan-mudah
And here is the Screenshot :
When I try to visit the embedded url. It's return 404 not found. You can check the embedded url here, https://www.duosia.id/windows/cara-mengekstrak-files-menggunakan-winrar-dengan-mudah/embed/
I've try these common solutions.
Update everything including WordPress, the theme and plugins. Available updates appear in Dashboard > Updates.
Deactivate all plugins in case there is a conflict. If the problem goes away while all plugins are inactive, then reactivate them one by one to determine which is causing the problem.
Switch to the default theme (such as Twenty Thirteen) then try to do what was not working. If the problem remains, it is a general WordPress or hosting issue. If it happens only while using our theme, please let us know.
Clear cache in both your browser and in any caching plugins that you are using (also disable services like CloudFlare, if used with your website).
Revert code changes if you have modified the theme’s code. If using a child theme, reactivate the parent theme.
But, seems no one work.
The WordPress post embeds don't seem to be working on your site.
This URL shows a live example of the problem:
https://www.duosia.id/windows/whatsapp-for-pc/
The two embeds present in that URL are returning a 404, therefore, oEmbeds are not loading properly and showing the 404 page:
https://www.duosia.id/windows/facebook-messenger-for-pc/embed/#?secret=kMPv636bx1
https://www.duosia.id/windows/line-for-pc/embed/#?secret=65m4VpxiYi
Have you tried testing those URLs in the plugin "Rewrite Rules Inspector"?
You should see something like this for any of the "embed" URLs:
index.php?name=$matches[1]&embed=true
Also, have you tried flushing the rewrite rules in WordPress or maybe setting the permalink structure to a different/default one (right now you seem to be using a structure of "category/post-name") to see if it changes anything?
For the file that you are embedding, are you uploading it to the Media Library or some other plugin?
First I would check on the server to verify that the file you are looking to access does exist.
Once you know that the file does exist, then repeat the steps you have listed again.

WordPress widgetkit 4 slideshow dosen't work- how to edit css files path

lately i received a WordPress website that was built by someone else and was ditched at the middle of process.
before they handed it to me they moved it to a new server.
the problem is that the slider at the front page does no receive the css and js files it needs.
when i download the website to my localhost the slider woks great.
this is the link to the old server (the site is in a folder called 'new' which can cause the problem)
this is the link to the new server.
where can i control or edit the url path of the widgetkit 4 plugin?
how can i fix the problem?
tnx.

Reverse proxy heroku app to wordpress blog

I've managed to setup a reverse proxy of my heroku app with the following in config.ru
require ::File.expand_path('../config/environment', __FILE__)
use Rack::ReverseProxy do
reverse_proxy /^\/blog(.*)$/, 'http://blog.domain.com$1', opts={:preserve_host => true}
end
run Appname::Application
This allows my heroku app to run at domain.com and have domain.com/blog appear as the URL while the wordpress site is being served blog.domain.com. Great so far.
The wordpress site gets served properly when going to domain.com/blog, however when I go to any deeper page like an individual post wordpress throws an error. I was using permalinks with the date and title in the URL of the form: domian.com/blog/2012/07/a-great-blog-post - Worpress now seems to not like this. When I switched the links back to the form domain.com/blog/?p=4 the page gets served successfully.
It seems like it doesn't handle and sort of trailing slashes after the inial domain.com/blog properly. What I find strange is domain.com/blog/wp-admin (and the entire WP admin app) works without any hiccups.
Can anyone see any glaring issues why the pages/post with multiple slashes '/' might be causing problems?
Thanks in advance!
Well I found a solution, for whatever reason in the WP settings for the permalink, it didn't like any of the default options except for the form where it can retrieve the post by id. (http://www.domain.com/blog/?p=123)
For SEO purposes I wanted the title of the post to be in the URL. So I entered in the custom structure field:
/index.php/%postname%/
It seems like it was requiring index.php for wordpress to handle the routing properly.

Resources