Viewing 15 replies - 1 through 15 (of 15 total)
  • Wow I literally just downloaded the plugin, started using it 2 days ago, and came here to ask the same exact question (AMAZING PLUGIN BTW- I was ready to ditch WP all together b/c I didn’t think WP could have awesome tables)

    I have an Excel sheet (.CSV) with a column with just the URLs ex: http://www.site.com. I also want to be able to make this a CLICKABLE link to open a new tab (target=”_blank”) with the same TEXT for every single one (“Click Here for more Info”).

    Thanks

    (sorry to hijack your thread, I just didn’t want to create a second one … I think we have the same exact question!)

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your questions.

    Unfortunately, this is not as easy as the existing extension, but it still can be achieved rather easily with some custom code. Just paste this into the themes “functions.php” (or better create a small custom extension as explained in the link above from it):

    add_filter( 'wp_table_reloaded_cell_content', 'wp_table_reloaded_add_custom_links', 10, 4 );
    function wp_table_reloaded_add_custom_links( $cell_content, $table_id, $row_idx, $col_idx ) {
    	if ( 123 != $table_id )
    		return $cell_content;
    
    	if ( 5 != $col_idx )
    		return $cell_content;
    
    	if ( 1 == $row_idx )
    		return $cell_content;
    
    	return '<a href="' . $cell_content . '" target="_blank">Click Here for more Info</a>';
    }

    I filled this with the requirements of kingman33 here. castortray, you will just need to change the link text to “My Link”, and maybe remove the target="_blank" part.
    Both of you must change the table ID (from 123) to the desired table ID, and the column number (the column that contains the URLs) from 5 to whatever it is in your tables.

    Regards,
    Tobias

    I used the custom extension method and it worked perfectly. Thanks Tobias!

    Mike

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Mike,

    awesome! Great to hear that. Thanks for the confirmation!

    Best wishes,
    Tobias

    Thread Starter castortray

    (@castortray)

    Hi Tobias,

    Can you please also add options to automatically sort imported table by colum B or C etc ?

    Many thanks

    Regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    this would be really hard to implement, especially as some kind of UI would be necessary. Also, you can already sort data on the “Edit” screen manually. If you need this for automatically imported tables (e.g. from the “CSV auto import” extension, it might be a better idea, to do the sorting in the program that created the CSV file, e.g. in Excel.

    Regards,
    Tobias

    Thread Starter castortray

    (@castortray)

    I know, but I really like automation process 🙂
    but don’t worry I’m just asking 🙂
    and thanks again for quick reaction

    regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    yeah, I understand 🙂 We all like automated processes, I guess 🙂 But sometimes, this is just too specific unfortunately.

    Best wishes,
    Tobias

    Thread Starter castortray

    (@castortray)

    Hi again,

    How to modify below function

    add_filter( 'wp_table_reloaded_cell_content', 'wp_table_reloaded_add_custom_links', 10, 4 );
    function wp_table_reloaded_add_custom_links( $cell_content, $table_id, $row_idx, $col_idx ) {
    	if ( 123 != $table_id )
    		return $cell_content;
    
    	if ( 5 != $col_idx )
    		return $cell_content;
    
    	if ( 1 == $row_idx )
    		return $cell_content;
    
    	return '<a href="' . $cell_content . '" target="_blank">Link</a>';
    }

    to change two columns for url clickable links ?
    I want to have 4 and 5 columns with “Link” name,

    can you help me, please ?
    I

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    just change

    if ( 5 != $col_idx )

    to

    if ( ! in_array( $col_idx, array( 4, 5 ) ) )

    Regards,
    Tobias

    Thread Starter castortray

    (@castortray)

    thanks for that !!

    this is the best support for plugin I ever seen

    Thread Starter castortray

    (@castortray)

    I noticed only one thing,
    this function replace also empty cells and create link to page where table is included.

    it is possible to change this function, to change only filled cells to clickable link and skip empty cells (leave it empty) ?

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    yes, this code will work on all cells, regardless of whether they contain a link or not.
    Extending this is not hard. Just add

    if ( empty( $cell_content ) )
    	return $cell_content;

    before the line at the end that begins with return ....

    Regards,
    Tobias

    Thread Starter castortray

    (@castortray)

    perfect !!

    I don’t really know how should I thank you 🙂

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    very cool! Great that this did it.

    If you want, you can take a look here to say “Thank you”, but the feeling to know that I could help is already nice as well 🙂

    Best wishes,
    Tobias

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘[Plugin: WP-Table Reloaded] URL to Link Conversion – with name/title’ is closed to new replies.