skip to Main Content

i have problem with wptables extension in wordpress that i can not make dynamic url cell acording to wptables documentation in wp tables website.
i review this link " https://wpdatatables.com/documentation/column-features/url-link-columns/ "
but in this website just describe about making url link just in one cell but i wanna make all the cells of column in database
could some one help me?

2

Answers


  1. Chosen as BEST ANSWER

    i use,

    SELECT cols, CONCAT("http://URL/",COL_NAME,"||",COL_NAME) AS COL_NAME

    FROM tb_name


  2. According to the wpDataTables documentation, you can convert any column into a URL link column by setting the URL link attribute.

    • Go to the wpDataTables plugin in your WordPress dashboard.
    • Select the table you want to edit.
    • Navigate to the column settings for the column that you want to
      transform into link URLs.
    • Find the option called URL link and enable it.
    • You should see a field to enter a URL format. Here, you can use
      placeholders like {placeholder} which will dynamically insert the
      value of the cell. For example, if your URLs differ by an ID or a
      slug stored in each row, your URL template might look something like https://example.com/page/{column_id}.
    • Replace {column_id} with the actual placeholder that matches the
      column data.

    If you need to construct more complex URLs that involve multiple fields from the table, you might consider using Custom JavaScript. wpDataTables allows you to add Custom JS via the table settings

    For example:

    javascript $(document).ready(function(){ $('#your_table_id td.your_column_class').each(function(){ var url = 'https://example.com/page/' + $(this).text(); $(this).html('<a href="' + url + '">' + $(this).text() + '</a>'); }); });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search