WordPress.org

Forums

Quark
[resolved] Page with Posts (7 posts)

  1. jabberwock67
    Member
    Posted 11 months ago #

    First of all, thank-you for such an outstanding theme.

    For single posts, I want to display the individual posts in their entirety (ie "the_content"...not "the_excerpt")

    However, on the "Posts" page, I want to display the excerpt plus the thumbnail for 5 or 10 posts per page.

    Trying different bits of code from different websites hasn't been successful in accomplishing what I want to accomplish.

    And adding a new template file to the theme has been frustrating. I want to format the posts on the "posts" page differently than single posts.

    Can you either:
    1) Let me know what files to add / edit to accomplish this?, or
    2) Possibly add this functionality to your theme (free for the community or for a price to be negotiated)

    Thanks again

  2. ahortin
    Member
    Theme Author

    Posted 11 months ago #

    On the Single posts page, such as this post on my demo site, it displays the whole content as you can see (ie. it uses the_content() ).

    I presume that the "Posts" page that you're referring to, is the blog archive page (eg. this page)

    This archive page also uses the_content(). By default it will show the whole post content. If you don't want to show the whole post though, simply add a 'Read More' tag into your content so that it only displays the content up to this tag.

    As you can see on my demo site, the blog page is simply showing part of the post content, along with a "Continue reading" link. It does this because the post has a "Read More" tag in the content.

  3. jabberwock67
    Member
    Posted 11 months ago #

    I understand about the "Read more" tag, but that won't allow me to use custom excerpts.

    Basically, what I desire is to have a custom page-- like your example of a blog archive page with pagination-- only I want to format the posts differently than they appear on the single posts page: ie title in a smaller font, custom excerpt, thumbnail/featured image.

    I have attempted to create a new custom template, but I've run into roadblocks such as the page not displaying at all. I know that in the right hands this is much easier than I am making it...

  4. ahortin
    Member
    Theme Author

    Posted 11 months ago #

    If you've got an issue with the page not dsplaying at all, it's most likely because you've introduced a PHP error in your template.

    If you want to display the custom excerpt field, rather than the main content, all you should have to do is change the following line from within content.php

    <?php the_content( wp_kses( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'quark' ), array( 'span' => array( 'class' => array() ) ) ) ); ?>

    with this...

    <?php if ( has_excerpt() ) {
       the_excerpt();
    } else {
       the_content( wp_kses( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'quark' ), array( 'span' => array( 'class' => array() ) ) ) );
    ?>
    }
  5. jabberwock67
    Member
    Posted 11 months ago #

    The problem with this solution is that I want the_excerpt to show on one type of page and the_content to show on another type of page-- where you are using the same template for multiple types of pages.

    I have found my solution by creating a new template and another template_part to use instead of content.php that contains code I found elsewhere on the web. It ain't pretty but it works.

    I had originally copied your code from content.php to my newcontent.php, which is where I experienced the blank page. Yet when I copied the new code into newcontent.php, it worked. I can't figure out why this happened.

    I thought that a better solution could have been achieved with another conditional statement in your template and this might be something to consider for future releases of this theme.

  6. ahortin
    Member
    Theme Author

    Posted 11 months ago #

    If you want the Single Posts page to be different than the archive page, then I suggest that you duplicate content.php (call it content-single.php).

    Then, in single.php change the get_template_part() call so that it looks like...

    <?php get_template_part( 'content', 'single' ); ?>
  7. jabberwock67
    Member
    Posted 10 months ago #

    That is basically what I did-- created a duplicate content.php-- for my page with posts.
    Thanks.

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.