WordPress.org

Forums

WP Facebook Open Graph protocol
[resolved] Meta Description Issues/Improvements/request (6 posts)

  1. Pinto
    Member
    Posted 3 years ago #

    Hi,

    I'm using your plugin and there's a feature i think a lot of people would be glad to see implemented.
    case1: user uses excerpt
    - the plugin shows the excerpt in lint
    case2: user does not use excerpt
    - the plugin uses the description in wp-settings

    now if the user does not use excerpt ( either auto or manual ), the og:description will not be relevant regarding the content of the post ( and there are people that do not use description in wp-settings)

    so a great feature would be:
    check for excerpt, if not available:
    plugin parses the_content and show the first 55 characters as og:description and in last case show description.

    an ugly "fix" i use at the moment is i've commented the
    // do descriptions code

    this way, lint will get the og:description from the first <p> it encounters

    Would love some feedback.

    Thank you for your plugin!

    Pinto

    http://wordpress.org/extend/plugins/wp-facebook-open-graph-protocol/

  2. tespio
    Member
    Posted 3 years ago #

    Hi

    You can do this hack into the plugin code. it works nice for me as i had the same problem as you had. Find the next piece of code in the plugin and change the bolded line :

    // do descriptions
                    if (is_singular('post')) {
                            if (has_excerpt($post->ID)) { // truncate_post($et_excerpt_length);
                                    echo "\t<meta property='og:description' content='".esc_attr(strip_tags(get_the_excerpt($post->ID)))."' />\n";
                            }else{
    				<strong>echo "\t<meta property='og:description' content='".get_bloginfo('description')."' />\n";</strong>
    
                            }

    with:

    <strong>echo "\t<meta property='og:description' content='".esc_attr(substr(strip_tags($post->post_content), 0, 255))."...' />\n";</strong>

  3. tespio
    Member
    Posted 3 years ago #

    Oh well it seems that code tags with strong tags are not geting along well.

    Once again, change the first:

    echo "\t<meta property='og:description' content='".get_bloginfo('description')."' />\n";

    with

    echo "\t<meta property='og:description' content='".esc_attr(substr(strip_tags($post->post_content), 0, 255))."...' />\n";

    You can also define how many characters to be displayed in the description. I wanted 255.

  4. Chuck Reynolds
    Member
    Plugin Author

    Posted 3 years ago #

    Hey guys.. I don't get notifications when ppl add support requests on here... :/ lame.

    Anyways - I never put a priority on that functionality initially as most people that beta tested for me were cool with customizing it, however I understand the desire for said functionality. Therefore this is scheduled for final testing currently in the beta I have and will very likely be included with the next update.
    So standby - and thanks for the support req.

  5. Chris
    Member
    Posted 3 years ago #

    Thanks for this great plugin!

    Can we have the option to limit the description by word length with "..." at the end, rather than character count?

  6. Chuck Reynolds
    Member
    Plugin Author

    Posted 3 years ago #

    @Eminemdrdre00 what word length were you thinking. I made it 160 as to keep with the length that Facebook will display before cutting it off. I didn't do the ... as it's annoying and also takes up more characters. IMO people should be crafting their own custom descriptions not letting an autogenerator do it for them - but that's just me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Facebook Open Graph protocol
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic