• First, WP and PHP are new to me so I need some guidance on how to handle the following scenario. I am using a plugin called ListYoFiles that provides a table of files/file details in a WP folder given specific parameters. The plugin works great and uses the following shortcode to return a table of file details.

    [CODE][listyofiles folder=”wp-content/downloads” sort=”alphabetic” options=”table, date, filesize,icon” filter=”enter filter params here”][/CODE]

    I would like to enhance the list of files displayed on the page by passing a filter using a pre-defined select list value that I will convert and compare to the filename in the plugin. Below is a link of the final display where the user would select a list item and the onchange event would either execute a script or do_shortcode directly in the onchange event with the required parameters and refresh the page with filtered rows. WP do_shortcode is a function so it should be executable in the onchange event. The code below showing alert(index) was just to see if the function was ever executed and it does indeed show the selected value.
    https://i125.photobucket.com/albums/p62/eclerkin/wib_filelist.jpg
    [CODE]

    <script type=”text/javascript”>function filtergroup(index){alert(index);}</script>

    <select name=”select_filter” onChange=”filtergroup(this.options[this.selectedIndex].innerText)”> <option selected=”selected” value=”1″>- Select group to filter list -</option> <option value=”2″>Board Effectiveness Committee (BEC)</option> <option value=”3″>Executive Committee (EC)</option> <option value=”4″>Finance Operations Review Committee (FORC)</option> <option value=”5″>One-Stop Leadership Committee (OSLC)</option> <option value=”6″>Workforce Investment Board (WIB)</option> <option value=”7″>Youth Council Committee (YCC)</option></select>

    [/CODE]

    I was reading about the use of the WP function do_shortcode for executing shortcodes outside the loop but I cannot seem to get it to execute in the script shown above. This seems to be the correct usage of do_shortcode:

    [CODE]

    <?php echo do_shortcode(‘[myshortcode param1=”param value here”]’); ?>

    [/CODE]

    For my scenario, I believe this is the correct function setup for the script but it fails to execute:

    [CODE]

    echo do_shortcode(‘[listyofiles folder=”wp-content/downloads” sort=”alphabetic” options=”table, date, filesize,icon” filter=”enter filter params here”]’);

    [/CODE]

    I tried including the PHP wrapper (<?php echo do_shortcode(blah blah blah) ?>) and then not and it doesn’t seem to like either method. Any guidance on helping me solve this problem would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using do_shortcode on a WP page’ is closed to new replies.