Title: Custom fields
Last modified: July 3, 2017

---

# Custom fields

 *  Resolved [Alph](https://wordpress.org/support/users/alpph/)
 * (@alpph)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/)
 * Hi
 * I create Custom Post Types (CPT) and Custom Fields (CF) with Toolset Types from
   OnTheGoSystems.
 * CPT slug is ‘types_recette’ and one CF slug is ‘sous_titre’
 * I modified the content.php file in the child theme to display all the fields 
   of CPT ‘types_recette’.
 * I can display what I want from my CPT with Advanced Post List **without** the
   values of the custom fields.
 * How can I do that ?
 * Thanks for your answer
    -  This topic was modified 8 years, 11 months ago by [Alph](https://wordpress.org/support/users/alpph/).
    -  This topic was modified 8 years, 11 months ago by [Alph](https://wordpress.org/support/users/alpph/).

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [EkoJR](https://wordpress.org/support/users/ekojr/)
 * (@ekojr)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9284900)
 * I haven’t used APL in that sort of environment, but the [Internal Shortcodes](https://github.com/Advanced-Post-List/advanced-post-list/wiki/Internal-Shortcode-Page)
   are primarily for Built-in Post values.
 * However, if you do want to add custom fields. There is also a custom php shortcode.
 * Currently, most of the information and documentation for APL has been getting
   added to the [GitHub Wiki](https://github.com/Advanced-Post-List/advanced-post-list/wiki).
   It’s a work-in-progress, but 0.4 is likely to have new documentation that correlates
   to it.
 *  Thread Starter [Alph](https://wordpress.org/support/users/alpph/)
 * (@alpph)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9293909)
 * Hi,
 * Thanks for your help. I understand the working of php_function.
 * This works :
 * `[php_function name="my_custom_field"]`
 *     ```
       function my_custom_field () {
       $retour = '';
       if (types_render_field( "sous_titre",  array( ) ) )  {
          $retour =  (types_render_field( "sous_titre", array( 'raw' => true) )); };
       return $retour ;
       }
       ```
   
 * But this does not works :
 * `[php_function name="my_custom_field" param="sous_titre"]`
 *     ```
       function my_custom_field ($field_name) {
       $retour = '';
       if (types_render_field( $field_name,  array( ) ) )  {
          $retour =  (types_render_field( $field_name, array( 'raw' => true) )); };
       return $retour ;
       }
       ```
   
 * Any Idea that can help ?
 * Thanks
 *  Plugin Author [EkoJR](https://wordpress.org/support/users/ekojr/)
 * (@ekojr)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9294441)
 * The first param MUST be a WP_Post variable `$post`. I think that may solve your
   issue.
 * I also recently finished writing a [Tutorial on PHP_Function Shortcode](https://github.com/Advanced-Post-List/advanced-post-list/wiki/Tutorial---PHP_Function-Shortcode).
 *  Thread Starter [Alph](https://wordpress.org/support/users/alpph/)
 * (@alpph)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9294910)
 * Hi,
 *     ```
       function my_custom_field ( $post, $myfield ) {
         $retour = '';
       	if (types_render_field(  $myfield ,  array( ) ) )  {
       		 $retour .=  (types_render_field( $myfield , array( 'raw' => true) ));
       	} ;
         return $retour ;
       }
       ```
   
 * That works. Hurrah !!
 * I reword your answer : there is an implicit first parameter $post, the param 
   passed with [php_function…] is in fact the second parameter.
 * Please add a example with <param = “Something”> in your tutorial.
 * Thanks
    -  This reply was modified 8 years, 11 months ago by [Alph](https://wordpress.org/support/users/alpph/).
    -  This reply was modified 8 years, 11 months ago by [Alph](https://wordpress.org/support/users/alpph/).
    -  This reply was modified 8 years, 11 months ago by [Alph](https://wordpress.org/support/users/alpph/).
 *  Thread Starter [Alph](https://wordpress.org/support/users/alpph/)
 * (@alpph)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9295024)
 * Hi,
 * Just a question : How to pass more as one parameter ?
 * Thanks
 *  Plugin Author [EkoJR](https://wordpress.org/support/users/ekojr/)
 * (@ekojr)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9297952)
 * Currently, there can only be 1 param passed. I haven’t had any need for it, although
   I think I remember contemplating a redesign at one point, and I thought about
   passing an array of params, but I wanted to keep it simple for others, and prior
   to 0.3.2 it wasn’t a possibility to implement multiple parameters.
 * _Thinking it over:_
    - I can’t changed too much with others already using the php_function.
    - I don’t want to add additional call to function params. If I did, it would
      be 3, but then there would be the confusion with php param erros.
    - The param type will always be a string due to how WP saves the data
 * With that in mind, I did have another thought. Add the whole shortcode attribute
   array as the 3rd param, and let others handle the data on their own; this method
   is actually relatively easy for others to do. This would offer both a novice,
   and an advanced method which would have to handled its own set of data accordingly.
    -  This reply was modified 8 years, 11 months ago by [EkoJR](https://wordpress.org/support/users/ekojr/).
 *  Thread Starter [Alph](https://wordpress.org/support/users/alpph/)
 * (@alpph)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9299201)
 * Hi,
 * I finished the transition from an other plugin with the same functions, but with
   no update since a long time.
 * See :
 * [http://www.papinette.fr/?page_id=300](http://www.papinette.fr/?page_id=300)
 * About more that one param, it was just a question for completness. I don’t need
   it.
 * I will put a request for an add : a More function in the lists. Curently I don’t
   need it, but with more than 100 posts, a list will be very long.
 * Thanks for all
    -  This reply was modified 8 years, 11 months ago by [Alph](https://wordpress.org/support/users/alpph/).
    -  This reply was modified 8 years, 11 months ago by [Alph](https://wordpress.org/support/users/alpph/).
 *  Plugin Author [EkoJR](https://wordpress.org/support/users/ekojr/)
 * (@ekojr)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9301763)
 * I just noticed you made a post here, and realized the GitHub issue was related.
   Slightly confused to what is being said.
 * I am curious, what is the other plugin that you were using prior to APL?
 *  Thread Starter [Alph](https://wordpress.org/support/users/alpph/)
 * (@alpph)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9302389)
 * I complete the Github issue with a screenshot to explain what I mean.
 * Prior I was using [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * There are no updates and no support since one year, and some shortcodes do not
   work any more with the last version of WP.
 *  Plugin Author [EkoJR](https://wordpress.org/support/users/ekojr/)
 * (@ekojr)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9304256)
 * Interesting…that’s the first time I’ve heard of that plugin, and it appears to
   apply many of the same concepts APL has. In APL’s case, majority of the configurations
   are applied on the admin side as a Preset, instead of a collection of shortcodes
   and/or shortcode attributes. Which is one of the things I always preferred in
   order to make APL a bit more manageable instead of making a muck out of things.
 * The other plugin does seem to have very high ratings, and I’m kind of curious
   what made it unique. Perhaps if I get some time spare time I’ll check it out.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Custom fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/advanced-post-list.svg)
 * [Advanced Post List](https://wordpress.org/plugins/advanced-post-list/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-post-list/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-post-list/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-post-list/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-post-list/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-post-list/reviews/)

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)

 * 10 replies
 * 2 participants
 * Last reply from: [EkoJR](https://wordpress.org/support/users/ekojr/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/custom-fields-253/#post-9304256)
 * Status: resolved