This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Post Grid or List when query returns pages, displays "0" for excerpts

  • Creator
    Topic
  • #20176
    Israel Curtis
    Participant

    Since built-in “pages” don’t support excerpt by default, when using a Post Grid or List and the query results in pages being included, there is a “0” displayed where the excerpt should be. Yes, I can disable “show excerpts” for this particular instance of post grid, but I think it might be safer if jumpstart simply output nothing when an excerpt is missing, rather than a “0”.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #20177
    Israel Curtis
    Participant

    An even better solution for missing manual excerpts, when the user has selected to display excerpts, would be to use auto-generated excerpts based on the post content.

    Much like what’s described in the codex:

    “The manual WordPress excerpt is often confused with the automatic excerpt or with the teaser (the part of a post that appears on the front page when you use the More tag). While both are related to the manual excerpt, they are different from it.

    The relationship between the three is this: When a post has no manual excerpt and the post template uses the the_excerpt() template tag, WordPress generates an excerpt automatically by selecting the first 55 words of the post. When the post template uses the the_content() template tag, WordPress will look for the More tag and create a teaser from the content that precedes the More tag.”

    #20181
    Israel Curtis
    Participant

    Actually, now that I’ve manually enabled excerpts for pages and removed the “0” that was saved there (??) , I’m seeing auto-generated excerpts from the page content, so my suggestion isn’t needed. But maybe you should include something to ensure that if pages are pulled into post grids, you bypass the default “0” (since most people haven’t enabled manual excerpts for pages) and perform the same auto-generation.

    #20183
    Jason Bobich
    Keymaster

    Ok, I understand what you’re driving at. So, this isn’t really anything to do with the theme, I don’t believe. The theme calls the standard the_excerpt() template tag, and nothing more.

    However, it appears that when you setup a WordPress query and query by the “page” post_type, WordPress adds this 0 as the excerpt.

    Why doesn’t WordPress just leave it blank? Why does it make it a 0? I’m not sure. Seems like a WordPress bug, if you ask me.

    But either way, I think if you’re working with these things and using knowledge to write out a custom query string, you probably can understand that WordPress does not associate excerpts with pages in the same way it does as standard posts.

    If you’re looking for pages to act like standard posts in regards to excerpts, you can always use a plugin like this, maybe?

    #20184
    Jason Bobich
    Keymaster

    This is interesting, though: If you use the Post Grid element, I have an actual user option in there that let’s you to select to pull a set of pages. This then prompts you to put in a list of page slugs like page-1, page-2, page-3.

    Now when you do this, the theme queries by these specific “posts” and doesn’t actually specify the “page” post type anywhere in the query. The query that WP brings back then allows excerpts to work in the normal way.

    … I didn’t output in the screenshot, but interesting if you print out global $post object for each, the post_excerpt is empty, with no “0”, and so then WP knows to pull first 55 words. So, yeah seems like just a WordPress quirk we need to accept, unless you want to start a ticket in trac. Personally, I don’t think it seems all that important.

    #20199
    Israel Curtis
    Participant

    thanks for investigating. makes sense. Was simply trying to avoid client choosing pages for their grids and suddenly seeing “0” because they hadn’t manually set excerpts.

    #20393
    Jason Bobich
    Keymaster

    This actually turned out to be a random side effect (bug) of having shortcode generator active when publishing a new page. Update your version of the shortcodes plugin, and this issue should go away, when creating new pages. Unfortuantely for pages that have already been created, the damage is done, unless you went through and deleted the value manually for them all.

    https://wordpress.org/plugins/theme-blvd-shortcodes/changelog/

    #20403
    Israel Curtis
    Participant

    Oh sweet, thx!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.