Support » Plugin: JSON Content Importer » Connect two WP site’s news feed together

  • Resolved Földesi, Mihály

    (@foldesistudio)


    Dear Bernhard Kux,

    I would like to use the basic JSON of WordPress to connect two site together.

    I use the basic and original wp json / rest api file via wp json url:
    https://www.mysite.com/wp-json/wp/v2/posts?_embed

    I can get the slug name of the post Featured Image. This is perfect, it works!

    Unfortunately, I cannot read the Thumbnail’s URL I don’t get it, it doesn’t work.
    This is the path of JSON tree:
    ['_embedded'] -> ['wp:featuredmedia'] -> ["0"] -> ['media_details'] -> ['sizes'] -> ['medium'] -> ["source_url"]

    Can you help me what is my mistake?

    I have attached my json-content-importer’s code:

    {subloop:_embedded:-1}
    
     {subloop-array:_embedded.wp:featuredmedia:-1}
           (Works!) Name of the Featured Image: {_embedded.wp:featuredmedia.slug}
    				<br>
    	(Does not work!) Thumbnail size of Featured Image: {_embedded.wp:featuredmedia.media_details.sizes.medium.source_url}
    
     {/subloop-array:_embedded.wp:featuredmedia}

    I think I did some mistyping…

    best regards,
    Mihály

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author berkux

    (@berkux)

    Hi Mihály,

    post the real JSON as an URL please.
    If you want to do this in private, switch to
    https://jsoncontentimporter.freshdesk.com/widgets/feedback_widget/new?searchArea=no

    Bernhard

    Thread Starter Földesi, Mihály

    (@foldesistudio)

    Hello Bernhard!

    Thanks for answering!

    Unfortunately, my site is offline, but I was able to share the requested JSON file on my public site.

    URL: See first post.

    Regards,
    Mihály
    Ps.: I believe in open source; I hope we can help the others 🙂

    I have tried to rethink my code, but it does not work yet:

    {subloop:_embedded:-1}
    
       <!--  //JSON PATH: ►0►_embedded►wp:featuredmedia►0►media_details►sizes►medium►source_url -->
    
                {subloop:_embedded.wp:featuredmedia.media_details:-1}
                        {subloop-array:_embedded.wp:featuredmedia.media_details.sizes:-1}
                            {subloop:_embedded.wp:featuredmedia.media_details.sizes.medium:-1}
                                  
    Thumbnail size of Featured Image: {_embedded.wp:featuredmedia.media_details.sizes.medium.source_url}
                                 
                            {/subloop:_embedded.wp:featuredmedia.media_details.sizes.medium}
                        {/subloop-array:_embedded.wp:featuredmedia.media_details.sizes}
                {/subloop:_embedded.wp:featuredmedia.media_details}
           {/subloop-array:_embedded.wp:featuredmedia}
    
    {/subloop:_embedded}
    Plugin Author berkux

    (@berkux)

    Hi,

    try this:

    [jsoncontentimporter url=https://foldesistudio.hu/posts.json]
    id: {id}
    {subloop:_embedded:-1}
    {subloop-array:_embedded.author:-1}name: {name}
    {/subloop-array:_embedded.author}
    
    {subloop-array:_embedded.wp:featuredmedia:-1}
    slug: {_embedded.wp:featuredmedia.slug}
    {subloop:_embedded.wp:featuredmedia.media_details:-1}
    height: {_embedded.wp:featuredmedia.media_details.height}
    {/subloop:_embedded.wp:featuredmedia.media_details}
    <hr>
    {/subloop-array:_embedded.wp:featuredmedia}
    {/subloop:_embedded}
    [/jsoncontentimporter]
    

    Feel free to vote for my plugin.

    Bernhard

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Connect two WP site’s news feed together’ is closed to new replies.