• Hello, I been wrestling with this issue for days now.
    I have been attempting to add the most recent blog entry to the front page panel area along with front page content within the same panel.
    I am using the Twenty Seventeen theme with a child theme.
    So far I have created a custom content-front-page template named content-front-page-homepage.php. This template is being loaded into front-page.php.
    I’ve rearranged the code a bit in the above custom file (content-front-page-homepage) to bring to get the most recent blog entry to display in the panel along with homepage content.
    my code below
    <div class=”panel-content”>
    <div class=”wrap-homepage”>
    <?php if ( has_post_thumbnail() ) :
    $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘twentyseventeen-featured-image’ );

    // Calculate aspect ratio: h / w * 100%.
    $ratio = $thumbnail[2] / $thumbnail[1] * 100;
    ?>

    <?php endif; ?>

    <!– .panel-image-hp –>
    <div class=”panel-image-hp”>
    <!– created new class div called header-panel-hp–>
    <div class=”header-panel-hp”>
    <header class=”entry-header”>
    <?php the_title( ‘<h2 class=”entry-title”>’, ‘</h2>’ ); ?>
    <?php twentyseventeen_edit_link( get_the_ID() ); ?>
    </header><!– .entry-header –>
    </div><!–.header-panel-hp–>
    “/>
    </div><!–.panel-image-hp –>

    <div class=”entry-content-hp”>
    <?php
    /* translators: %s: Name of current post */
    the_content( sprintf(
    __( ‘Continue reading<span class=”screen-reader-text”> “%s”</span>’, ‘twentyseventeen’ ),
    get_the_title()
    ) );
    ?>
    </div> <!– .entry-content-hp –>

    <div class=”recent-posts-hp”>
    <?php // Show four most recent posts.
    $recent_posts = new WP_Query( array(
    ‘posts_per_page’ => 1,
    ‘post_status’ => ‘publish’,
    ‘ignore_sticky_posts’ => true,
    ‘no_found_rows’ => true,
    ) );
    ?>
    <?php if ( $recent_posts->have_posts() ) : ?>
    <?php
    while ( $recent_posts->have_posts() ) : $recent_posts->the_post();
    get_template_part( ‘template-parts/post/content’, ‘image’ );
    get_template_part( ‘template-parts/post/content’, ‘excerpt’ );
    endwhile;
    wp_reset_postdata();
    ?>
    <?php endif; ?>

    </div><!– .recent-posts –>
    However, my problem is two things:
    1)Is this the best solution to customize the panels for the front page or would custom post type solution be best or shortcode plugin?
    2)I am trying to get the front page panel to look like the yellow section in the attached image link below. Would placing front page content and recent blog content in divs and using CSS inline-block style achieve this content structure?
    Pleasssse any help!

    https://a2ss46.a2hosting.com:2083/cpsess4483309844/viewer/home%2frockimag%2fimage/homepage_wireframe.jpg

Viewing 3 replies - 1 through 3 (of 3 total)
  • I think the theme is quite flexible. By the way, your image is not available. Try uploading it to dropbox or google drive

    Thread Starter chrillc

    (@chrillc)

    Thanks for reply Luismodimax,

    Please view wireframe image from dropbox updated link below.
    https://www.dropbox.com/s/vdoylj4nxz5kxv6/homepage_wireframe.jpg?dl=0

    Thread Starter chrillc

    (@chrillc)

    I think I may have figured this out.
    I just created a custom template base on the template file: content-front-page.php.
    I rearranged the copied code in the new custom file and used custom css to position the page content and the blog content in divs which are centered in the front-page panel.
    Just really curious if this is a best practice to customizing WordPress themes or is it best to use custom post-types and advance custom fields or plugin to achieve the same result?

    • This reply was modified 7 years, 1 month ago by chrillc.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding Page Content and Last Recent Blog Post to Front page Panel’ is closed to new replies.