in2wp

  • Home
  • Tips
  • How to
  • Save
  • Themes
  • Contact

Home Page 3 Jetpack Publicize for share your site’s custom posts on social media

Jetpack Publicize for share your site’s custom posts on social media

By default, Jetpack’s Publicize is only triggered when you publish a new post. You can, however, extend this to other Custom Post Types. You have 2 options to add Publicize Support to a Custom Post Type:

  1. You can add Publicize support to an existing post type thanks to the add_post_type_support() function. To do so, add the following code to a functionality plugin or directly modifying the theme’s functions.php file. (carefully)

add_action(‘init’, ‘my_custom_init’);
function my_custom_init() {
add_post_type_support( ‘product’, ‘publicize’ );
}

You’ll need to replace “product” with your Custom Post Type name.

2. You can add Publicize support when registering the post type:

// Register Custom Post Type
function custom_post_type() {

$labels = array(
‘name’ => _x( ‘Products’, ‘Post Type General Name’, ‘text_domain’ ),
);
$args = array(
‘label’ => __( ‘product’, ‘text_domain’ ),
‘supports’ => array( ‘title’, ‘editor’, ‘publicize’, ‘wpcom-markdown’ ),
);
register_post_type( ‘product’, $args );

}
// Hook into the ‘init’ action
add_action( ‘init’, ‘custom_post_type’, 0 );

Nov 11, 2020in2wp
Wave.video Lifetime DealCustom Fields for Gutenberg
You Might Also Like
 
OpenGraph Tags – og:locale
 
Find Your Site’s Hidden .htaccess File in cPanel
4 years ago Code, How to, Tips, TricksCustom Post Types, Functions, Jetpack, Publicize, Share, Social Media175

Most viewed
root directory on Bitnami (WordPress) on Amazon LightSail
Root directory (htdocs) location – AWS LightSail (Bitnami & WordPress)
1,851 views
Cannot open the disk 'Windows7.vmdk' or one of the snapshot disks it depends on Module 'Disk' power on failed
How to fix “Module ‘disk’ power on failed” VMware
1,101 views
Wave-Video-Maker-Lifetime-plan-Animatron
Wave.video Lifetime Deal
1,043 views

About

in2wp

Start & Keep Growing with WP!

Guide you to quickly take your business online with WordPress and go beyond the usual online marketing actions.

This content uses referral links, which means in2wp may be compensated in exchange for your clicking on links posted on this website. Read our disclosure policy for more info.

  • in2wp
  • Contact in2wp
  • Terms of Service
  • Privacy Policy
2018 © in2wp.com | It all starts with a simple d̵r̵e̵a̵m̵ WordPress website !