WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Post List
Using shortcodes in List content section. (6 posts)

  1. jjyepez
    Member
    Posted 2 years ago #

    First of all, I want to publicly thank the developers of this amazing plugin. It's just awesome for us developers.

    That been said,
    I have figured out a way to insert shortcodes in the List content section, so you can enhance even more the power of this plugin.

    Hope this is helpful for you guys.

    --

    1.- Do the known to get [php_function name="function_name" param=""] enabled in the APL. Please refer to (kalinbooks site).

    2.- Create a function in wp-config.php immediatly after defining the constant "KALINS_ALLOW_PHP" similar to the following:

    define("KALINS_ALLOW_PHP", true);
    function sh_code($post, $shcd){
       $shcd=str_replace('#','"',$shcd); //needed to parse " marks
       if(function_exists('do_shortcode')){
          $output=do_shortcode('['.$shcd.']');
       }else{
          $output="[error: do_shortcode function doesn't exist!]";
       }
       return $output;
    }

    3.- Use the [php_function name="function_name" param=""] code like this -in the List content section-:

    [php_function name="sh_code" param="gallery id=#[ID]# size=#medium# columns=#3#"]

    NOTE: Pay special attention to the use of «[ID]» and «#» in the example .. «[ID]» is an APL code that is parsed before the param is.

    Well, that's it. I have successfully proven this so, This WORKS!
    Enjoy it!

    Again, thanks to the authors of this amazing plugin.

    Regards,
    --
    jjyepez

    http://wordpress.org/extend/plugins/advanced-post-list/

  2. jjyepez
    Member
    Posted 2 years ago #

    <<< spanish translation - traducción al castellano>>>

    Antes que nada me gustaría agradecer publicamente a los autores de este increible plugin. Es realmente genial para desarrolladores.

    Dicho eso,
    He descubierto la manera de insertar shortcodes en la sección List content, con lo que se puede ampliar aún más el poder de este plugin.

    Espero que este post sea de ayuda para todos.

    --

    1.- Haz lo necesario para habilitar el uso de [php_function name="function_name" param=""] en el APL. Detalles en (sitio de kalinbook).

    2.- Crea una función en wp-config.php inmediatamente luego de definir la constante "KALINS_ALLOW_PHP", similar a la siguiente:

    define("KALINS_ALLOW_PHP", true);
    function sh_code($post, $shcd){
       $shcd=str_replace('#','"',$shcd); //necesario para usar las "
       if(function_exists('do_shortcode')){
          $salida=do_shortcode('['.$shcd.']');
       }else{
          $salida="[error: la funcion do_shortcode no existe!]";
       }
       return $salida;
    }

    3.- Usa el código [php_function name="function_name" param=""] de la siguiente manera -en la sección List content-:

    [php_function name="sh_code" param="gallery id=#[ID]# size=#medium# columns=#3#"]

    NOTA: Presta especial atención en el uso de «[ID]» y «#» en el ejemplo anterior .. «[ID]» es un código propio de APL que es interpretado antes de param.

    Bien, eso es todo! Lo he probado con éxito asi que, FUNCIONA!
    Que lo disfruten!

    De nuevo, gracias a los creadores de este increible plugin.

    Saludos,
    --
    jjyepez

    http://wordpress.org/extend/plugins/advanced-post-list/

  3. jokerbr313
    Member
    Plugin Author

    Posted 2 years ago #

    This is a nice example of the plugin's feature. If it's alright with you, when I get around to making a proper wiki section, can I use this or use it as a reference? Considering you put the time into composing it, I figured it would be proper to ask.

    Thank you for posting this topic.

  4. jjyepez
    Member
    Posted 2 years ago #

    Yes, of course you can use this the way you consider more useful for others.
    And thank YOU for creating this amazing piece!
    :-)

    Best regards,
    --
    jjyepez

  5. Nightjar
    Member
    Posted 1 year ago #

    I have tried to use your PHP function along with Easy Custom Content Types for WordPress, but when I place the following code on a table:

    <td>[php_function name="sh_code" param="ecpt_field id=#data-consegna#"]</td>

    The data displayed on every column is the same - that is the data related to the last entry repeated on all the fields of the same column.

    Any idea on what's wrong?

  6. jjyepez
    Member
    Posted 1 year ago #

    Hi Nightjar,

    Are you making a proper "custom type" selection on the Advanced Post List settings header?
    If so, as I can see, that short code "ecpt_field" is based on a different $post object var than the generic $post used in the loop ..

    Remember that Advanced Post List uses a generic $post reference as shown in the example.

    Perhaps, you should pass the ecpt_field shortcode the $post->ID that is currently received by the sh_code function.

    Regrds & success,
    --
    jjyepez

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic