• Hey,

    thanks for your great addon. You should change the way, attachments are inserted, because this will lead to thmubnailless zombies which can be a bit of a hassle if you use a theme which depends on thumbnails.

    Simple fix:
    After
    $picture_id = wp_insert_attachment( $attachment, $mirror[ 'file' ] ); in line 695
    insert

    // Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
    require_once( ABSPATH . 'wp-admin/includes/image.php' );
    
    // Generate the metadata for the attachment, and update the database record.
    $attach_data = wp_generate_attachment_metadata( $picture_id, $mirror[ 'file' ] );
    wp_update_attachment_metadata( $picture_id, $attach_data );

    in line 657 change
    'post_excerpt' => $post_excerpt,
    to
    'post_content' => $post_excerpt, so that themes can strip down the content for themselves. Better would be to add an option how many chars of the imported message should be inserted as an excerpt.

    Furtheron you’ve forgotten to insert the correct category. I’ve hardcoded it for myself with
    'post_category' => array(11)
    Maybe you can fix this in your next release.

    Kepp up the good work.

    https://wordpress.org/plugins/facebook-fanpage-import/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter peterpatzig

    (@peterpatzig)

    Sorry,

    forgot to mention which file to edit.

    components/import/import-stream.php

    Plugin Author Sven Wagener

    (@mahype)

    Thank you Karl!

    I will change this right now and add this fix for the next beta.

    Greetings,

    Sven

    Plugin Author Sven Wagener

    (@mahype)

    But do you really mean:

    ‘post_content’ => $post_excerpt,

    or do you mean

    ‘post_excerpt’ => $post_content

    I don’t think that it makes sense to put the post excerpt into the post content also not to put the post content into the excerpt. If you want to create an own post excerpt, you can choose the filter ‘fbfpi_import_post_excerpt’ or you can cut the post content by yourself in your theme.

    Thread Starter peterpatzig

    (@peterpatzig)

    In public function import() you declare $post_excerpt = $this->get_post_excerpt( $entry ); I didn’t look further but for me $post_excerpt always contains the full content from every facebook posting.

    The problem with my theme is, that it creates the excerpt on it’s own from post_content if post_excerpt is empty. Your plugin inserts the whole posting in the excerpt column in wordpress. This led to the problem, that my preview page was previewing every posting with very long “excerpts”.
    If filling both post_excerpt and post_content you should strip the excerpt to a value which can be defined in the admin area. For some people like me, the excerpt isn’t needed at all.

    Maybe I could clarify things.

    Plugin Author Sven Wagener

    (@mahype)

    Hello,

    I have fixed the problems with Post Thumbnails and Categories and published the fix in Beta 6. Please update! Thanks to Karl!

    Greetings,

    Sven

    Plugin Author Sven Wagener

    (@mahype)

    Hi Karl,

    at the moment I just use the Facebook entry “message”, not the whole post. See here:

    https://github.com/awsmug/Fanpage-import/blob/master/components/import/import-stream.php#L538

    This should not be the same behaviour as on post content. But if you have an idea to make it better, let me know!

    Greetings,

    Sven

    Thread Starter peterpatzig

    (@peterpatzig)

    Hey Sven,

    sorry for replying late.

    I rechecked your code and the facebook api and came to the conclusion that you’re not pulling an excerpt but the whole message aka status message. My tests show the same.

    The function get_post_excerpt( $entry ) returns the full message. The filter (fbfpi_import_post_excerpt) you’re applying does not work.

    Better would be to insert the whole posting in the correct column.

    Categories still aren’t inserted properly. The values can be pulled from the db but you’re missing the statement when calling wp_insert_post function.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fix for thumbnails category excerpt’ is closed to new replies.