• Resolved dkurth

    (@dkurth)


    This is the 3rd request for help. I have worked with the recommended code, provide, to automatically change the title, description and image of a page via sharing on facebook. The problem is, while I have gotten the description to work, the title and the image does not. Here is the code. Need this working quickly.

    `
    // Facebook/OG Title.
    //function mmd_socialsnap_og_title( $title, $post_id ) {
    add_filter( ‘socialsnap_og_title’, ‘mmd_socialsnap_og_title’, 10, 2 );
    function mmd_socialsnap_og_title( $title, $post_id ) {

    $slug = get_post_field( ‘post_name’, $post_id );
    $slug = ‘/’ . $slug . ‘/’;
    $EndPoint = mmd_list_readDBSettings(“DETAILS_PAGE”);
    if ( $slug == $EndPoint )
    {
    $Params = MMD_PullDBParameters();
    if($Params != 0)
    {
    $DatabaseId = $Params[‘DatabaseId’];
    $ListId = $Params[‘ListId’];
    $BusinessName = mmd_list_GetBusinessName($ListId, $DatabaseId);
    $title = $BusinessName . ” | Horse Professionals Network”;
    mmd_DebugLog(‘mmd_socialsnap_og_title : ‘ . $title);

    }
    }
    return $title;
    }

    // Facebook/OG Description.
    //function mmd_socialsnap_og_description( $description, $post_id ) {
    add_filter( ‘socialsnap_og_description’, ‘mmd_socialsnap_og_description’, 10, 2 );
    function mmd_socialsnap_og_description( $description, $post_id ) {

    $slug = get_post_field( ‘post_name’, $post_id );
    $slug = ‘/’ . $slug . ‘/’;
    $EndPoint = mmd_list_readDBSettings(“DETAILS_PAGE”);
    if ( $slug == $EndPoint )
    {
    $Params = MMD_PullDBParameters();
    if($Params != 0)
    {
    $DatabaseId = $Params[‘DatabaseId’];
    $ListId = $Params[‘ListId’];
    $BusinessName = mmd_list_GetBusinessName($ListId, $DatabaseId);

    $description = “Find out more about ” . $BusinessName;
    mmd_DebugLog(‘mmd_socialsnap_og_description : ‘ . $description);
    }
    }
    return $description;
    }

    // Facebook/OG Image.
    //function mmd_socialsnap_og_image( $image, $post_id ) {
    add_filter( ‘socialsnap_og_image’, ‘mmd_socialsnap_og_image’, 10, 2 );
    function mmd_socialsnap_og_image( $image, $post_id ) {
    //$results = print_r($image, true);
    //mmd_DebugLog($results);

    $slug = get_post_field( ‘post_name’, $post_id );
    $slug = ‘/’ . $slug . ‘/’;
    $EndPoint = mmd_list_readDBSettings(“DETAILS_PAGE”);
    if ( $slug == $EndPoint )
    {
    $Params = MMD_PullDBParameters();
    if($Params != 0)
    {
    $DatabaseId = $Params[‘DatabaseId’];
    $ListId = $Params[‘ListId’];

    $BusinessLogo = mmd_list_GetBusinessLogo($ListId, $DatabaseId);

    mmd_DebugLog(‘Image Path: ‘ . $BusinessLogo);
    list($width, $height) = getimagesize($BusinessLogo);
    $image[0] = $BusinessLogo;
    $image[1] = $width;
    $image[2] = $height;
    $image[3] = false;

    //(false|array) Returns an array (url, width, height, is_intermediate), or false, if no image is available.
    //[0] => url
    //[1] => width
    //[2] => height
    //[3] => boolean: true if $url is a resized image, false if it is the original or if no image is available.
    //$image = wp_get_attachment_image_src( IMAGE_ID, ‘full’ ); // Replace IMAGE_ID with image id.
    }
    }

    return $image;
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Social Snap

    (@socialsnap)

    Hello Debbie,

    We replied to the ticket you sent on our support system. Let’s continue the conversation there.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP suggested filters not working – plus windows widens’ is closed to new replies.