Displaying Row data

{“errors”:{“http_request_failed”:[“cURL error 60: SSL certificate problem: certificate has expired”]},”error_data”:[]}

Displaying Data in HTML format

{“errors”:{“http_request_failed”:[“cURL error 60: SSL certificate problem: certificate has expired”]},”error_data”:[]}

Displaying Only required Data

{“errors”:{“http_request_failed”:[“cURL error 60: SSL certificate problem: certificate has expired”]},”error_data”:[]}

Link

{“errors”:{“http_request_failed”:[“cURL error 60: SSL certificate problem: certificate has expired”]},”error_data”:[]} {“errors”:{“http_request_failed”:[“cURL error 60: SSL certificate problem: certificate has expired”]},”error_data”:[]}

Displaying quotes Using PHP code

No quotes were found.

Code Used to create table above. The code is added on code Snippet as “Quotable Quotes Table”

function display_quotable_quotes() {
    // Fetch data from the wpgetapi endpoint
    $data = wpgetapi_endpoint('quotable', 'quotes', array('debug' => false));

    // Initialize output variable
    $output = '';

    // Check if we have the correct data
    if (isset($data['results']) && is_array($data['results'])) {
        // Start table HTML
        $output .= '<table class="table table-bordered">
                        <thead>
                            <tr>
                                <th scope="col">Author</th>
                                <th scope="col">Quote</th>
                                <th scope="col">Length</th>
                            </tr>
                        </thead>
                        <tbody>';

        // Loop through each item in the results array
        foreach ($data['results'] as $item) {
            $output .= '<tr>
                            <td>' . esc_html($item['author']) . '</td>
                            <td>' . esc_html($item['content']) . '</td>
                            <td>' . esc_html($item['length']) . '</td>
                        </tr>';
        }

        // End table HTML
        $output .= '</tbody></table>';
    } else {
        // If no data is found, display a message
        $output .= '<table class="table table-bordered">
                        <tr>
                            <td colspan="3">No quotes were found.</td>
                        </tr>
                    </table>';
    }

    // Return the output
    return $output;
}

// Register the shortcode
add_shortcode('quotable_quotes', 'display_quotable_quotes');

Display Images

Code Used to create Images. The code is added on code Snippet as “Pixabay Display”

// Function to enqueue the required scripts and styles
function enqueue_fotorama_assets() {
    // jQuery
    wp_enqueue_script('jquery');
    // Fotorama CSS
    wp_enqueue_style('fotorama-css', 'https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.css');
    // Fotorama JS
    wp_enqueue_script('fotorama-js', 'https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.js', array('jquery'), null, true);
}
add_action('wp_enqueue_scripts', 'enqueue_fotorama_assets');

// Function to display images from the Pixabay API
function display_pixabay_images() {
    // Fetch data from the wpgetapi endpoint
    $data = wpgetapi_endpoint('pixabay', 'api', array('debug' => false));

    // Initialize output variable
    $output = '';

    // Check if we have the correct data
    if (isset($data['hits']) && is_array($data['hits'])) {
        // Start fotorama div
        $output .= '<div class="fotorama" data-nav="thumbs">';

        // Loop through each image in the hits array
        foreach ($data['hits'] as $image) {
            $output .= '<img src="' . esc_url($image['webformatURL']) . '" />';
        }

        // End fotorama div
        $output .= '</div>';
    } else {
        // If no data is found, display a message
        $output .= '<p>No images were found.</p>';
    }

    // Return the output
    return $output;
}

// Register the shortcode
add_shortcode('pixabay_images', 'display_pixabay_images');

Display quotes

No quotes were found.

Inserting Data to Database Table and displaying form the Table

[stored_quotes]

WPForms Contact

Please enable JavaScript in your browser to complete this form.

Contact form 7

    Displaying Data

    Table 1

    Displaying Data in a Data table from Hubsport CMS API showing contact list.

    createdate email firstname hs_object_id lastmodifieddate lastname
    06/06/2024 08:42 AM user2@gmail.com user2 17.468.823.482 06/06/2024 08:43 AM
    06/06/2024 08:45 AM user1@gmail.com user1 17.468.825.314 06/06/2024 08:46 AM
    06/06/2024 10:40 AM nikunj+1@wpgetapi.com nikunj 17.491.356.859 06/06/2024 10:40 AM
    06/06/2024 10:13 AM nikunj@wpgetapi.com Nikunj 17.495.285.726 06/06/2024 10:13 AM
    07/06/2024 07:22 AM 17.686.675.393 07/06/2024 07:23 AM
    13/06/2024 08:06 AM test@gmail.com test 18.764.418.760 13/06/2024 08:06 AM
    Generated by wpDataTables

    Table 2

    Displaying Data in a Data table from Dad Jokes API showing it in a table.

    _id setup punchline type approved date NSFW shareableLink
    60dd36262a93da31b2b0c361 If I had a dollar for every time I saw an AudiBook ad…. I’d have enough money to buy the company and erase it dollar 1 1.618.108.661 https://dadjokes.io/joke/60dd36262a93da31b2b0c361
    Generated by wpDataTables

    ChatGPT

    Please enable JavaScript in your browser to complete this form.