I would like to add a preview in a Right Side Bar widget. I put the url in the box under Widgets -> Right Side Bar -> Custom HTML, but it just prints the url. I don’t see the page or preview when Published. Can you please help me? Thank you. You can see it https://mindiq.com

If you go to https://mindiq.com/it-training-course-list-application-development-java/ and scroll down to, Other Courses to Explore. To get those images, all I did was put a URL on the page. I want that kind of image/preview in the right side bar widget, I created under the layouts and widgets section. Hope this helps.

It is hard for me to believe that nobody has tried to use a side bar widget for a preview of a web page. Why would it act should it act any differently than putting a URL in Paragraph format in the body of the page, to get a preview of that URL page? Weird.

  • What do you mean by preview? Are you trying to use oembed to embed a WordPress post in content but using a custom html widget? – Tom J Nowell Dec 8 '17 at 20:36

Simply placing a url isn't going to embed a webpage within a webpage. You could use an iframe.

<iframe src="http://yoururl"></iframe>

To display the page content from that url.

You could also capture the page via php and scrape it for the information you need but you would have to create a custom widget for this.

$some_variable = file_get_html('http://www.google.com/');

would be the basic code you need to get started. If you need to do custom formatting on whats embedded the second snippet will get you started you're just going to have to do some regular expression matching to capture what you need for output.

| improve this answer | |
  • Thanks. I tried the iframe option, but it shows the whole page instead of a preview. That will not work. I'm not technical enough to try your second option. – Louie Dec 9 '17 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.