Skip Navigation

[Resolved] is breaking output

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Jerome 6 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#577528

Hey Moderators, Should this code still work?
<?php WPV_wpcf_record_post_relationship_belongs(''); ?>
I have this in a few old page templates and these are now breaking. I have commented them out for the moment. What should this be changed to now?

Thanks
Jerome

#577530

Sorry thought I should add a little more info. I am using Posts2Posts and listing all the artworks in an exhibition. Under each artwork I had the name of the artist listed. This is especially important when multiple artists are in the one exhibition. This was working until I updated to the latest version of Types and Views. Now It breaks output. When I remove:

<?php WPV_wpcf_record_post_relationship_belongs(''); ?>

The Title of the artwork shows twice.
When I then comment out:

<?php echo do_shortcode('[wpv-post-title id="$artist"]'); ?>

The page loads fine and no issues but the artists name won't show up.

How can I fix this to list the artists name under each work.

Thanks
Jerome

#577605

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - it looks like really old function you are using. I need to see how and where you are using the function: WPV_wpcf_record_post_relationship_belongs('');

Can I have problem URL and temporary access details so I can check your issue further with information what should be your expected output.

#578251

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thank you for sharing access details. I will check this tomorrow first thing and give you feedback on it.

#578446

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Exhibition page: hidden link
==> For above page I checked in the database there is no parent key (_wpcf_belongs_artist_id) exists in postmeta table which stores the parent ID of artists belongs to above post BUT with p2p table I can see artist_to_exhibition relationship is stored.

Please check following screenshot:
=> hidden link

Then I've tried to add following code to file: File: single-exhibition.php -

$connected_artist = new WP_Query( array(
  'connected_type' => 'artist_to_exhibition',
  'connected_items' => get_queried_object(),
  'nopaging' => true,
) );


foreach($connected_artist->posts as $k=>$v):
      echo "<br />Connected Artists=".$v->post_title;
endforeach;

And I can see artist post title on frontend. Could you please try to modify your template files with above such code and try to resolve your issue.

#579224

While that is helpful that does not fix my issue. The issue is that I want to pull the artist for each artwork. Some exhibitions or label runs have multiple artworks by multiple artists. When it calls each artwork, the artwork should have an artist parent under the field _wpcf_belongs_artist_id so how would that be pulled for each artwork. If you reload that same page the artists name should appear underneath each artwork title on the second line.

#579545

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I can see now with template file it shows different artwork. do you still need help?
=> hidden link

#579728

I managed to fix it myself using the following code in the for each artwork statement:

<?php
$artist_id = wpcf_pr_post_get_belongs( get_the_ID(), 'artist' );
// Get all the parent (writer) post data
$artist_post = get_post( $artist_id );
	$artist_name = $artist_post->post_title;
	echo '<strong>' . $artist_name . '</strong>'; ?>

Thanks
Jerome

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.