Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Some one already asked that here, but that doesn't solve my problem.

My theme disabling the custom fields. How I can enable it manually? I want to know that which code Wordpress use to show Custom fields widget? Please help.

Update: Actually this is educational theme that create some new Posting options which are "Course", "Lesson" & "Testimonial". I want to bring custom fields there.

Newly created posting methods
Now custom fields option

Fuctions.php:

    <?php
//Error reporting
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);

//Define constants
define('SITE_URL', home_url().'/');
define('AJAX_URL', admin_url('admin-ajax.php'));
define('THEME_PATH', get_template_directory().'/');
define('THEME_URI', get_template_directory_uri().'/');
define('THEME_CSS_URI', get_stylesheet_directory_uri().'/');
define('THEMEX_PATH', THEME_PATH.'framework/');
define('THEMEX_URI', THEME_URI.'framework/');

//Set content width
$content_width=1140;

//Load language files
load_theme_textdomain('academy', THEME_PATH.'languages');

//Include theme functions
include(THEMEX_PATH.'functions.php');

//Include theme configuration file
include(THEMEX_PATH.'config.php');

//Include core class
include(THEMEX_PATH.'classes/themex.core.php');

//Init theme
$theme=new ThemexCore($config);
share|improve this question
    
What is the name of your theme? –  Sven Oct 6 '13 at 13:04
    
You need to show us the code that your theme uses. Look into the file functions.php. Also, can you post a screenshot of your screen options? –  brasofilo Oct 6 '13 at 13:04
    
@Sven "Academy" bougth from themeforest. I urgently need answer so post question here. –  John Doe Oct 6 '13 at 13:05
    
@there is no relation with functions.php please see update –  John Doe Oct 6 '13 at 13:13
    
Well, if there's no relation with functions.php, with what does it relates? –  brasofilo Oct 6 '13 at 13:20

1 Answer 1

up vote 3 down vote accepted

Create a Child Theme, Plugin or Must Use plugin, and use add_post_type_support:

<?php
/* Plugin Name: Add CF to CPTs */

add_action( 'plugins_loaded', 'add_cpt_support_wpse_116891' );

function add_cpt_support_wpse_116891(){
    # See /wp-admin/edit.php?post_type=SLUG
    add_post_type_support( 'SLUG-POST-TYPE-1', array( 'custom-fields' ) );
    add_post_type_support( 'SLUG-POST-TYPE-2', array( 'custom-fields' ) );
    add_post_type_support( 'SLUG-POST-TYPE-3', array( 'custom-fields' ) );
}
share|improve this answer
    
Please create make plugin. I create one but it is not working. –  John Doe Oct 6 '13 at 16:46
    
I had do the following but its look not working. What I am doing wrong? <?php /* Plugin Name: My custom Plugin Plugin URI: http://example.com Description: A brief description of the Plugin. Version: The Plugin's Version Number, e.g.: 1.0 Author: John Doe Author URI: http://example.com License: A "Slug" license name e.g. GPL2 */ add_action( 'plugins_loaded', function(){ add_post_type_support( 'Course', array( 'custom-fields' ) ); add_post_type_support( 'Lesson', array( 'custom-fields' ) ); add_post_type_support( 'Testimonial', array( 'custom-fields' ) ); }); ?> –  John Doe Oct 7 '13 at 6:31
    
That is URL http://localhost/wordpress/wp-admin/post-new.php?post_type=lesson. What is slug in it? –  John Doe Oct 7 '13 at 6:35
    
Sorry, I write 'Lesson' rather then 'lesson'. Now its working. Thanks you very much –  John Doe Oct 7 '13 at 6:37
    
The plugin work fine on localhost but when I upload it on my website i got this error: Parse error: syntax error, unexpected T_FUNCTION in /home1/tissosas/public_html/asanpaisa.com/wp-content/mu-plugins/custom field adder.php on line 11 That is why? –  John Doe Oct 7 '13 at 7:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.