Need to insert code in the correct place

Posted in: ionMag
Post count: 34


I have almost everything working except one thing.

I want to use the REST API to call an article from my other WordPress site and display it on the site using the WPIon template.

The code works and was tested using the vanilla site, but now that the template is installed, I am a bit lost.

I have created a static homepage. Using the TAGDIV editor, I created the most basic page with one element (a full width image/link). What I need to do is use the following code:

$newsletter_posts = get_newsletter_posts();

if ( $posts ) {

foreach ( $newsletter_posts as $news_post ) { ?>

link ); ?>” title=”<?php echo esc_attr( $news_post->title->rendered ); ?>”><?php echo esc_html( $news_post->title->rendered ); ?>

<?php }


To call the article and display it in this area as a full width header image/link. As you can see, the code currently creates a static link, but it needs to appear exactly like it does on the other site. The problem is I can’t figure out all these pages to determine where to put this code, and which HTML to use instead of the <a/a> tag.

I could edit the page.php file, but I don’t want this to show up on every other page, just the static home page (currently named “Home”)

If anyone can help me figure out which template files I need to alter to get this working, I would appreciate it very much.


  • This topic was modified 1 year by  RCMSAR.
  • This topic was modified 1 year by  RCMSAR.
Post count: 34

Here is the link.

Simion C.
Post count: 383


The theme Grids and blocks will display posts actually created and published. That is how the filtering and sorting is based on as well, to pick posts. The theme does not have any options to pull and display posts from other websites in the grids and blocks. Also the thumbnail has to be created from the featured image manually set for each post.
Maybe you can create the post normally, then there will be no problem placing it in that grid.


Post count: 34

Correct. I am using WordPresses’ built in REST API to pull the information from the other WP site and display in the other site. I have successfully connected to, and pulled the information.

The thumbnail is created on the other site, and is part of the data I am pulling using the REST API.

What I need help doing is integrating the code into the theme. So for example, when using the TAGDIV editor, instead of putting a block in there, I would leave that area blank. That is where I would integrate the REST API code.

What I need help doing is finding the correct file(s), and the correct spots in the code. I don’t know this theme all that well, so I am having trouble finding the correct files and place to do it. I also need to figure out the CSS used in the theme so I can make it look correct.

Creating the post normally is not an option. The client requires the news article to be posted by the author on the newsletter site, and the public site is referencing these articles. They don’t want to give the author access, nor do they want to create multiple instances of the same article on different sites.

Post count: 86

Another option is to use something like FeedWordPress to pull in the content from the other site via RSS2. We do this with our main news portal, and then pull in localized content to the child sites. Might not be what you’re looking for, but we use it every day across 12 sites flawlessly. This way content is pulled in to the theme as default post content not a bunch of custom hooks; but FWP supports taking custom fields included in the original source and integrating into the new site fields.

Food for thought anyway. 🙂

Sometimes simpler to make a custom feed from ‘site a’ to pull in content to ‘site b’ than hack the crap out of site b to get it to work with site a.

Post count: 34

Thanks for the advice. It is a little clunky but so far it seems to be doing the trick. The problem is that I can’t seem to get it to pull the “Featured Image” from the other site.

I installed the extra FWP+: SIC ‘Em plugin from the same developer, and it will pull an image from the original article, but not the featured image. I am hoping this is solvable.

Post count: 86

I use the ‘auto post thumbnail pro’ plugin to grab first external image from our ‘site a’ in the post and make into the featured image for the clones on ‘site b,c,d,e’. Best $10 I ever spent.

Post count: 34

The plugin you’ve suggested appears to be a manual process. What I mean is, it only seems to generate thumbnails for posts that have already been added. So unless I am mistaken, someone would have to login and manually press this button after publishing an article on the other site?

Post count: 9

I used a plugin to achieve a similar thing in my blog with Ionmag theme, it’s called FeedWordpress, maybe you could use it for your blog RCMSAR.


Edited: Sorry I see that SimChris already had recommended that plugin.

  • This reply was modified 1 year by  nakoruru666.
  • This reply was modified 1 year by  nakoruru666. Reason: I've readed all post XD
Post count: 34


Has FeedWordPress stopped working for you? I checked it today and it is no longer working. It is throwing out the following error.

WP HTTP Error: cURL error 28: Resolving timed out after 10520 milliseconds

Any thoughts? I am supposed to launch in a week! 🙁

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘ionMag’ is closed to new topics and replies.