Advertisemen
If you want to Get WordPress Featured Image By Page or Post ID in your custom page. Then you need to follow some easy TDrecipes
Step 1: Set Feature Image
It is important to set the featured image in wordpress blog post. Its done by simply click on Add Media button and you'll see the Set Featured Image option and set the image.
Step 2: Copy the following code
The full code you need is
The size of the presets may be changed in WordPress admin using the Settings > Media menu.
Step 3: Add this code in template page
Now you know how to add page content and wordpress featured images to any WordPress template page.
Step 1: Set Feature Image
It is important to set the featured image in wordpress blog post. Its done by simply click on Add Media button and you'll see the Set Featured Image option and set the image.
Step 2: Copy the following code
The full code you need is
if (has_post_thumbnail($page_id)){The size of the image may be a width and height in pixels eg array(150, 150), or a preset: thumbnail, medium, large or full.
echo get_the_post_thumbnail(
$page_id,
array(80,80),
array('class' => 'post_thumbnail')
);
}
The size of the presets may be changed in WordPress admin using the Settings > Media menu.
Step 3: Add this code in template page
Now you know how to add page content and wordpress featured images to any WordPress template page.
Add Comments