Support » Plugin: Twitter Cards » [Plugin: Twitter Cards] How to set up Twitter-Cards Plug-in to my Twitter?

  • Resolved Zweischneid

    (@zweischneid)


    Specify user twitter account/site ID?

    Where and how do I set the settings for my twitter account/site ID?

    Description says twitter_properties_filter which I assume is this?

    $t = apply_filters( 'twitter_cards_properties', $this->toArray() );
    		if ( ! is_array( $t ) || empty( $t ) )
    			return '';
    		$s = '';
    		foreach ( $t as $name => $value ) {
    			$s .= self::build_meta_element( $name, $value, $xml );
    		}
    		return $s;
    	}

    But where goes the twitter ID / User name?

    Also, where can I switch the meta properties for the entire card from summary to photo or video?

    Thanks

    Z.

    http://wordpress.org/extend/plugins/twitter-cards/

Viewing 9 replies - 1 through 9 (of 9 total)
  • hmmm i can’t find this filter properties anywhere? can you tell me where to find this code?

    $t = apply_filters( 'twitter_cards_properties', $this->toArray() );
    		if ( ! is_array( $t ) || empty( $t ) )
    			return '';
    		$s = '';
    		foreach ( $t as $name => $value ) {
    			$s .= self::build_meta_element( $name, $value, $xml );
    		}
    		return $s;
    	}

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

    Plugin Author Niall Kennedy

    (@niallkennedy)

    First you need to hook into the filter from code in your theme or site plugin(s).

    add_filter( 'twitter_cards_properties', 'twitter_custom' );

    Next you need to modify the array passed to the filter with your own values.

    function twitter_custom( $twitter_card ) {
    	if ( is_array( $twitter_card ) ) {
    		$twitter_card['creator'] = '@niall';
    		$twitter_card['creator:id'] = '1085';
    	}
    	return $twitter_card;
    }

    Do i need to put this
    add_filter( ‘twitter_cards_properties’, ‘twitter_custom’ );

    in header or?

    and where i put this

    function twitter_custom( $twitter_card ) {
    if ( is_array( $twitter_card ) ) {
    $twitter_card[‘creator’] = ‘@niall’;
    $twitter_card[‘creator:id’] = ‘1085’;
    }
    return $twitter_card;
    }

    Sorry for being such a noob…

    Plugin Author Niall Kennedy

    (@niallkennedy)

    You can add both pieces of code to your theme’s functions.php file. Change the creator fields of course.

    Ok thanks…now i’ve done that…do i now need to add those meta tags in my header file?

    Plugin Author Niall Kennedy

    (@niallkennedy)

    as long as your theme calls wp_head() and the plugin is activated you should be all set.

    plugin is activated, but not see Twitter cards anyway…hmmm i think im doing something wrong…I haven’t include meta tags to my header file, but nothing changes anyway…gosh im noob…

    Niall – Adding the function into my child theme works for me – thx.

    Even if you dont have time to code into the the plugin so it is “plug n play”, it would be very helpful to MANY people if you put the instructions in the installation tab.

    Thanks for your hard work 🙂

    Plugin Author Niall Kennedy

    (@niallkennedy)

    added filter howto in FAQ

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Twitter Cards] How to set up Twitter-Cards Plug-in to my Twitter?’ is closed to new replies.