Support » Plugin: Advanced Post List » [Plugin: Advanced Post List] PHP and shortcodes from other plugin

  • Resolved Nightjar


    Apologies for starting this same thread here (already posted on…

    Over the last 9 days I tried to configure APL so to use a shortlink from another plugin (Easy Custom Content Types) to pass data and populate a table.

    The only problem left is that ECCT is sending out date fields as Unix timestamps (i.e. sending out strings like “11404800″ instead of “13 May 1970″). I know that a Unix timestamp date can be converted using the following PHP code:

    date(‘j F Y’, $timestamp);

    I discovered someone else succeeded in running a shortcode inside APL using a custom PHP script:

    But as I’m not so proficient with PHP, can you please tell me how I should configure the [php_function name=”function_name” param=””] shortcode so to make it possible to convert those date entries (timestamps) through ECCT+Advanced Post List?

    Thanks a million for your help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • OK, I sorted out the date display problem, successfully converting the Unix timestamps.

    However, there is still a BIG issue standing. When I try to make a list of custom fields using this code for the table rows:

    <tr><td><img src="http://mywebsiteurl/wp-content/themes/blocked/includes/scripts/timthumb.php?src=[post_thumb]&w=90&h=40&zc=1&q=80&a=l" style="margin: 0px 2px;" /></td><td><a href="[post_permalink]">[post_title]</a></td><td>[post_meta name="ecpt_modello"]</td><td>[post_meta name="ecpt_nome"]</td><td>[post_meta name="ecpt_seriale-costruttore"]</td><td>[php_function name="sh_code" param="ecpt_field id=#data-consegna#"]</td><td>[php_function name="sh_code" param="ecpt_field id=#data-dismissione#"]</td><td>Da calcolare</td></tr>

    Your plugin just displays a series of fields (the ones generated by the php_function name=”sh_code” function) that are all the same. That is, every field of each row is the same as the latest entry of that group.

    I have tried to solve the problem with the ECCT plugin developer, but after a series of tries he gave up writing: According to their documentation, it should work. Unfortunately I really don’t know what else to tell you, sorry, not unless the Advanced List developer can come back with a specific reason why it’s not working.

    I have even tried to hire a developer in India, but he too failed to solve the problem.

    So, basically now I’m in your hands – I know that creating a table using shortcodes from another plugin should be possible (as explained here) but I don’t know what’s wrong.

    Can you please help me?

    Plugin Author EkoJR


    Main reason I haven’t been able to touch on this subject much is because the ECCT plugin is not a free plugin, and that makes it really hard for me to debug and figure out whats going on. Plus, the chances of them giving me access to their plugin is almost zero. So, I feel like I’m just shooting blanks in the dark trying, and just confusing the situation even more.

    Plus, most of the shortcodes I haven’t been able to mess with much to fully understand, as you might have noticed with “KALINS_ALLOW_PHP” tag, but I have a project set in the future to modify/fix and add shortcodes.

    …but I’ll give this another round to try and help you out. Everything should work right for individual posts and grabs the data from the page. Btw, what does your php function look like?

    OK, I forwared your request to ECCT developer, so (who knows?) he may provide you a copy of his plugin for testing. Or at least give you some additiona insights.

    Anyway, I’d appreciate really much if you can help me to get out of this mess…

    As I wrote, your plugin does work beautifully along with ECCT custom fields, provided it only grabs the provided data for each page through your post_meta name shortcode.

    But when I have to handle ECCT shortcodes through APL I must use this kind of code:

    [php_function name="sh_code" param="ecpt_field id=#data-consegna#"]

    Following the directions detailed here.

    So, I’ve just added this PHP to the function.php of my theme:

    function sh_code($post, $shcd){
       $shcd=str_replace('#','"',$shcd); //needed to parse " marks
          $output="[error: do_shortcode function doesn't exist!]";
       return $output;

    But using it gives a result like this:

    Entry 1: Custom field 1 OK – Custom field 2 OK – PHP generated from entry 3
    Entry 2: Custom field 1 OK – Custom field 2 OK – PHP generated from entry 3
    Entry 3: Custom field 1 OK – Custom field 2 OK – PHP generated from entry 3

    That is, using the PHP function and the ECCT shortcode just make APL display the data of latest entry repeated for all the lines of the table.

    Plugin Author EkoJR


    Ah ok. So it’s just the same as the other php function. Well, give me some time to check this out and see whats going on line by line. I may also have to look into the codex too. The problem for me is going to occur once I try to execute a shortcode that isn’t available for me.

    So, just so I have this right, ecpt_field is the shortcode in ECCT to access the values, and #data-consegna# is the param for the variable’s index which your trying to send/return the value of back. Btw, what is #data-consegna# exactly? A custom field in ECCT?

    OK, ECCT developer sent me a copy of his plugin for you, so to allow you to make any test you need. But probably it will be better to go on exchanging email messages instead. I can’t find yours, but mine is diego [at] cartabianca [dot com].

    And yes, data-consegna is an ECCT custom field (it’s in Italian and does mean “delivery date”). It’s put into #s because of the requirements of that custom PHP function that allows external shortcodes to run with your plugin.

    The data-consegna field is a date field, with the Unix Timestamp converted as a standard date format.

    Hope this helps – I’m looking forward to receiviing your email message, so I can send you a copy of ECCT plugin.

    The developer of the original PHP code that allows to use external shortcodes within APL just wrote on this same support forum:

    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.

    Maybe this can be of help trying to sort out the problem…

    Plugin Author EkoJR


    Yea, I checked out his reply just a min ago. He probably knows more about that function than I currently do. Lately, or majority of the development, I’ve been focused on getting the bigger stuff upgraded and patched up, and I haven’t ran into a situation where I personally had to use the php shortcode.

    He may have the solution, and the sh_code does carry the post object in the param. The id value of the individual posts would also be located $post->ID. The ECCT shortcode could be confused as to what post object your referring to and reverting to a default, but I also haven’t had a change to check out the ECCT shortcode function/method.

    Btw, I’m kinda surprised they would lend one out, but it does make things a lot easier for me. So, thank you in that sense, and I’ll be replying to you by email.

    Unfortunately though, I haven’t gotten around to debugging the php shortcode quite yet. Partly because of a dif. full time job. So, I can’t go into full detail yet.

    Plugin Author EkoJR


    Well, after looking into it. The function works well, and the $post param in the sh_code are being retrieved like they should, and $post->ID has the correct unique ID as well as the other varibles in the post object, but I didn’t see any unique value (ex. ID) being used for the ECCT shortcode function. So I basically just received the same exact shortcode.

    Does the ECCT shortcode have addition params?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Advanced Post List] PHP and shortcodes from other plugin’ is closed to new replies.