• Resolved raesea

    (@raesea)


    I am trying to get two (or more than one) shortcodes to work on one page which displays the pdb_single output. I am calling them as directed in the documentation.
    Example:
    [pdb_single template=”my-template1″]
    [pdb_single template=”my-template2″]

    Each time the results are a duplicate of the first template and do not include the second template. It’s like the loop repeats itself and ignores the second template. The templates are in the correct folder, and they all work as expected when called via shortcode individually. The same result occurs if I add a filter to the shortcode.

    Shouldn’t I be able to use two templates to display the pdb_single results on one page?

    https://www.ads-software.com/plugins/participants-database/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Yes, this is working in my tests. I’m guessing what’s happening here is the default template is getting used in both cases, your custom templates aren’t getting used at all.

    The usual reason for that is they are not where the plugin can find them. They should be in a directory named “templates” in your theme directory.

    Try adding something to your custom templates so you know for certain which one is loading.

    Thread Starter raesea

    (@raesea)

    Thanks for the quick response. I’ve already placed some descriptive snippets in each of the templates I’m testing with and am certain that it is not using the default template. In fact, I just added the plugin to a fresh WP install, used a small set of data to get it set up and find that it is still misbehaving.

    No matter what the template I call from the pdb_single shortcode (ex – [pdb_single template=test]) it repeats the first instead of showing the second.

    Example Shortcode used on the Single Record page:

    [pdb_single template=test2]
    
    [pdb_single template=test1]

    In both templates a bit of text is added to the h2 tag to let us know what the template is called.

    Example of the HTML that those return:

    <div class="entry-content">
      <div class="wrap pdb-single ">
        <div class="section" id="pdb-main">
          <h2>Participant Info test two</h2>
          <dl class="pdb-first_name text-line ">
            <dt class="first_name ">First Name</dt>
            <dd class="first_name ">Eddie</dd>
          </dl>
          <dl class="pdb-last_name text-line ">
            <dt class="last_name ">Last Name</dt>
            <dd class="last_name ">Doboos</dd>
          </dl>
          <dl class="pdb-phone text-line ">
            <dt class="phone ">Phone</dt>
            <dd class="phone ">(458) 867-5309</dd>
          </dl>
        </div>
      </div>
      <div class="wrap pdb-single ">
        <div class="section" id="pdb-main">
          <h2>Participant Info test two</h2>
          <dl class="pdb-first_name text-line ">
            <dt class="first_name ">First Name</dt>
            <dd class="first_name ">Eddie</dd>
          </dl>
          <dl class="pdb-last_name text-line ">
            <dt class="last_name ">Last Name</dt>
            <dd class="last_name ">Doboos</dd>
          </dl>
          <dl class="pdb-phone text-line ">
            <dt class="phone ">Phone</dt>
            <dd class="phone ">(458) 867-5309</dd>
          </dl>
        </div>
      </div>
    </div>
    <!-- .entry-content -->

    Could it be a problem with WP 3.7.1 ?

    Plugin Author xnau webdesign

    (@xnau)

    It’s not likely to be a problem with the WP version, that is well tested by now. I have tried to duplicate your results and cannot. As far as I can see, this is working: if I have two shortcodes, each one using a different custom template, each one uses the template designated in the shortcode.

    That said, there is something you can try: using plugin version 1.4.9.3 goto the editor and open this file from the plugin: classes/PDb_Single.class.php

    On line 91, you’ll find:

    if ( ! isset( self::$instance ) ) self::$instance = new PDb_Single( $params );

    Change this to:

    self::$instance = new PDb_Single( $params );

    That may help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple pdb_single shortcode not working on one page’ is closed to new replies.