WordPress.org

Ready to get started?Download WordPress

Forums

JM Twitter Cards
[resolved] Problem with Description (5 posts)

  1. stephen_connolly
    Member
    Posted 3 months ago #

    Hello,

    I have the following hook setup in my theme's functions.php:

    function _jm_tc_strip_tags($content) {
    	return strip_tags($content);
    }
    add_filter('jm_tc_get_excerpt', '_jm_tc_strip_tags');

    But this funtion is not being called. I based this solution from the following thread:

    http://wordpress.org/support/topic/problems-with-twitter-description-meta-name

    regards

    https://wordpress.org/plugins/jm-twitter-cards/

  2. jmlapam
    Member
    Plugin Author

    Posted 3 months ago #

    There's already a wp_strip_all_tags() in wp_trim_words(), no use to add your strip tags

  3. stephen_connolly
    Member
    Posted 3 months ago #

    Ok, thanks,

    I've just tried adding a filter (in my theme's funtions.php) as follows:

    add_filter('jm_tc_get_excerpt', 'wp_strip_all_tags($content)');

    and I tried:

    add_filter('jm_tc_get_excerpt', 'wp_strip_all_tags()');

    but filter is not being called.

    Any thought ?

  4. jmlapam
    Member
    Plugin Author

    Posted 3 months ago #

    It's already implemented in plugin because I use wp_trim_words() for the excerpt.

    Filters do not work that way in WP. You'd better do something like this:

    add_filter('jm_tc_get_excerpt', '_strip_my_tags');
    function _strip_my_tags( $content ) {
      return wp_strip_all_tags($content);
    }

    But as I said it's already in the plugin (with the latest version)

  5. stephen_connolly
    Member
    Posted 3 months ago #

    Form some reason the function _strip_my_tags is not being executed, from my functions.php script in my theme's folder.

    Anyway, I got around the problem by making the following change in jm-twitter-card.php:

    $output .= '<meta name="twitter:description" content="' . jm_tc_remove_lb( wp_strip_all_tags($cardDescription) ) . '"/>' . "\n";

    Not ideal but works.

    Thanks for the help.

Reply

You must log in to post.

About this Plugin

About this Topic