WordPress – Elegant themes – Extra – Activer les post formats pour les custom post types – Enable Post Formats for CPTs

Ajouter Post formats pour les custom post types

Enable Post Formats for Custom Post Types CPT Extra from elegant themes

sur le thème parent…
Parent theme
wp-content/themes/Extra/framework/admin/post-formats.php
ligne 17, remplacer
line 17, replace
'post_type' => 'post',
par
by
'post_type' => array('post','formations-gratuites','formations-membres'),

wp-content/themes/Extra/framework/post-formats.php
trouver ligne 31
find line 31
add_post_type_support( 'post', 'et-post-formats' );
changer en
modify to
add_post_type_support( 'post', 'et-post-formats', 'formations-gratuites', 'formations-membres' );

trouver ligne 185
find line 185
function et_has_format_content( $post_id = 0 ) {
if ( empty( $post_id ) ) {
$post_id = get_the_ID();
}
if ( 'post' === get_post_type( $post_id ) ) {

modifier en
modify to
function et_has_format_content( $post_id = 0 ) {
if ( empty( $post_id ) ) {
$post_id = get_the_ID();
}
if ( 'post' === get_post_type( $post_id ) || 'formations-gratuites' === get_post_type( $post_id ) || 'formations-membres' === get_post_type( $post_id ) ) {

wp-content/themes/Extra/includes/admin/admin.php
trouver … ligne 92
find … line 92
class Extra_Post_Format_Meta_Box extends ET_Meta_Box {
public $post_format;
public function __construct( $id, $title, $post_format ) {
parent::__construct( $id, $title, array(
'post_type' => 'post',

changer en …
Modify to
class Extra_Post_Format_Meta_Box extends ET_Meta_Box {
public $post_format;
public function __construct( $id, $title, $post_format ) {
parent::__construct( $id, $title, array(
'post_type' => array('post','formations-gratuites','formations-membres'),

trouver ligne 141
find line 141
class Extra_Page_Template_Meta_Box extends ET_Meta_Box {
public $page_template;
public function __construct( $id, $title, $page_template ) {
parent::__construct( $id, $title, array(
'post_type' => 'page'

changer en
Modify to
class Extra_Page_Template_Meta_Box extends ET_Meta_Box {
public $page_template;
public function __construct( $id, $title, $page_template ) {
parent::__construct( $id, $title, array(
'post_type' => array('page','formations-gratuites','formations-membres'),

Author: bejisan

Share This Post On