Two CPT
This topic contains 11 replies, has 4 voices, and was last updated by Samantha 5 years, 9 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
March 12, 2020 at 1:03 am #534917
Hi There,
We have two CPT that are linked together. We need the user to be able to link them prior to the primary listing being published and live. Is there some sort of coding we can add that allows the secondary CPT to be linked to the first CPT even though it’s not live?
Secondly, My solution for this was to auto-publish the primary listing but we use offline payment so it appears that even though it tries to ‘auto-publish’ it’s not publishing because payment hasn’t been marked as complete.
Anything you can think of that would help us accomplish this?
Thanks,
Sam
March 12, 2020 at 1:04 am #534918This reply has been marked as private.March 12, 2020 at 7:47 am #534939Hi Misty,
Thanks for your post. To link CPT’s, you can refer to this section of the documentation https://wpgeodirectory.com/docs-v2/addons/custom-post-types/#link . Let us know how it goes.
March 12, 2020 at 2:24 pm #534975Thank you. We have them linked. The problem I’m having is that when the user submits one, it has to wait to be approved before they can then go to the 2nd CPT and link it to the first. I need the user to be able to connect the CPT and submit their listings before it’s approved.
This is the current flow:
– Submit 1 CPT
– Wait to be approved
– Submit 2nd CPT and select the first CPT to link toI need to eliminate that middle step. I tried to set it to auto-approve but since payment isn’t complete since we do an offline payment, it doesn’t get approved and published so they’re unable to submit the 2nd CPT and link it to the first.
I need to be able to do one of two things:
– Either be able to auto-publish listings, regardless of payment
– Or, allow the 2nd CPT to link to pending listings from the 1st CPTMarch 12, 2020 at 10:51 pm #535045Have a look at the advanced settings of the packages, and change the publishing option to always publish.
Thanks
March 13, 2020 at 5:23 pm #535142Yes, the packages are set to publish. I also have the settings in GeoDirectory to publish by default.
New listing default status: Published
Paid Listing Status: PublishedYet, still when the user submits the listings are pending.
March 13, 2020 at 8:40 pm #535157Hi Misty,
Thanks for your reply. Could you supply your WP admin login URL here in private reply?
March 13, 2020 at 9:20 pm #535168This reply has been marked as private.March 14, 2020 at 12:09 am #535177This reply has been marked as private.March 14, 2020 at 3:06 am #535186Yes, thank you.
March 16, 2020 at 8:05 am #535375Hello Misty,
Try following PHP snippet to link pending posts.
/** * * Allow to link pending posts. */ function gd_snippet_search_include_pending_posts( $where ) { $search = "p.post_status = 'publish'"; $replace = "( p.post_status = 'publish' OR p.post_status = 'pending' )"; $where = str_replace( $search, $replace, $where ); return $where; } add_filter( 'geodir_cp_search_posts_query_where', 'gd_snippet_search_include_pending_posts', 20, 1 ); add_filter( 'geodir_cp_check_link_post_query', 'gd_snippet_search_include_pending_posts', 20, 1 );Regards,
KiranMarch 16, 2020 at 8:53 pm #535473Yes, that worked. Thank you Kiran!
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket