• Resolved kirasiris

    (@kirasiris)


    I normally create custom fields by doing the following in my functions.php file:

    
    function preview_link($postID){
    	$demo_url = 'preview_url';
    	$demostracion_url = get_post_meta($postID, $demo_url, true);
    	if($demostracion_url==''){
    		delete_post_meta($postID,$demo_url);
    		add_post_meta($postID,$demo_url, '#');
    		return '#';
    	}
    	return $demostracion_url;
    }
    

    after this I will just need to type it in the custom field metabox(which does not even appear) in order to use it but for some reason I can not get it to work; I really need this as I’m creating a theme in which client will sell templates and needs a link to showcase the demo.

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How can I add custom fields to the posts?’ is closed to new replies.