0

I have no knowledge of PHP but I have already been hit so far that I want to put the last bit myself. As you can see below, I retrieve data from the database. Below is the part that it is about.

    <div class="gp-hub-block gp-hub-block-three">

        <?php if ( ghostpool_option( 'hub_fields' ) ) {

            // Support for foreign characters   
            $char_table = array();
            if ( function_exists( 'ghostpool_hub_field_characters' ) ) {
                $char_table = ghostpool_hub_field_characters();
            }   

            foreach( ghostpool_option( 'hub_fields' ) as $gp_hub_field ) {

                $gp_hub_field_slug = strtr( $gp_hub_field, $char_table );
                if ( function_exists( 'iconv' ) ) {
                    $gp_hub_field_slug = iconv( 'UTF-8', 'UTF-8//TRANSLIT//IGNORE', $gp_hub_field_slug );
                }

                $gp_hub_field_slug = sanitize_title( $gp_hub_field_slug );
                $gp_hub_field_slug = substr( $gp_hub_field_slug, 0, 32 );
                $gp_term_list = get_the_term_list( $post_id, $gp_hub_field_slug, '<table class="casino-info"><tbody><span class="aaa"><tr class="casino-info-titel"><th scope="row">' . __($gp_hub_field,'JDcustomnew') . ':</th><td scope="row" data-label="'<?php echo ($gp_hub_field ); ?>'">', ', ', '</td></tbody></table>' );
                if ( ! $gp_term_list OR is_wp_error( $gp_term_list ) ) {
                    continue;
                }   
                if ( ghostpool_option( 'hub_field_links' ) == 'disabled' ) {
                    $gp_term_list = preg_replace( '/<\/?a[^>]*>/', '', $gp_term_list );
                }
                echo wp_kses_post( $gp_term_list );

            }

        } ?>

    </div>  

</div>

You will see below for which part it is exactly

$gp_term_list = get_the_term_list( $post_id, $gp_hub_field_slug, '<table class="casino-info"><tbody><span class="aaa"><tr class="casino-info-titel"><th scope="row">' . __($gp_hub_field,'JDcustomnew') . ':</th><td scope="row" data-label="'<?php echo ($gp_hub_field ); ?>'">', ', ', '</td></tbody></table>' );

What I want to do is return the $gp_hub_field to the datalabel of my table. Unfortunately, I can not do this. Someone who can help me?

Don't blame me for my PHP skills please.

EDIT:

I see this with the PHP code in the data-label: enter image description here

Its important for Google that the data label has the same title as the <TH> I need to see this with the good data-lable title:

enter image description here

Dennis Strooband
  • 121
  • 1
  • 1
  • 6
  • `echo ($gp_hub_field );` will output the vaiable to the HTML browser. See your `data-label` attribute for an example of this . – Martin Feb 23 '19 at 10:00
  • 1
    You have PHP code tags in your PHP code, this is not needed. See [Mixing PHP variable with string literal](https://stackoverflow.com/q/5368890/5914775) for more information on how to mix variables in strings. You did it correctly with the `__($gp_hub_field,'JDcustomnew')` function call, so you can use the same technique. – Tom Udding Feb 23 '19 at 10:01
  • What have you tried so far? What **exactly** is not working yet with the given code? – Nico Haase Feb 23 '19 at 10:05
  • I have added screenshot in my post so u can see what I see. – Dennis Strooband Feb 23 '19 at 10:19
  • @TomUdding Ok thanks! It works :) – Dennis Strooband Feb 23 '19 at 12:43

0 Answers0