Widget Visibility and other Secret Loves - WordCamp Ottawa 2016

Preview:

Citation preview

Widget Visibility and Other Secret Loves

@richardmtl

Happiness Engineer with Automattic

richard@automattic.com

Richard Archambault

Montrealer, fan of metros (and Mini Metro!)

wpmtl.org

Mini Metro!

dinopoloclub.com/minimetro/

Useful Modules

Custom CSS

Widget Visibility

Extra Sidebar Widgets

Image GoodreadsContact Info

Shortcode Embeds

Soundcloud SlideshareRecipes

Protect

Site Verification Tools

Theme Tools

Social Icons Widget Social Menu

• Facebook • Twitter • Instagram • Pinterest • LinkedIN • Github • YouTube • Vimeo • Google+

• CodePen • Digg • Dribble • Dropbox • Email • Facebook • Flickr • Foursquare • Github • Google+ • Instagram • LinkedIn • Path • Pinterest

• Pocket • Polldaddy • Reddit • RSS feed • Skype • Spotify • StumbleUpon • Tumblr • Twitch • Twitter • Vimeo • WordPress • Youtube

Social LinksWidgets

• Facebook • Twitter • LinkedIn • Google+ • Tumblr

Publicize connections Custom Menu

Let’s get Social!

Social Menuadd_theme_support('jetpack-social-menu');

<?phpif(function_exists('jetpack_social_menu'))jetpack_social_menu();?>

https://jetpack.com/support/social-menu/

Responsive Videofunctionjetpackme_responsive_videos_setup(){add_theme_support('jetpack-responsive-videos');}add_action('after_setup_theme','jetpackme_responsive_videos_setup');

https://jetpack.com/support/responsive-videos/

Breadcrumbsif(function_exists('jetpack_breadcrumbs')):?><divclass="my-breadcrumbs"><?phpjetpack_breadcrumbs();?></div><!--.my-breadcrumbs--><?phpendif;?>

Other Theme Tools

•Tonesque (colours!) •Infinite Scroll •Featured Content

Useful Filters

Open Graph

functionjetpackme_developer_fb_home_image($tags){if(is_home()||is_front_page()){//RemovethedefaultblankimageaddedbyJetpackunset($tags['og:image']);$fb_home_img='YOUR_IMAGE_URL';$tags['og:image']=esc_url($fb_home_img);}return$tags;}add_filter('jetpack_open_graph_tags','jetpackme_developer_fb_home_image');

Custom tag for the home page

https://jetpack.com/2013/07/12/add-a-default-image-open-graph-tag-on-home-page/

Open Graphfunctionjetpackdeveloper_custom_image($media,$post_id,$args){if($media){return$media;}else{$permalink=get_permalink($post_id);$url=apply_filters('jetpack_photon_url','YOUR_LOGO_IMG_URL');returnarray(array('type'=>'image','from'=>'custom_fallback','src'=>esc_url($url),'href'=>$permalink,));}}add_filter('jetpack_images_get_images','jetpackdeveloper_custom_image',10,3);

Add fallback default image

https://jetpack.com/2013/10/15/add-a-default-fallback-image-if-no-image/

Subscriptions

functionjetpackme_exclude_posts_subscriptions($categories){$categories=array('boring','dull');return$categories;}add_filter('jetpack_subscriptions_exclude_these_categories','jetpackme_exclude_posts_subscriptions');

Exclude categories of posts

Related Posts

functionjetpackme_more_related_posts($options){$options['size']=6;return$options;}add_filter('jetpack_relatedposts_filter_options','jetpackme_more_related_posts');

Change the number of posts displayed

https://jetpack.com/support/related-posts/customize-related-posts/

Related Posts

functionallow_my_post_types($allowed_post_types){$allowed_post_types[]='your-post-type';return$allowed_post_types;}add_filter('rest_api_allowed_post_types','allow_my_post_types');

Include Custom Post Types

https://jetpack.com/support/related-posts/customize-related-posts/

Need help?

jetpack.com/support

@jetpack

Lots more!

https://jetpack.com/tag/hook-of-the-month/

https://developer.jetpack.com/

Brand New!

@richardmtlrichard@automattic.com

Questions?