Creating Frontend w/ Frontity and testing on localhost with MAMP

Hello Frontity Community!!!
I am very new with using frontity and just installed the npx package with mars theme, currently reading the docs and getting familiar with the frontity environment.

is it possible to connect frontity into a localhost WordPress with using MAMP to access localhost WP Dashboard?

I am used to using MAMP with apache, myphp developing themes with WordPress.
I really like the idea of not using .php with Frontity, but im curious if I could link the WP localhost dashboard using MAMP with frontity to design and develop a theme. can anyone explain and shed a light with this?

I really appreciate you!

Hi, you can set your local installation of WP as the data source.

Update frontity.settings.js:

img_local-frontity

This will pull the data from your local site.

Note: you will need to handle this via environmental variables if you decide to deploy the Frontity theme to production, otherwise it will still link to your local when deployed.

1 Like

Woah! i just made it work! I set the api to http://localhost:8888/wp/wp-json since my MAMP is set to localhost:8000. This is HUGE!

As I read through frontity docs, you can add more themes on frontity’s packages folder.
Is it possible to add the frontity theme for example the mars-theme to wp-admin/theme?

also, based on the mars-theme, the menu items/navigation items are stored in frontity.settings.js. is it possible to include a react-router-dom or even create a full react app and add it as a frontity theme?

As I read through frontity docs, you can add more themes on frontity’s packages folder.

I don’t think you can make your Frontity theme show up in the WP dashboard. Frontity theme lives on a completely different server and makes the theme decoupled from WP.

is it possible to include a react-router-dom or even create a full react app and add it as a frontity theme?

I haven’t tried to include react-router to Frontity. Have a look at the build in router. It does make sure that all slugs from your Wordpress are available as routes in Frontity.

I haven’t tried to include react-router to Frontity. Have a look at the build in router. It does make sure that all slugs from your Wordpress are available as routes in Frontity.

with the builtin router,@frontity/tiny-router, is it possible to make the menu items dynamic as if when you add/remove/edit/delete a new page, it will show up dynamically on Frontity’s localhost:3000?

I don’t know if this can be done out of the box. You might need to add an endpoint that returns the menu items for a specific menu.

Hope that helps or maybe the Frontity team can chip in their advice.

Peter, thank you so much for your help!

Another Question: What if I have created multiple themes under my packages folder, which will be set into their individual domains? what would be the best approach to handle that?

or,I guess I am asking if is it possible to designate a custom theme(s) into individual domain/site?

1 Like

Also, what if I have of couple of custom favicon.ico on different themes? is it possible to have different favicons set on themes for one Frontity project?

Hi @sottrj, welcome to the community!

Frontity delegates the logic in packages, so each package is responsible of a specific task. @frontity/tiny-router is the package in charge of managing the routes in a Frontity project (in the client side)

Regarding the menus, as long as you have the info of the menus in the REST API you should be able to read that information dynamically from your Frontity App and generate a custom menú based on that data.

Here you have some related threads:

What you can do is define multiple sites under the same Frontity project. In this way you can assign different themes to different sites