• Is it possible to get raw data from the database THEN wrap it in an element and class/ID which we choose? This allows for targeted styling.

    When I use the shortcode within a page, it wraps the data and I can’t apply my own styling directly to it.

    Also, when I’ve tried to dive into the code to get the raw output however it seems difficult to pull out the raw data and manipulate it.

    Any advice on how to adapt a shortcode or to isolate raw data within the code?

    Thank you

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

    (@xnau)

    This is done using custom templates, take a look at this article:


    Using Participants Database Custom Templates

    Thread Starter clickingclients

    (@clickingclients)

    Thanks again. I’ll leave this here for others to learn from also.
    I added the following to my child theme functions.php

    // Flexible wrapping and styling of PDB value
    add_shortcode('wrapped_value', 'cc_wrapped_value' );
    function cc_wrapped_value( $atts ) {
       vTag = sanitize_text_field( $atts['tag'] );
       vClass = sanitize_text_field( $atts['class'] );
       vId = sanitize_text_field( $atts['el_id'] );
    
       $html = '<' . vTag . ' class="' . vClass . '" id="' . vId .'">';
       $html .= do_shortcode( '[pdb_single record_id=' . $atts['record_id'] . ' fields=' . $atts['fields'] . ' template=bare-value ]' );
       $html .= '</' . vTag . '>';
       
       return $html;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Raw data from shortcodes’ is closed to new replies.