• Hallo,

    das thumbnail, das automatisch eingefügt wird ist ziemlich pixelig. Das kann ich bei einem integrierten Video mit 1200x720px wieder nicht verwenden. Ich habe folgendes gefunden, das funktioniert auch einwandfrei:

    add_filter( ‘lyte_match_thumburl’, ‘lyte_my_own_thumburl’ );
    function lyte_my_own_thumburl( $thumb ) {
    return ‘Image URL’;
    }

    Nur habe ich das Problem, dass ich drei verschiedene Videos auf der Webseite eingebaut habe. Wie kann ich bei jedem einzelnen Video das posterimage ersetzen?

    Vielen Dank im Voraus und beste Grü?e

    Jasmin

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Hey Jasmin;
    Hope it’s OK I answer in English, my German is sub-par really ??

    So in the function you have $thumb as a parameter, the filter should populate that with the default thumbnail URL, which includes the YouTube ID, so you could check $thumb to differentiate between the 3 videos you have on the site?

    hope this helps,
    frank

    Thread Starter jass78

    (@jass78)

    Hey Frank,

    sure! Sorry, i thought german was ok. I have now solved the problem like this:

    add_filter( ‘lyte_match_thumburl’, ‘lyte_my_own_thumburl’ );
    function lyte_my_own_thumburl( $thumb ) {
    // Get the queried object and sanitize it
    $current_page = sanitize_post( $GLOBALS[‘wp_the_query’]->get_queried_object() );
    // Get the page slug
    $slug = $current_page->post_name;
    if ( $slug == ‘site-name 1’ ) {
    return ‘https://url.de/wp-content/uploads/thumbnail-1.jpg’;
    }
    if ( $slug == ‘site-name 2’ ) {
    return ‘https://url.de/wp-content/uploads/thumbnail-2.jpg’;
    }
    if ( $slug == ‘site-name 3’ ) {
    return ‘https://url.de/wp-content/uploads/thumbnail-3.jpg’;
    }
    }


    Why don’t you improve the plugin so that you can insert an custom poster image directly in the shortcode f.e.?

    Best,
    Jasmin

    • This reply was modified 4 months, 2 weeks ago by jass78.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    No worries; I understand German (it’s relatively close to Dutch, my mother tongue) but I don’t know it well enough to actively use it, esp. in written form ??

    re. the snippet; that should indeed work ??

    re. adding custom thumbnails in shortcode; 2 reasons, one being a lack of time and the other that shortcodes are a bit a thing of the past, no? so should be a WordPress Block and that’s not something I have built yet. someday though … ??

    greetings from Belgium,
    frank

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