WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Facebook: Advanced Social Optimization
[resolved] Moving contents in doc head (6 posts)

  1. josh.amato
    Member
    Posted 1 year ago #

    I noticed an issue where my CiviCRM forms wouldn't load using shortcode. They would also have some placement errors using a direct link. The problem still persisted after I deactivated all plugins and changed to the twentyeleven theme to rule out a theme specific issue. I realised that the cause of the problem was the location of the following Facebook widget code in the header file:

    <div id="fb-root"></div>
    <script>(function(d, s, id) {   var js, fjs = d.getElementsByTagName(s)[0];   if (d.getElementById(id)) return;   js = d.createElement(s); js.id = id;   js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=164597177027098";   fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>

    I had placed the previous code snippet before wp_head(). After removing the code the problem went away and after placing it below wp_head() the problem went away.

    The form loading and placement issue reappeared once I activated NGFB Open Graph 5.0.1 (with the previous Facebook code removed). The debug information is below. My question is:
    - Have you ever heard of anyone experiencing this before? If not,
    - How can I change the location of the NGFB Open Graph header rendering code? My theory is if I place it as the last item before the closing </head>, it will fix the problem.

    <!-- NGFB Open Graph debug from ngfbHead::add_header() Debug Log :
    ngfbUtil :: __construct : object created
    ngfbNotices :: __construct : object created
    ngfbOptions :: __construct : object created
    ngfbHead :: __construct : object created
    ngfbOpenGraph :: __construct : object created
    ngfbSocial :: __construct : object created
    ngfbSocialFacebook :: __construct : object created
    ngfbSocialGooglePlus :: __construct : object created
    ngfbSocialTwitter :: __construct : object created
    ngfbSocialLinkedIn :: __construct : object created
    ngfbSocialPinterest :: __construct : object created
    ngfbSocialStumbleUpon :: __construct : object created
    ngfbSocialTumblr :: __construct : object created
    ngfbSocial :: add_filter : this->filter_the_excerpt() added
    ngfbSocial :: add_filter : this->filter_the_content() added
    ngfbUser :: __construct : object created
    ngfbTags :: __construct : object created
    ngfbMedia :: __construct : object created
    ngfbWebPage :: __construct : object created
    ngfbShortCodeNgfb :: __construct : object created
    ngfbShortCodeNgfb :: add : [ngfb] shortcode added
    ngfbPostMeta :: __construct : object created
    ngfbCache :: __construct : object created
    ngfbPlugin :: setup_vars : debug mode active - setting ngfb_object_cache_exp = 1 seconds
    ngfbHead :: add_header : is_archive() = false
    ngfbHead :: add_header : is_attachment() = false
    ngfbHead :: add_header : is_category() = false
    ngfbHead :: add_header : is_home() = false
    ngfbHead :: add_header : is_search() = false
    ngfbHead :: add_header : is_singular() = true
    ngfbOpenGraph :: get : object cache: og array transient id salt "ngfbOpenGraph::get(sharing_url:http://domain.org/contribute/)"
    ngfbWebPage :: get_title : wp_title() = "Contribute"
    ngfbWebPage :: get_title : apply_filters() = "Contribute"
    ngfbWebPage :: get_title : this->ngfb->util->cleanup_html_tags() = "Contribute"
    ngfbWebPage :: get_description : is_singular() = true
    ngfbWebPage :: get_description : use_post = false
    ngfbWebPage :: get_description : calling this->get_content()
    ngfbWebPage :: get_content : using content from post id 58
    ngfbWebPage :: get_content : object cache: filtered content wp_cache id salt "ngfbWebPage::get_content(post:58_filtered)"
    ngfbSocial :: remove_filter : this->filter_the_content() removed = true
    ngfbShortCodeNgfb :: remove : [ngfb] shortcode removed
    ngfbWebPage :: get_content : calling apply_filters()
    ngfbSocial :: add_filter : this->filter_the_content() added
    ngfbShortCodeNgfb :: add : [ngfb] shortcode added
    ngfbWebPage :: get_content : content strlen() before = 53, after = 21063
    ngfbWebPage :: get_content : object cache: filtered content saved to wp_cache for id "ngfb_29dcb64465f63f6d27dc58581adb7e5a" (1 seconds)
    ngfbOpenGraph :: get : calling this->get_content_videos(1)
    ngfbOpenGraph :: get_content_videos : calling this->ngfb->webpage->get_content()
    ngfbWebPage :: get_content : using content from post id 58
    ngfbWebPage :: get_content : object cache: filtered content wp_cache id salt "ngfbWebPage::get_content(post:58_filtered)"
    ngfbWebPage :: get_content : object cache: filtered content retrieved from wp_cache for id "ngfb_29dcb64465f63f6d27dc58581adb7e5a"
    ngfbOpenGraph :: get_content_videos : no <iframe|embed/> html tag(s) found
    ngfbOpenGraph :: get : calling this->get_all_images(1, "medium")
    ngfbOpenGraph :: num_remains : images count = 0 of 1 max (1 remaining)
    ngfbOpenGraph :: get_all_images : calling this->get_meta_image(1, "medium", 58)
    ngfbOpenGraph :: num_remains : images count = 0 of 1 max (1 remaining)
    ngfbOpenGraph :: get_all_images : calling this->get_featured(1, "medium", 58)
    ngfbOpenGraph :: num_remains : images count = 0 of 1 max (1 remaining)
    ngfbOpenGraph :: get_all_images : calling this->get_attached_images(1, "medium", 58)
    ngfbOpenGraph :: num_remains : images count = 0 of 1 max (1 remaining)
    ngfbOpenGraph :: get_all_images : calling this->get_content_images(1, "medium")
    ngfbOpenGraph :: get_content_images : calling this->ngfb->webpage->get_content()
    ngfbWebPage :: get_content : using content from post id 58
    ngfbWebPage :: get_content : object cache: filtered content wp_cache id salt "ngfbWebPage::get_content(post:58_filtered)"
    ngfbWebPage :: get_content : object cache: filtered content retrieved from wp_cache for id "ngfb_29dcb64465f63f6d27dc58581adb7e5a"
    ngfbOpenGraph :: get_content_images : no <div id="ngg-image-#"> html tag found
    ngfbOpenGraph :: get_content_images : 1 x <img/> html tag(s) found
    ngfbUtil :: fix_relative_url : relative url found = /wp-content/plugins/civicrm/civicrm/i/mini_cvv2.gif
    ngfbUtil :: fix_relative_url : relative url fixed = http://domain.org/wp-content/plugins/civicrm/civicrm/i/mini_cvv2.gif
    ngfbOpenGraph :: get_content_images : src = http://domain.org/wp-content/plugins/civicrm/civicrm/i/mini_cvv2.gif ( x )
    ngfbOpenGraph :: get_content_images : src image rejected: width and height attributes missing or too small
    ngfbOpenGraph :: get : calling this->get_default_image(1, "medium")
    ngfbMedia :: get_attachment_image_src : image for pid:111 size:medium = http://domain.org/wp-content/uploads/2013/05/splashBg-300x225.jpg (300 x 225)
    ngfbOpenGraph :: slice_max : max values reached (1 == 1)
    ngfbOpenGraph :: get : object cache: og array saved to transient for id "ngfb_d617b7130f020c0b6400c482c66eb3c7" (1 seconds)
    ngfbDebug :: get : truncating debug log
    -->

    http://wordpress.org/extend/plugins/nextgen-facebook/

  2. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Not a problem, NGFB has a lot of flexibility built into it. Try adding this to your wp-config.php file:

    define( 'NGFB_HEAD_PRIORITY', 9999 );

    That should pretty much ensure that it's the last thing printed by wp_head(). ;-)

    js.

  3. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    As an alternative, you could also change the location of the Facebook javascript, from the header to the footer, in the Facebook settings (Open Graph -> Social Sharing).

    js.

  4. josh.amato
    Member
    Posted 1 year ago #

    Thanks for the quick reply! I added

    define( 'NGFB_HEAD_PRIORITY', 9999 );

    to wp-config.php but it still seems to be loading the header information in the same location.

  5. josh.amato
    Member
    Posted 1 year ago #

    It appears that the location of the NGFB information in the <head> wasn't a problem. It looks like it was the "Apply Content Filters." I unchecked this and the form issue appears to be gone. I will give in update later if the problem comes back.

  6. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    I put that option there to counter-act some ill-behaved content filters from other plugins, so I'm glad to see that it was useful to someone. ;-)

    js.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic