Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

#931 - Previews on CPT #954

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

johnrobertmcc
Copy link
Contributor

@johnrobertmcc johnrobertmcc commented Mar 1, 2022

Closes #931

Note

This solves the routing problem of previews not being generated, but it does not solve the problem of the 'preview button' being broken. I have opened an issue here.

Description

CPT Previews were not viewable due to missing logic in building the Apollo Query.

  • Added a dynamic function to query for CPT based on variable names
  • Moved Previews to it's own route, soa s not to use the query by year feature as a fallback.

Verification

How will a stakeholder test this?

  1. git checkout hotfix/931-CPT-previews-not-working

  2. Create new CPT in WP Admin

  3. In CPT Ui, ensure show in GraphQL is set to true for new CPT.
    image

  4. Click on preview of CPT, it should redirect to /preview/${databaseId}/ with a working preview.
    NOTE: As mentieond above, the 'preview in new tab' button does not work on CPT, it will redirect to home page. Please use 'preview' button in quick edit on pagination of CPT.
    image

  5. Ensure regular post type previews are working as well.

@vercel
Copy link

vercel bot commented Mar 1, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/webdevstudios/nextjs-wordpress-starter/AWpSZGyEU6As2ikTrKmTqVrSTXG7
✅ Preview: https://nextjs-wordpress-starter-git-hotfix-931-cp-cfd544-webdevstudios.vercel.app

@johnrobertmcc johnrobertmcc marked this pull request as ready for review March 1, 2022 18:11
@johnrobertmcc johnrobertmcc changed the title not working, switching branches #931 - Previews on CPT Mar 1, 2022
Copy link
Contributor

@gregrickaby gregrickaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial things. I will test this more in-depth throughout the day.

@@ -29,6 +29,7 @@ export default function Archive({
taxonomy,
term
}) {
// console.log('ARCHIVE')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnrobertmcc Please remove all the console.log() comments

@@ -61,7 +61,7 @@ export default async function getPostTypeStaticProps(
}
}

/* -- Handle dynamic archive display. -- */
// /* -- Handle dynamic archive display. -- */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnrobertmcc Please fix this comment syntax.

…evStudios/nextjs-wordpress-starter into hotfix/931-CPT-previews-not-working
…ter into hotfix/931-CPT-previews-not-working
@vercel
Copy link

vercel bot commented Apr 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nextjs-wordpress-starter ✅ Ready (Inspect) Visit Preview Apr 19, 2022 at 4:45PM (UTC)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Previews Custom Post Types
2 participants