Instagram shortcode Issue
-
Hi all, I have to show instagram image in wordpress post. I have followed directions of wordpress help site http://en.support.wordpress.com/instagram/instagram-images/. It suggests two ways:-
- First, copy the image’s URL from your web browser’s address bar and paste the URL where you would like it to appear.
- Second, wrap an Instagram URL in shortcode [instagram url=LINK]
For first method, http://instagram.com/p/aWYMzVBGXA/ is showing image on WP post but http://instagram.com/p/k0-EishILF/ does not.
Second method does not work at all and simply shows string as it is on WP Post. Please guide me if have to take extra measures to show IG image on WP Post using SHORTCODE method. thanks -
Any luck?
Nobody on this forum has worked with wrapping an Instagram URL in shortcode [instagram url=LINK]thanks
-
finally I found the way to fix the issue:-
function instagram_shortcode( $atts ) {
extract( shortcode_atts( array(
‘url’ => ‘http://instagram.com/p/aJjzCNrnHL’,
‘width’ => ‘150px’,
), $atts ) );
if (!preg_match(“/.*/$/”, $url)) {
$url = “$url” . “/”;
}
if ( $width == ”) {
$width = ‘150px’;
}
$instagram = ‘<div class=”image-container”>
<img src=”‘. $url .’media/” width=’. $width .’ />
</div>’;
return $instagram;
}
add_shortcode( ‘instagram’, ‘instagram_shortcode’ );It is so simple…
- The topic ‘Instagram shortcode Issue’ is closed to new replies.