• Resolved supernova42

    (@supernova42)


    I collect information with quite a lot of fields. Those fields are then displayed using the pdb-single shortcode. Several of the fields are empty. Is there a way of suppressing those empty fields from being displayed.

    Thanks

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

    (@xnau)

    Take a look at the HTML source, you will see a class name on empty fields that you can use to hide them.

    Thread Starter supernova42

    (@supernova42)

    Hi Roland

    I did think that you might have pulled something out of your hat to suppress the display of the empty fields.

    I have now supressed the fields using the following. This is just part of the code as I have many fields, but it gives an idea of how it can be done. However, it’s possible that there might be an easier way.

    $id= $_GET[‘pdb’];
    $data = Participants_Db::get_participant($id);
    $name = $data[‘name’];
    $price = $data[‘price’];
    $model = $data[‘model’];

    if (empty($name)) {echo ‘<style>dt.name{display:none}</style>’;}
    if (empty($price)) {echo ‘<style>dt.price{display:none}</style>’;}
    if (empty($model)) {echo ‘<style>dt.model{display:none}</style>’;}

    Many Thanks

    Thread Starter supernova42

    (@supernova42)

    Blast!!!

    I’ve just discovered

    .pdb-single .blank-field {
    display: none;
    }

    Worked great….

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Suppressing empty fields’ is closed to new replies.