Skip Navigation

[Resolved] How to create a related article view for posts on a different domain?

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by Christian Cox 5 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1231113

Tell us what you are trying to do? We have a related article sections where are displayed related posts called from their ID.
see: hidden link in the ARTICOLI DI URBANFILE tab section.
Since we created a subdomain on another hosting the referenced articles are not working anymore because they take the actual subdomain (file.orbanfile.org) instead of the original domain (blog.urbanfile.org)

Is there a way to create a correct view of related posts that belong to the other domain?

#1231129

Hi, if all the related posts are "Schede" posts, then you can use the post slug shortcode to create links to the other domain like this:

<a href="<em><u>hidden link</u></em>;">[wpv-post-title]</a>

Modifying the custom field image URL isn't so simple. You could edit each post and update the image URLs manually, or you could use the PHP API to manipulate the custom field values using custom code.

add_filter( 'wpv-post-field-customfield', 'ts_switch_domains_customfield_field', 20, 2 );
function ts_switch_domains_customfield_field( $out, $meta ) {
    $out = "<em><u>hidden link</u></em>";
    return $out;
}

Documentation for this API is available here:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv-post-field-name

#1231682

Hi Christian and thanks for your prompt reply, what we need to achieve is reference a post that is not a custom post made with Toolset but a normal post, so I suppose we cannot use the shortcode methos. What we need to achieve is retrieving the post data (title, feature image, and post URL and display it in Toolset view). The author that populates the content actually just need to place the post ID but the problem is that the referenced post is a clone of the original site, created in this new environment, so we just wanted to avoi post duplication.
As you know is there a way to retrieve some post data from another domain and then populate the view of the custom post in that way?

#1231684

Another workaround we thought maybe possible is to let the page load the post with the wrong third-level domain, then without refreshing the page add a sort of Javascript that replace in all URLS of the DIV ID="news" the string file.urbenfile into blog.urbanfile, do you think it would be a good idea?

#1231725

Hi Christian, I came up with another idea but I need your assistance since I am not able tu create all elements with Toolset.
The workaround could be to create a repeatable group of fields that contains (post title, post image and post URL). All those data can be inserted manually by the editor but we need to know how to create that repeatable element inside the custom post and then how to display the results of all inserted elements in a view.
Hope this description is crear enough. We tried to create a group of fields but it is not repeatable and so we don't know if it is possible.
Thanks for your help on this. Maybe this solution is much easier also for the editors when they populate the custom post with data.

Franco

#1231860

As you know is there a way to retrieve some post data from another domain and then populate the view of the custom post in that way?
No, Views is not designed to read external data sources. It only reads information in the current site's database.

Another workaround we thought maybe possible is to let the page load the post with the wrong third-level domain, then without refreshing the page add a sort of Javascript that replace in all URLS of the DIV ID="news" the string file.urbenfile into blog.urbanfile, do you think it would be a good idea?
I'm not sure I'm the best source of information about that, sorry!

we need to know how to create that repeatable element inside the custom post and then how to display the results of all inserted elements in a view.
We have a guide to creating and displaying repeatable field groups here: https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/
Feel free to open a separate ticket to discuss repeatable field groups (RFGs) in more detail.