EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 281 forks source link

Body Not Rendering #12

Closed robwelan closed 5 years ago

robwelan commented 6 years ago

On OSX, I have loaded the starter into a MAMP [v4.2.1 (852)] instance. I have run 'npm run watch' and also 'npm run production'. In both cases, the 'header' and 'footer' render, but the body does not. Suggestions? I have fixed a minor issue with the API route (I was getting 404 errors, but I fixed this with a small edit to the app.js (I removed the leading '/'). Calling the api directly from the browser URL works fine (in my case it is 'http://localhost:8888/development-vue/wp-json/wp/v2/categories?sort=name&hide_empty=true&per_page=50').

raisiqueira commented 6 years ago

Hi, @robwelan. How are your permanent links? If you are using de WordPress default, change to any other permalink.

robwelan commented 6 years ago

I've cycled through all permalink options except for custom. No change unfortunately. In case this helps, this is the html that is rendered between the header and footer sections: <div class="page-content-wrapper"><!----></div>

robwelan commented 6 years ago

I've worked out that adding '/development-vue' to my 'base' route (line 19 in index.js in the router folder) helps, as well as making sure 'plain' is not the chosen permalink. I've created a helper file to get window.location.pathname and I have added the result to router/index.js (modifying 'base' value) and also app.js modifying API_BASE_PATH). Working OK on MAMP.

raisiqueira commented 6 years ago

So it worked? 🤔

robwelan commented 6 years ago

Yes, with the change I've described (adding window.location.pathname if it does not equal to '' on the router/index.js and the app.js files)

raisiqueira commented 6 years ago

Close issue, please 😄

EvanAgee commented 6 years ago

Thanks so much @raisiqueira for helping out! +1 to awesomeness for you!

Ivanok commented 6 years ago

Hello, I'm trying to use the starter theme but i'm not able to render the body either.

Specifically, When I open the example Home page, the lists of pages and posts are not rendering on the page.

I tried making the changes as stated above, but the list of posts is still not rendering. I am able to access the api via browser so I'm not sure what is going on.

Thank you for making the starter theme and I hope that you'll be able to help me!

wester97 commented 6 years ago

Any console errors? On Sat, Feb 24, 2018 at 9:50 PM Ivanok notifications@github.com wrote:

Hello, I'm trying to use the starter theme but i'm not able to render the body either.

Specifically, When I open the example Home page, the lists of pages and posts are not rendering on the page.

I tried making the changes as stated above, but the list of posts is still not rendering. I am able to access the api via browser so I'm not sure what is going on.

Thank you for making the starter theme and I hope that you'll be able to help me!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/EvanAgee/vuejs-wordpress-theme-starter/issues/12#issuecomment-368280895, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtMxxL8m0ypJ-Nq-3coe7q9ReTMEQD9ks5tYNh_gaJpZM4RV4WK .

Ivanok commented 6 years ago

No console errors.

wester97 commented 6 years ago

Is the response in Inspector > Network empty? 404? On Sat, Feb 24, 2018 at 11:42 PM Ivanok notifications@github.com wrote:

No console errors.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/EvanAgee/vuejs-wordpress-theme-starter/issues/12#issuecomment-368285256, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtMx2Ua56Lxk06wBghkVdLgxfxznV3aks5tYPK_gaJpZM4RV4WK .

Ivanok commented 6 years ago

There is no 404 at all.

wester97 commented 6 years ago

So maybe there IS a response (200)? Did you make any changes? No weird CORS type messages? Could you paste the request with headers, and the response? Say, for the posts requests. On Sun, Feb 25, 2018 at 12:16 AM Ivanok notifications@github.com wrote:

There is no 404 at all.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EvanAgee/vuejs-wordpress-theme-starter/issues/12#issuecomment-368286645, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtMx4vtWvCSPK3kNbIa2Ln51bmazwnzks5tYPqugaJpZM4RV4WK .

Ivanok commented 6 years ago

I don't see the posts requests on the list at all.

I did another clean installation of the theme files to ensure that I didn't make any changes. Attached is a screenshot of the network requests.

vue wp requests
wester97 commented 6 years ago

Perhaps this is the wrong attachment? Go to Chrome > Inspector > Network Then reload the page and let us know what you see. On Sun, Feb 25, 2018 at 11:53 AM Ivanok notifications@github.com wrote:

I don't see the posts requests on the list at all.

I did another clean installation of the theme files to ensure that I didn't make any changes. Attached is a screenshot of the network requests.

[image: vue wp requests] https://user-images.githubusercontent.com/5210809/36644621-d10f20a8-1a2a-11e8-883d-4a85ec2e12a7.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EvanAgee/vuejs-wordpress-theme-starter/issues/12#issuecomment-368329501, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtMx8VqJVdCgRhGQd-KohnKbuSwxFDhks5tYZ4ygaJpZM4RV4WK .

Ivanok commented 6 years ago

@wester97 I uploaded the wrong attachment and changed it on the previous comment, am just now realizing that since you're responding via email that change did not get to you. Here is the correct attachment:

image

Thank you for the help.

wester97 commented 6 years ago

Hmm, it seems that your requests for pages and posts aren't actually fired.

Do you see the placeholders for these sections on the homepage? For example: Home.vue loads pages-widget which ultimately should load the results of getPages into the data store, and thus into the view. You might have to trace that flow.

wester97 commented 6 years ago

Hmm, please pull master and try again.

Ivanok commented 6 years ago

It works perfectly now!

Thank you.

dedanirungu commented 5 years ago

I've worked out that adding '/development-vue' to my 'base' route (line 19 in index.js in the router folder) helps, as well as making sure 'plain' is not the chosen permalink. I've created a helper file to get window.location.pathname and I have added the result to router/index.js (modifying 'base' value) and also app.js modifying API_BASE_PATH). Working OK on MAMP.

I am having the same issue while trying to load pages. All pages are blank and only shows <div class="page-content-wrapper"><!----></div>.

I have tried to follow the solution attached but I did not understand which files need to be changed.

@robwelan Kindly assist me with the steps guide on how to solve the issue.

dedanirungu commented 5 years ago

Thank you @EvanAgee for reopening the issue.

Did you manage to get a solution on the issue. I have tried everything on my side and I did not manage to solve it. All route-view are rendering an empty div as shown below.

<div class="page-content-wrapper"><!----></div>

I will highly appreciate for your assistance.

joshbedo commented 5 years ago

Just downloaded the project and also having the same problem. I checked the network request and the API calls are returning the correct data and look fine but for some reason the body isn't rendering for posts/pages or home. I tried adding debugger in a few of the lifecycle methods but it wasn't getting hit not sure whats going on.

joshbedo commented 5 years ago

So i figured it out, i had the wordpress installation in a subdirectory and it messed up not only the api routing ( had to change API_BASE_NAME ) and it messed up the other routing. Just reinstalled it in the main htdocs directory for mamp and everything appears to be working fine now.

EvanAgee commented 5 years ago

Thanks so much @joshbedo for tracking that down. I should note in the README that this project only works for root-level WP installs.

joshbedo commented 5 years ago

@EvanAgee no problem, yeah it would be cool if we could use subdirectories not sure what would be involved to make that happen.

EvanAgee commented 5 years ago

I've just released an updated version of the project that will address many of these issues. Please note that the paths of the JS and CSS have changed so you may need to update your project. https://github.com/EvanAgee/vuejs-wordpress-theme-starter/issues/48