Tagged: ,

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #21081

    Is there a way to add a post excerpts within the main content area of page?

    I have created a custom [home] page template (copied page.php) and included code to display excerpts of the two most recent blog posts.

    The excerpts display below the regular page content, which is where I wanted them too, but they show up *below* the main content area of page, not within it.

    It doesn’t matter where I place this code within the custom page template it does not show up within the page’s main content area.

    Is this possible to do with the Catch-Box theme?

    Thank you for any assistance.
    Craig

    #21110
    Sakin
    Keymaster

    @craiginthebox: Sorry I don’t get it. Can you explain in reference to your site URI or make be share screenshot of what you want. Also to make changes to core theme files, you need to build child theme and work on it.

    #21193

    Sorry, the site’s not live so I can’t provide a URL yet.

    My question can be summarized as, “With the Catch-Box theme, how can I add a blog post excerpt to the home page, within the main content area.”

    (I am modifying Catch-Box via a child theme)

    Does this help?…

    |——————————–
    | [Header]
    |——————————–
    | [Menu]
    |——————————–
    | [Main content area]
    | Home page title
    |
    | Home page text content.
    | Blah Blah Blah.
    | Blah Blah Blah.
    |
    | <– *here’s where I want the blog excerpt to show up.
    |
    |——————————–
    | Footer
    |——————————–

    Thank you,
    Craig

    #21221
    Sakin
    Keymaster

    @craiginthebox: Sorry this is quite complicated and you might need to hire customizer for this.
    1. First here you are trying to add home as page. So, you need to go to “Settings => Reading” and select your page to show in homepage from “Front page displays => “A static page”
    2. Then you need to create front-page.php where you have to first query page and then blog-post.

    #21279

    @Sakin Thanks very much. I’m with you so far. 🙂

    I have the home page set to display a static page. I also assigned a custom page template to this “Home” page. The custom page template was create by copying page.php. Within this custom page template I’ve added query code that successfully displays a blog post excerpt on my home page.

    The problem is that it displays *outside* (below) the main content area of the page, instead of within it. There doesn’t seem to be a place within the custom page template to place the query code so that it displays within the main content area of the page.

    #21298
    Sakin
    Keymaster

    @craiginthebox: I told you that you are not supported to create page template. You just need to add home as page. So, you need to go to “Settings => Reading” and select your page to show in homepage from “Front page displays => A static page” and then in your child theme create the file name front-page.php and here goes the sample code for the file.
    https://gist.github.com/anonymous/05b0588726655f11c326#file-front-page-php

    #21324

    @Sakin Thank you. I now understand that I didn’t need to use a custom page template.

    I’ve created a new file, “front-page.php,” using the sample code you gave me and it successfully display a blog excerpt on the home page, BUT it does not display within the main content area of the page. The blog excerpt displays below it, between the main content area of the page and the footer.

    Is there a way to have the blog excerpt display below the text of the page, but within the main content area of the page?

    #21345
    Sakin
    Keymaster

    @craiginthebox: I don’t get it what you mean. We shouldn’t add another article before closing article code. The page take one article and each post takes one each. Maybe you can just change css and wrap it.

    Let’s edit your front-page.php file. Add the code <div id="home-wrap"> just below get_header(); ?> and code </div><!-- #home-wrap --> just above <?php catchbox_content_query_nav( 'nav-below' ); ?>

    Then in you child theme style.css add the following CSS:

    #home-wrap {
        background-color: #fff;
        border-bottom: 2px solid #ccc;
        -moz-border-radius: 5px;
        border-radius: 5px;
    }
    #home-wrap  .hentry {
        border: none;
    }
    #21369

    @sakin Your solution worked! Thank you very much for your help and your patience.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Post excerpts within main content area?’ is closed to new replies.