0

I am wondering if there is code or a plugin would help to solve my problem.

I run a news website. Rather than make a separate custom post type and separate that from the actual story post that eventually gets published to the public. I was thinking I could make an assignment Advanced Custom Fields field group attach it to the story post - to have photo and reporter assignments for each story post and then have one permalink that displays the final story template and another permalink view that displays the assignment for the photographer and reporter that is then sent to the person.

This way the assignment stays with the story at all times. I have attempted to use post 2 post and acf child post to attach a custom post type to another custom post type but they both dragged my site down to a crawl.

In other words I am looking to display one set of ACF fields one way but then another set of ACF fields another way all within the same "post"

The idea is that I want to keep everything "connected" within the CMS. FO example an editor is looking at a story in the CMS but needs to refer to what the original assignment was.

one idea is to use categories but is there a way to have two separate categories for one post -- one category called "assignment" for the assignment permalink and the other normal such as "news" "sports" etc.

any ideas are appreciated.

  • How familiar are you with PHP? If you are comfortable editing your custom post type's single view template file you could achieve this without messing with permalink structure. – Justin Waulters Jan 11 at 1:58
0

If the people who need to see the reporter assignment / photographer assignment information all have WordPress logins, it would be a lot more secure to just have postmeta that is only visible when in wp-admin. You can create a custom column so that when you view all your Posts, one of the columns shows the reporter, and another shows the photographer. (See How can I add columns to the post edit listing to show my custom post data?)

Or, if they all have WP logins and you want them to see this data when viewing individual posts on the front end, you could

  1. Add postmeta boxes for "photo assignment" and "reporter assignment" to your posts. (See Problem in custom meta boxes)

  2. (In a child theme) update your single.php file. Wherever you want to conditionally show the assignment, add

if( is_user_logged_in() ) { echo 'Reporter: ' . get_the_field('reporter_assignment'); echo 'Photographer: ' . get_the_field('photographer_assignment'); }

If they don't all have WordPress logins and you are okay with the possibility that someone in the public might see these assignments, you can still handle everything with plain postmeta (no need for ACF). You would:

  1. Add postmeta boxes for "photo assignment" and "reporter assignment" to your posts.

  2. (In a child theme) update your single.php file. Wherever you want to conditionally show the assignment, add

if($_GET['show_assignments'] == true) { echo 'Reporter: ' . get_the_field('reporter_assignment'); echo 'Photographer: ' . get_the_field('photographer_assignment'); }

The public will see your regular URL, such as example.com/post/, and whoever needs to see the additional details will need to use the URL example.com/post/?show_assignments=true

  1. You should also make sure to set the canonical URL so Google knows to index the version without query strings. Most SEO plugins will handle this for you.

  2. If you have Google Analytics you should also tell it to ignore the show_assignments query var, so it doesn't show visits to the query-string version separately from visits without the query string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.