• Chad

    (@nordberg26)


    I added the plugin code below for Default featured image, as the image I am using for the default featured image is passing to linkedin even when I have selected an image for the featured image in any of my posts. I’m just wondering with this code and your plugin if there’s some logic to just do a check to workaround what seems to be this plugin overriding the new featured image on initial saving of the post. If I delete the post on linkedin and go back to wordpress and submit the saved post again, the correct featured image appears the second time. Thanks for your time.

    /**

    define( ‘DFI_VERSION’, ‘1.7.3’ );
    define( ‘DFI_DIR’, plugin_dir_path( FILE ) );
    define( ‘DFI_URL’, plugin_dir_url( FILE ) );
    define( ‘DFI_NAME’, basename( DIR ) . DIRECTORY_SEPARATOR . basename( FILE ) );

    require_once DFI_DIR . ‘app’ . DIRECTORY_SEPARATOR . ‘class-dfi.php’;
    require_once DFI_DIR . ‘app’ . DIRECTORY_SEPARATOR . ‘class-dfi-exceptions.php’;

    $dfi = DFI::instance();

    // add the settings field to the media page.
    add_action( ‘admin_init’, array( $dfi, ‘media_setting’ ) );
    // enqueue the js.
    add_action( ‘admin_print_scripts-options-media.php’, array( $dfi, ‘admin_scripts’ ) );
    // get the preview image ajax call.
    add_action( ‘wp_ajax_dfi_change_preview’, array( $dfi, ‘ajax_wrapper’ ) );
    // set dfi meta key on every occasion.
    add_filter( ‘get_post_metadata’, array( $dfi, ‘set_dfi_meta_key’ ), 10, 4 );
    // display a default featured image.
    add_filter( ‘post_thumbnail_html’, array( $dfi, ‘show_dfi’ ), 20, 5 );
    // add a link on the plugin page to the setting.
    add_filter( ‘plugin_action_links_default-featured-image/set-default-featured-image.php’, array( $dfi, ‘add_settings_link’ ) );
    // add L10n.
    add_action( ‘init’, array( $dfi, ‘load_plugin_textdomain’ ) );
    // remove setting on removal.
    register_uninstall_hook( FILE, array( ‘DFI’, ‘uninstall’ ) );

    /**

    /**

Viewing 1 replies (of 1 total)
  • Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @nordberg26,

    Thanks for your question. Unfortunately I don’t provide code advise for this forum because I don’t have the resources for that. Thank you,

Viewing 1 replies (of 1 total)
  • The topic ‘Default Featured Plugin using Default Featured Image Instead of New Image’ is closed to new replies.