WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
[resolved] Disable Schema (6 posts)

  1. dentvii
    Member
    Posted 1 year ago #

    Hello,

    Otto, I would like to disable the schema from your plugin, as I already use WordPress SEO and your amazing plugin is overwriting my custom excerpt.

    Thanks

    http://wordpress.org/extend/plugins/simple-facebook-connect/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    SFC does not have an option to do this. You can either use the sfc_meta filter to eliminate the meta SFC is creating, or disable the SEO plugin from creating that data.

  3. dentvii
    Member
    Posted 1 year ago #

    Otto,

    You mean I should remove the following lines?

    // add meta tags for *everything*
    add_action('wp_head','sfc_base_meta');
    function sfc_base_meta() {
    	$post='';
    	$fbmeta = array();
    
    	$options = get_option('sfc_options');
    	// exclude bbPress post types
    	if ( function_exists('bbp_is_custom_post_type') && bbp_is_custom_post_type() ) return;
    
    	$excerpt = '';
    	if (is_singular()) {
    
    		global $wp_the_query;
    		if ( $id = $wp_the_query->get_queried_object_id() ) {
    			$post = get_post( $id );
    		}
    
    		// get the content from the main post on the page
    		$content = sfc_base_make_excerpt($post);
    
    		$title = get_the_title($post->ID);
    		$title = strip_tags($title);
    		$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
    		$title = htmlspecialchars_decode($title);
    
    		$permalink = get_permalink();
    
    		$fbmeta['og:type'] = 'article';
    		$fbmeta['og:title'] = esc_attr($title);
    		$fbmeta['og:url'] = esc_url($permalink);
    		$fbmeta['og:description'] = esc_attr($content);
    
    	} else { // non singular pages need images and descriptions too
    		if (!empty($options['default_image'])) {
    			$fbmeta['og:image'][] = $options['default_image'];
    		}
    		if (!empty($options['default_description'])) {
    			$fbmeta['og:description'] = esc_attr($options['default_description']);
    		}
    	}
    
    	if (is_home()) {
    		$fbmeta['og:type'] = 'blog';
    		$fbmeta['og:title'] = get_bloginfo("name");
    		$fbmeta['og:url'] = esc_url(get_bloginfo("url"));
    	}
    
    	// stuff on all pages
    	$fbmeta['og:site_name'] = get_bloginfo("name");
    	if (!empty($options["appid"])) $fbmeta['fb:app_id'] = esc_attr($options["appid"]);
    	$fbmeta['og:locale'] = sfc_get_locale();
    
    	$fbmeta = apply_filters('sfc_base_meta',$fbmeta, $post);
    
    	foreach ($fbmeta as $prop=>$content) {
    		if (is_array($content)) {
    			foreach ($content as $item) {
    				echo "<meta property='{$prop}' content='{$item}' />\n";
    				if ($prop == 'og:image') echo "<link rel='image_src' href='{$item}' />\n";
    			}
    		} else {
    			echo "<meta property='{$prop}' content='{$content}' />\n";
    			if ($prop == 'og:image') echo "<link rel='image_src' href='{$content}' />\n";
    		}
    	}
    }

    and

    add_settings_section('sfc_meta', __('Facebook Metadata', 'sfc'), 'sfc_meta_text', 'sfc');
    	add_settings_field('sfc_default_image', __('Default Image', 'sfc'), 'sfc_default_image', 'sfc', 'sfc_meta');
    	add_settings_field('sfc_default_description', __('Default Description', 'sfc'), 'sfc_default_description', 'sfc', 'sfc_meta');

    Is that so?

    Thanks

  4. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    No, you can just remove_action('wp_head','sfc_base_meta'); in your own code. Simpler.

    But, note that doing that will basically break the plugin. The results you get will not be optimal.

  5. dentvii
    Member
    Posted 1 year ago #

    Thanks Otto.

    For those using Yoast SEO Plugin and rather use your custom made excerpt, please add the following lines to your functions.php in your current theme.

    remove_action('wp_head','sfc_base_meta'); // Removes Simple Facebook Connect Meta
    remove_action('wp_head','sgc_base_meta');// Removes Simple Google Connect Meta

    This way you can still use Otto plugins with WordPress SEO from Yoast.

  6. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    A better solution is to let SFC and SGC do their thing, and disable the OpenGraph functionality of the SEO plugin. SFC has been tuned to do this properly for Facebook and Google.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.