Trying to include a specific page on the frontpage of a WordPress Theme.
The overal HTML structure should be similar to this:
<div>
<h1>Om</h1>
<p>Content comes here</p>
</div>
<div style="background-image: url(...)">
</div>
At the moment it echos the content of the page successfully.
Here is how that part works with PHP:
<div class="omtekst col-md-6 half-content-wrapper">
<h1 class="semibold">Om</h1>
<?php
$my_id = 7;
$post_id_7 = get_post($my_id);
$content = $post_id_7->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
?>
</div>
As mentioned earlier I want to include the thumbnail below this. This is where I am having problems.
However, I have started on the PHP to show how I am thinking. The thumbnail should be $image
or similar.
<div class="ombilde col-md-6" style="background-image: url('<?php echo $image; ?>')">
Do you have a working solution for this?
Edit
My custom thumb which is not used with this image:
add_action( 'after_setup_theme', 'mytheme_custom_thumbnail_size' );
function mytheme_custom_thumbnail_size(){
add_image_size( 'frontpage_thumb', 500 ); // Unlimited height
}
Enabled post thumbnails:
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'nav-menus' );
add_theme_support( 'widgets' );
}