Skip Navigation

[Resolved] Displaying an Images field from a specific post on another page

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.74 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 1 month, 2 weeks ago.

Assigned support staff: Christian Cox.

Author
Posts
#1912055

Tell us what you are trying to do?
Excuse the content. My client is a glamour model (although the content here so far is just lingerie based). I have a custom post type called profiles and a Field Group of custom fields associated with it. These fields display here:

hidden link

Rather than have all this post’s data on one simple page like the above, my client wants the images shown on a Gallery page (so not a Post page). I know how to use shortcodes to display custom fields from specific posts e.g. for statistics for the above post I would use [types field=‘statistics’ post_id=’25'][/types] in an Elementor shortcode element or from the dynamic dropdown option using an Elementor Text Editor element.

How though can I display the Images custom field for this post. I added this field to the above post page by adding an Elementor Gallery element and chose Toolset Gallery Field (Images) but when doing that on a standard page there’s no option to say from which post to get the data from and a shortcode element simply displays the URLS to the images in text format.

A workaround I guess would be to create a custom post type called Galleries, add an Images (multiple) custom field to it and create a post then add that to the main menu to look like a gallery page but that seems a very clunky and complicated thing to have to do so are you able to help please.

Is there any documentation that you are following? No

Is there a similar example that we can see? No

What is the link to your site? whurld.com but you can only get to the post via the link above. The site's not finished yet.

#1912619

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

How though can I display the Images custom field for this post.
Hello, normally I would recommend using the Types field shortcode like you described. I noticed a couple of syntax errors in the shortcode example you shared:

[types field='statistics' post_id='25'][/types]

1. We recommend you use the "item" attribute instead of "post_id" to specify an arbitrary post or page as the source of the custom field.
2. Double-check the quotation marks in the shortcode, because I see some curly quotation marks in your example. This could be a side effect of copy + pasting code between text editors, but I want to confirm that the the characters on your site are not curly quotes - they should be basic apostrophes as seen below:

[types field='statistics' item='25'][/types]

I'm not very familiar with the Elementor Gallery element, so I'm not sure how to specify an arbitrary post ID other than the current post. That's something you may need to contact Elementor's support team about. It may or may not be possible...I'm not trained in the different options available for configuration in their elements. If it's not possible to specify another post ID for that element, maybe they offer a template shortcode that gives you the ability to display the results of a specific template applied to a specific post? Something like a Content Template in Views, but for Elementor templates. In essence, you would need a way to do something like this:

[elementor-template template-id="123" post-id="456"]

I'm not sure if they offer anything like this, but their support team should be able to tell you. If such a shortcode exists in Elementor, you would insert this shortcode where you want to display the Gallery element. Specify an Elementor template ID like 123 and the source post id like 456. In the Elementor template 123, you would insert the Gallery element and set the dynamic source using the Toolset images field. The post ID set in the shortcode attribute would then be used to display the correct post's custom image fields in the gallery. Again, this is hypothetical and depends on whether or not Elementor offers such a shortcode templating system.

You mentioned:
a shortcode element simply displays the URLS to the images in text format.
Normally a Types image field will output image tags unless you specify options for outputting the URL or a "raw" output format. Can you show the exact Types field shortcode you have in place here? Also, I have found that the Elementor shortcode element does not support certain Toolset shortcode structures very well, especially shortcodes nested inside other shortcode attributes. Sometimes in the Toolset environment you need the ability to nest shortcodes inside other shortcode attributes. I have found that Text elements usually work better in this scenario than shortcode elements. For example, say you want to display an image custom field, and you want to use the current post title as the "alt" attribute of the image tag. To do that, you need a nested shortcode structure like this:

[types field="your-image-field" alt="[wpv-post-title]"][/types]

That won't work well in an Elementor shortcode element. Instead, you would use a Text element instead of a shortcode element. So my suggestion is to try Text elements instead of shortcode elements when inserting Toolset shortcodes, in general.

Let me get your thoughts and feedback and we can go from there, thanks!

#1913277

Hi Christian, Life is just too complicated. Elementor is so flexible for someone like me with no patience to learn anything. Blocks seems to be a page builder in the same way but looks like it doesn't offer anywhere near the customisation that Elementor does. I will however try to start a new site using Blocks as a test to see how I get on. For now I managed to go to Content Templates to create a View that has a Gallery in and was able to select the donor post needed. It works on hidden link but what I don't understand about creating a View this way is why I have to start with a Content Template instead of a View. Also, when finishing editing a Content Template, there's seemly no back button or back to the WordPress menu button so I get logged out off WP when I click the browser button or edit the URL manually to get off the edit page. This seems ridiculous. Is there something simple I can't see? I also can't see anywhere to go to delete Views? Something somewhere seems to be missing in the workflow that involves Views. Is it just me or am I correct? Anyway, problem solved. Many thanks, Barry.

#1913331

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

menu.png
full-screen.png

what I don't understand about creating a View this way is why I have to start with a Content Template instead of a View
I also can't see anywhere to go to delete Views? Something somewhere seems to be missing in the workflow that involves Views. Is it just me or am I correct?
In the Toolset Blocks editor experience each View must be created in a post editor or template editor. If you want to reactivate the legacy Views editor experience where you have a Views menu item and the ability to create Views independently of the Block Editor, go to Toolset > Settings > General and choose the Editing Experience option that activates both the Block Editor experience and the legacy Views experience.

Also, when finishing editing a Content Template, there's seemly no back button or back to the WordPress menu button so I get logged out off WP when I click the browser button or edit the URL manually to get off the edit page. This seems ridiculous.
Normally after editing a Content Template in the full-screen Block Editor, you would just click the "W" icon in the top left corner of the block editor screen to return to the list of Content Templates in the dashboard (see full-screen.png). The experience in this scenario is akin to the experience when editing a standard post with the Block Editor. If you want to restore the standard WP menu on the left side, you can always disable fullscreen editing mode in the Block Editor Options menu (see menu.png). You'll have less editor space.