Just like we have _app.tsx and we can receive a Component in props dynamically according to the route, can we have another page at a different level with the same kind of functionality?
Here is an example of what I require:
My App page has a static header and dynamic body. The static header has links, when a link is clicked the body changes according to the route. With _app, this works perfectly fine. However, there is another page called Settings which shows in the body of _app. In Settings page, there is another level of routing. This page has further two sections; a NavBar and a body. The NavBar has links and when the user clicks in one of the links, the subroute changes accordingly.
I understand that one way this can be acheived is to add NavBar to all the subroutes of Settings page but I am looking for a better way.
How is this possible?
Related
I have a react application which fetches the wordpress post content and renders it through WP REST API.
The designer templates that are created have lots of CSS classnames around it.
Now when I view this post content in react application, no styles are applied as the classnames are particular to wordpress theme/plugin.
Question: Is there a way to get all the related CSS, so that I can use it in react?
Expected: The template shown in react should be same as the post created in wordpress.
Plugins used: Elementor(to create shapes, style content etc..,)
Tried Solutions:
Keeping a copy of styles from WordPress in client application – not scalable as the CSS files in WP changes when Admin adds more themes/plugins.
Used AutoOptimize plugin to combine & minify all CSS files, and use the final generated file in react, but CSS concatenation has its own drawbacks
Rendering the WP post directly in client application using permalink – This contains navigation header and other information of the site which we don’t want to expose in the client application
The solution that can be tried over here is to get all the stylesheet links from wordpress and add it react head tag. If there are any dependent js links they can also be added. so now when the template is rendered in react it will have all the styles shown.
The other way is similar to the above one but lot easier. Get the total wordpress-post document via rest-api and pass it to iframe in react. In this the page doesn't break in any case because the html document will have all the links that needs to be rendered.
https://wordpress.stackexchange.com/questions/320065/get-the-list-of-enqueued-registered-scripts-for-a-specific-post -> refer this to check on how to get the stylesheet links and also document based on the post id.
https://www.haselt.com/blog/wp-rest-api-modifying-the-json-response -> Refer this to check on how to modify the json response.
I am building a small application but this is my problem, I have a landing page with a search box in the middle, this page has a footer. All this page does is query something then navigate to a listing page. In the listing page I do not need the footer anymore, but later other screen may use it. My problem i have been having so far is that if my landing page with the search bar has a background image for the body, i have to do some monkey business in my listing page to remove it as well as the footer.
Is there a way I could have a page in Angular 4, say my index.html where this has a component (other than the <app-root>), this component will have all the head and html needed for that landing page but then when i navigate to the listing one , i want to have a different body and then here add the <app-root>
but then i am not sure how my routing will work.
It comes down to be able to apply css to my body from anywhere in the app without having to do monkey business from the child components to add classes or remove them.
Bear with me, i am new to Angular4 and i am paying the price.
I am a new guy in the wordpress development town. I have mobius theme installed in wordpress. And implemented one child theme for that. I'm using style.css for styling all the pages. As i'm using one css for multiple pages I am checking the class on the body to ensure my styles will get applied on that page only. This is very important for me to have the required class with page id on the body tag. But all the classes are getting messed up after redirecting to any other page.
This is scenario happening with me.
Classes on the body present when visited home page for first time was:
'home page page-id-40 page-template-default'
After redirecting to other pages e.g. 'meet the team' page, I was expecting to have different classes. 'page page-id-1195 page-template-default'. But the classes on the body tags are unaffected.
But If I refresh the redirected page 'meet the team' I can see all the expected classes on the body tag.
Since your theme is using ajax to load page content, you must follow the way it works when trying to implement custom style and javascript.
Your theme must have some javascript functions which trigger ajax call to get a new page and then replace the current page content with it. Find those functions and add your custom js based on the loaded page in its ajax callback function.
I see it is using jQuery, so you can refer to the documentation:
http://api.jquery.com/jquery.ajax/
http://api.jquery.com/jquery.get/
Your style could be done the same way, but it's better to provide all custom styles during the first page load.
I've tried deleting blocks, disabling views - the lot! I just can't get this little block to go away!
A block called "Related Forum" is showing up on our knowledge base pages an example is found - here.
I'd like the whole Related Forum block removed from any /help* page:
If I login and hover my mouse over the block, no settings icon appears.
Any idea?
Navigate to the blocks admin page at "admin/structure/block".
There somewhere you should see your block (generated from a view) named something like "View: related forums".
Click configure and change this blocks visibility settings under the "pages" tab at the bottom of the configure page.
If this does not work, check that this block is not being specifically included in a template file.
Another thing that may be affecting it is the context module.
Anything I do inside our Wordpress CMS for some of our pages does not reflect on the actual website. It's like as if it's disconnected. The other pages are confirmed connected though.
Why is this and where should I look especially that it happens only to selected pages?
Btw, I probably should've indicated a sample of the problematic pages. Here's one: http://www.criminal-lawyers.com.au/courts/locations.
Look the template of effected pages.
Take that page on admin panel on the right side of that page you can see page attribute section ,Look on the template that set for that page. It may be a static template that do not accept the content.
Just change the template to default template.
Then view that page .If content are reflected then request the developer to do that in the selected template also.
(NOTICE:entire style of the page is lost.You need to reselect to previous template and save it after seeing the change )