• 0
Sign in to follow this  
Followers 0

Customize plugin functions.php is not taking effect

Question

Posted · Report post

Hi I am trying to add custom post type to function.php in the Customize plugin.

add_action('init', 'alon_register');
	
	function alon_register() {
	
		$labels = array(
			'name' => _x('?????•? ?™??', 'post type general name'),
			'singular_name' => _x('?????•?? ???—?“', 'post type singular name'),
			'add_new' => _x('?”?•???? ?????•?? ?—?“?©', 'portfolio item'),
			'add_new_item' => __('?”?•???? ?????•?? ?—?“?©'),
			'edit_item' => __('?????•?? ?????•??'),
			'new_item' => __('?????•?? ?—?“?©'),
			'view_item' => __('?¦?¤?” ?‘?????•??'),
			'search_items' => __('?—?¤?© ?????•? ?™??'),
			'not_found' =>  __('Nothing found'),
			'not_found_in_trash' => __('Nothing found in Trash'),
			'parent_item_colon' => ''
		);
	
		$args = array(
			'labels' => $labels,
			'public' => true,
			'publicly_queryable' => true,
			'show_ui' => true,
			'query_var' => true,
			'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
			'rewrite' => true,
			'capability_type' => 'post',
			'hierarchical' => false,
			'menu_position' => null,
			'supports' => array('title','editor','thumbnail')
		  );
	
		register_post_type( 'alon' , $args );
	}
	
	 

The code is working great when I am moving the code to the "functions.php" in the pagelines theme. All other fiels are working well (css custom pages etc.). What could be the problem? Thank you Shani

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

Posted · Report post

The code works if you put it into the base child theme. The customize plugin probably gets included too late. BTW you have two add_action lines in your code.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Do you say that I can not use it to add those without base theme ?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I believe what he said is that it's not working because it's not loading soon enough in the theme files. Enabling the base theme is essentially the same thing as customize. Just move all your custom code over.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0