Created
November 4, 2017 04:47
-
-
Save phucdohong96/f532c269b2c02af0ff82daa7b3fd3e62 to your computer and use it in GitHub Desktop.
Get ID from previous page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_featured_image_func() { | |
$postid = url_to_postid( $_SERVER['HTTP_REFERER'] ); | |
$image = get_field('featured_image', $postid); | |
$image = '<img src="'.$image["url"].'" />'; | |
return $image; | |
} | |
add_shortcode( 'get_featured_image_shortcode', 'get_featured_image_func' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment