Title: Using do_shortcode filters
Last modified: August 21, 2016

---

# Using do_shortcode filters

 *  Resolved [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/)
 * Hi everyone. xnau, thanx for great work with Participants Database!
 * There’s a problem using function do_shortcode: I need to call [pdb_list] with
   filters in the end of pdp-single-default.php. Is there’s a way of doing it?
 * When using <?php echo do_shortcode(‘[pdb_list filter=”…”]’);?> filter’s not working.
 * Thanx in advance
    Konstantin
 * [http://wordpress.org/extend/plugins/participants-database/](http://wordpress.org/extend/plugins/participants-database/)

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

 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3701767)
 * There’s a way to create an URL that includes search terms, so you won’t have 
   to use the do_shortcode thing at all.
 * For instance, you want to show only records from the state of California, add
   these parameters to the URL:
 * `search_field=state&value=CA&operator=LIKE&submit=Search`
 * You can only do this on one field at a time with the current version of the plugin.
 *  Thread Starter [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3701907)
 * Thanx for the answer.
 * Please consult how to transform user profile URL (associated with pdb-single-
   default.php) from “[http://example.com/sportsmen?pdb=567&#8221](http://example.com/sportsmen?pdb=567&#8221);
   to “[http://example.com/sportsmen?pdb=567&search_field=state&value=CA&submit=Search&#8221](http://example.com/sportsmen?pdb=567&search_field=state&value=CA&submit=Search&#8221);?
   Where record pdb=567 has ‘state’ value ‘CA’.
 * It must be rather stupid question I suppose, be I’m not good at php, sorry.
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3701936)
 * Well, you’re mixing the functions of two different shortcodes. That example I
   gave is for the the “pdb_list” shortcode, and tells the shortcode which records
   to include in the list. The “pdb” value is only used by the “pdb_single” shortcode,
   which is for the purpose of displaying that one record. Since the ‘pdb’ value
   is choosing the record to show, there is no need for any search parameters at
   that point.
 * Perhaps if you stated what you are trying to accomplish it would be easier to
   point you in the right direction.
 *  Thread Starter [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3701969)
 * Sorry for misunderstanding.
 * I have a page containing [pdb_single] showing data of one record (sportsman results
   at particular competition). I need to add table to that page showing results 
   of that sportsman on other competitions. To have something like “sportsman profile”.
 * That’s why in the first message I tried to get for example name of the sportsman
   in [pdb_single] (in variable $lastname). And after that call do_shortcode with
   filter like:
    <?php echo do_shortcode(‘[pdb_list filter=”.$lastname.”]’) ?>
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702033)
 * Ah, I see. Yes, you can do this. Try placing your “do_shortcode” in a custom 
   template for your single record. You could put something like:
 * `<?php echo do_shortcode('[pdb_list filter="id='.$this->participant_values['last_name'].'"]')?
   >`
 * All of the values of the record are available in the $this->participant_values
   array. You just drop the value you want to match into the filter statement in
   the shortcode string.
 *  Thread Starter [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702069)
 * Yes, I tried to add this code to the custom template of the page.
    But filters
   and fields’re not working by unknown reason. It places the whole table of shortcode[
   pdb_list] with standard fields.
 * I even tried to add simple filter like
    <?php echo do_shortcode(‘[pdb_list fields
   =”last_name,city” filter=”last_name=Smith”]’) ?> But result is the same – whole
   table without any filter.
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702071)
 * Well, you’ll have to dig deeper to see the problem. I know this works, I tested
   it before answering. All I can suggest is you take a look at your PHP error logs
   to see if there is some other problem. Both the “fields” and “filter” attributes
   require that the field names be valid names, or they will be ignored and you’ll
   get everything.
 * Are you using the latest version of the plugin?
 *  Thread Starter [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702072)
 * Yes, version’s 1.4.9.3.
    Error logs show only: [03-May-2013 21:00:12 UTC] PDb_List::
   _build_shortcode_query list query= SELECT p.id, p.last_name, p.first_name, p.
   club, p.shooting_result, p.sprint_result, p.swimming_result, p.cross_result, 
   p.start_name, p.sprint_pres FROM wp_participants_database p ORDER BY p.date_updated
   ASC
 * last_name, first_name etc are the fields of my database.
 * Maybe there’s a system error in wordpress, need to reinstall plugin and try again
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702080)
 * Huh, puzzling. Can you provide a link so I can see it? Email it to me if you 
   want it private. support AT xnau.com
 *  Thread Starter [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702083)
 * Site page example:
    [http://polyathlon-russia.com/sportsmen?pdb=563](http://polyathlon-russia.com/sportsmen?pdb=563)
 * Interesting, it works differently on localhost and on site:
    – on local host 
   it shows only standard [pdb_list] without any filters and fields – on site it
   works perfectly with defined parameters like: <?php echo do_shortcode(‘[pdb_list
   filter=”last_name=Smith” fields=”last_name,first_name,club,start_name”]’); ?>
 * but has error when using $this:
    <?php echo do_shortcode(‘[pdb_list filter=”last_name
   =’.$this->participant_values[‘last_name’].'” fields=”last_name,first_name,club,
   start_name”]’); ?>
 * Error is (displays on the bottom of the page):
    Fatal error: Using $this when
   not in object context in /home/k.bashevoy/data/www/polyathlon-russia.com/wp-content/
   themes/pinboard/template-sidebar-content.php on line 16
 *  Thread Starter [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702084)
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702085)
 * Sometimes things won’t work the same with localhost because the configuration
   values will need to be different.
 * On the error, that code will only work in a plugin template, because it is only
   in that context the “$this” is set. You can’t use it in a WP theme template.
 * Try it in a custom template for the single shortcode, it will work.
 *  Thread Starter [polymaker](https://wordpress.org/support/users/polymaker/)
 * (@polymaker)
 * [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702088)
 * It works great now. Thanx!

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

The topic ‘Using do_shortcode filters’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 13 replies
 * 2 participants
 * Last reply from: [polymaker](https://wordpress.org/support/users/polymaker/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/using-do_shortcode-filters/#post-3702088)
 * Status: resolved