• Resolved jscmal

    (@jscmal)


    Hi,
    I would know if there is a way to take the table from google spreadsheet and when the website gets the data they can be processed to show any cell string like a clickable link with a specific path.

    If a cell is a string like “APPLE”, how can I add it the < a > HTML tag and compose the URL like Path/Apple?

    I would show string APPLE that is a link clickable.
    This for any cell of the table.

    is there a way to do it?

    If there is a way, would you share a code example that I can analyze?

    Thank you for your support.

    Kind regards

    G. Aloe

    • This topic was modified 7 years, 7 months ago by jscmal.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Meitar

    (@meitar)

    I would know if there is a way to take the table from google spreadsheet and when the website gets the data they can be processed to show any cell string like a clickable link with a specific path.

    I think you’re asking about the gdoc_table_html filter? See the Other Notes section of this plugin’s readme.txt file, under the “Filters” heading.

    Thread Starter jscmal

    (@jscmal)

    Hi,
    I am sorry but I am not sure to have clear how to use it. But I understand that it can give me help.

    What I have read in the note seems to me not so easy to get what I am looking for.
    I have read that is possible to have shortcodes in the spreadsheet and make them executable in the website.

    But what I want is to get the table on the website and make the string in every cell clickable (adding a link).

    Example:

    I have this table:

    head 1 | head 2
    —————–
    APPLE | PIE |
    —————-

    What I want is that automatically the string inside any cell is used to compose an url. Like these: path/apple | path/pie

    AND

    The string in any cell has to become a link clickable. So In the table added on the page I would see:

    the APPLE string that is clickable
    the PIE string that is clickable too.

    This means that the string in any cell should get a tag html to become like this:

    <a href="path/apple" target=_blank">APPLE</a>

    I have not idea how to do it, by the [gdoc] shortcode or anyway by the data I get from the spreadsheet.

    May you open my mind to figure out this?

    I will appreciate anything to go forward in this problem. like an example of coding or details.

    Kind regards

    G. Aloe

    Plugin Author Meitar

    (@meitar)

    Like I said, you’re going to need to learn how to use WordPress filters. This is effectively custom programming. It’s certainly possible, because I’ve already implemented the gdoc_table_html filter hook you need to use. But I won’t write custom code for you and if you don’t understand what “using a WordPress filter hook” means, you should learn about that. There are many places to start doing so, such as the WordPress developer’s handbook.

    Thread Starter jscmal

    (@jscmal)

    in the spreadsheet, I keep a watch list that of financial instruments is daily updated. The table that at the is taken by the gdoc shortcode is the result of queries and filters.

    Every cell contains data like these: NZDUSD, AAPL, GOOG, TSLA, EURUSD, etc etc.

    I cannot add HTML tags in the spreadsheet for a watch list that is daily updated for several practical reasons: the daily updating would become a frustration and they could become a problem for queries and other things.

    I need that the string in any cell could be converted into a link when the table is already into the website.

    This is what I am trying to figure out.

    Thread Starter jscmal

    (@jscmal)

    Ok, I use hooks in my functions.php to apply filters. I am not really an expert about it. But I use it for my all needs with my functions and shortcodes.

    For now, in this moment, I am not sure how to use it with what the gdoc shortcode returns.

    So, I am completely uncertain about how to proceed. I need just that you put me in the right direction for this.

    So, knowing what is the “direction”, later I will be able to understand the things my myself. As I always do.

    Plugin Author Meitar

    (@meitar)

    add_filter( 'gdoc_table_html', 'my_filtering_function' );
    function my_filtering_function ( $html ) {
        // do something with $html
        return $html;
    }
    
    Thread Starter jscmal

    (@jscmal)

    Ok thanks. I will try to do something.

    I will let you know if I will have difficulties so as if I will make it work.

    Plugin Author Meitar

    (@meitar)

    I will let you know if I will have difficulties so as if I will make it work.

    No, please don’t. If you have trouble making this work, you should ask for help on a programming forum, not a plugin support forum. This plugin is working as it should, and therefore any problem with implementing this is in your own code, for which this forum is an inappropriate place to ask questions. Use any of the more general programming forums on the Internet or even elsewhere on www.remarpro.com.

    Thread Starter jscmal

    (@jscmal)

    Hi Meitar,
    I just inform you that It is done and it works very well.
    I did it using: preg_replace_callback.

    Thank you very much for your support.

    Kind regards

    G.Aloe

    Plugin Author Meitar

    (@meitar)

    Great. ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Convert a cells string in a link’ is closed to new replies.