Skip to content

Instantly share code, notes, and snippets.

@eto4detak
Created February 18, 2019 18:32
Show Gist options
  • Save eto4detak/f2d9b222cdd1e6c3d20ff3bdad00df18 to your computer and use it in GitHub Desktop.
Save eto4detak/f2d9b222cdd1e6c3d20ff3bdad00df18 to your computer and use it in GitHub Desktop.
wp php carbon
<?php
<?php
use Carbon_Fields\Container;
use Carbon_Fields\Field;
if ( ! function_exists( 'carbon_get_post_meta' ) ) {
function carbon_get_post_meta( $id, $name, $type = null ) {
return false;
}
}
if ( ! function_exists( 'carbon_get_the_post_meta' ) ) {
function carbon_get_the_post_meta( $name, $type = null ) {
return false;
}
}
if ( ! function_exists( 'carbon_get_theme_option' ) ) {
function carbon_get_theme_option( $name, $type = null ) {
return false;
}
}
if ( ! function_exists( 'carbon_get_term_meta' ) ) {
function carbon_get_term_meta( $id, $name, $type = null ) {
return false;
}
}
if ( ! function_exists( 'carbon_get_user_meta' ) ) {
function carbon_get_user_meta( $id, $name, $type = null ) {
return false;
}
}
if ( ! function_exists( 'carbon_get_comment_meta' ) ) {
function carbon_get_comment_meta( $id, $name, $type = null ) {
return false;
}
}
if(class_exists('Carbon_Fields\Container') ){
Container::make( 'term_meta', 'Настройки Term' )
->show_on_taxonomy( 'product_cat' ) // По умолчанию, можно не писать
//->show_on_category('product_cat')
->add_fields( array(
//Field::make( 'text', 'title_color', 'Цвет заголовка' ),
Field::make("rich_text", "crb_exclude_cat", "Дополнительный текст")
) )
->add_fields( array(
//Field::make( 'text', 'title_color', 'Цвет заголовка' ),
Field::make("rich_text", "crb_mini_text_cat", "Мини тест в карточке категории")
) )
;
Container::make( 'theme_options', __( 'Theme Options', 'crb' ) )
->add_fields( array(
Field::make( 'text', 'crb_text', 'Text Field' ),
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment