Making WordPress.org

Ticket #502: meta502.2.diff

File meta502.2.diff, 2.8 KB (added by kraftbj, 10 years ago)

Refresh of patch per https://meta.trac.wordpress.org/ticket/502#comment:7

  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-jetpack/img/wp-default-og.png

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-jetpack/wordcamp-jetpack.php

    Property changes on: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-jetpack/img/wp-default-og.png
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/octet-stream
    \ No newline at end of property
     
     1<?php
     2
     3/*
     4 * Plugin Name: WordCamp Jetpack Overrides
     5 * Description: Adjustments to Jetpack functionality for WordCamp.org
     6 * Version:     0.1
     7 * Author:      Brandon Kraft
     8 */
     9
     10
     11/*
     12 * Open Graph Default Image
     13 * Provides a default image for sharing WordCamp home/pages to Facebook/Twitter/Google+ other than the Jetpack "blank" image.
     14 */
     15
     16function wc_default_og_image() {
     17        $default_img = plugins_url( 'img/wp-default-og.png', __FILE__ );
     18    return $default_img;
     19}
     20add_filter( 'jetpack_open_graph_image_default', 'wc_default_og_image' );
     21
     22/*
     23 * Add Twitter Card type
     24 * Added the twiter:card = summary OG tag for the home page and other !is_singular() pages, which is not added by default by Jetpack.
     25 */
     26
     27function wc_add_og_twitter_summary( $og_tags ) {
     28        if ( is_home() || is_front_page() ) {
     29                $og_tags['twitter:card'] = 'summary';
     30        }
     31
     32        return $og_tags;
     33}
     34add_filter( 'jetpack_open_graph_tags', 'wc_add_og_twitter_summary');
     35
     36/*
     37 * Add default Twitter account as @WordCamp for when individual WCs do not set their Settings->Sharing option for Twitter cards only. Sets the "via" tag to blank to avoid slamming @WordCamp moderators with a ton of shared posts.
     38 */
     39
     40function wc_twitter_sitetag( $site_tag ) {
     41        if ( $site_tag == 'jetpack' ) {
     42                $site_tag = 'WordCamp';
     43                add_filter('jetpack_sharing_twitter_via', '');
     44        }
     45
     46        return $site_tag;
     47}
     48add_filter( 'jetpack_twitter_cards_site_tag', 'wc_twitter_sitetag');
     49 No newline at end of file