WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Posts per Cat] Problems with Excerpts (6 posts)

  1. Lambda89
    Member
    Posted 4 years ago #

    Hi, anyone willing to listen.

    I've installed the PPC-plugin, and it works flawlessly; except for one minor detail; the excerpts. Neither when I choose "for all" or "for first", any excerpt shows.

    I've been looking at, and to small amounts modified, the code. For one thing, I translated the comments and one variable name to English (GT said it was croation, is that correct?), to make it easier for us at my company to maintain the app we're building.

    Anyhow, has anyone else experienced this bug, and is there a workaround? I'm not so keen on messing around in other people's data-structures, so modifying that without guidance feels like a big no-no.

    Best regards

    Rickard Lund

    http://wordpress.org/extend/plugins/posts-per-cat/

  2. Lambda89
    Member
    Posted 4 years ago #

    I can add to this that the "summary" (excerpt) is printed properly. Though, it's an empty string.

    I verified this by concatinating in two !! into the echo of it.

    This leads me to think that there might have something to do with the parameters:

    if ( $ppc_excleng && mb_strlen_dh($clanak->post_excerpt) > ($ppc_excleng+1) ) { $summary = substr_utf8($clanak->post_excerpt, 0, $ppc_excleng)."…"; } else { $summary = $clanak->post_excerpt;}

    I would like to know; where does $clanak->post_excerpt come from? Is that a wordpress-parameter? ($clanak means "$post" or "$article", by the way).

  3. urkekg
    Member
    Posted 3 years ago #

    OffTopic: I must to translate all comments and vars to English (not it's in Serbian) :)

    OnTopic: $clanak->post_excerpt is almost same as function the_excerpt(), but returns excerpt content to string, don't print it out.

    $clanak means $post, and post_excerpt is field from table wp_posts.

  4. mikeashton
    Member
    Posted 3 years ago #

    I too have had this issue, but I don't understand the author's answer. Do I need to adjust the code or are the excerpts simply not going to show up?

    Thanks,

    Mike

  5. Coveneye
    Member
    Posted 3 years ago #

    Hi, tried my hands on this plugin yesterday. Don't know if your problem was mine, but in my case WordPress 3.1 doesn't automatically create the content for post_except field in the database, so the querry for post_excerpt field returns an empty string.

    To solve the problem, you could turn Excerpt field on in the Screen View option panel for your posts and create the Excerpt manually.

    If you don't want to going through that all the time, then go to line 328 and replace this:
    if ( $ppc_excleng && mb_strlen_dh($clanak->post_excerpt) > ($ppc_excleng+1) ) { $sazetak = substr_utf8($clanak->post_excerpt, 0, $ppc_excleng)."…"; } else { $sazetak = $clanak->post_excerpt;}

    with this:
    if ( $ppc_excleng && mb_strlen_dh($clanak->post_content) > ($ppc_excleng+1) ) { $sazetak = substr_utf8($clanak->post_content, 0, $ppc_excleng)."…"; } else { $sazetak = $clanak->post_content;}

    That would make the plugin take content in "post_content" field in stead of post_excerpt field to process, so you won't have to bother with post_excerpt every time.

    Good luck!

  6. urkekg
    Member
    Posted 3 years ago #

    What about new option in settings to use post_content in stead of post_excerpt w/o code hacking?

Topic Closed

This topic has been closed to new replies.

About this Topic