Title: Shortcode with reference to different column
Last modified: March 17, 2021

---

# Shortcode with reference to different column

 *  Resolved [AlexPR](https://wordpress.org/support/users/alexpr/)
 * (@alexpr)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/)
 * I am using a shortcode with a parameter that refers to a different column. The
   shortcode `[pl id='1212']` should return the permalink for the blog post with
   ID# = 1212. This works fine. However, when I want to refer to column G which 
   contains the blog ID (1212) by using `[pl id='G']` or `[pl id="G"]` or `[pl id
   =G]`I do get an empty string.
 * _Here is the source code of the [shortcode](https://www.datafeedr.com/create-your-own-wordpress-shortcode-for-permalinks/)_
 * **How would I need to refer to column G and use the shortcode correctly?**
    -  This topic was modified 5 years, 2 months ago by [AlexPR](https://wordpress.org/support/users/alexpr/).

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/#post-14197663)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * What do you mean with “column G” here? References can only be to single cells,
   but not to columns. Also, these references only work in TablePress formulas, 
   but can not be used in Shortcodes like that. For that, the TablePress Single 
   Cell Shortcode Extension from [https://tablepress.org/extensions/table-cell-shortcode/](https://tablepress.org/extensions/table-cell-shortcode/)
   can be used – however, that also can not directly be used inside another Shortcode,
   due to how the WordPress Shortcode system works.
    So, unfortunately, I can’t 
   really think of a solution for this here, sorry…
 * That said, from my experience, I don’t really think that the scenario that you
   describe as the motivation for your Shortcode really is that common. First, WordPress
   actually maintains internal redirects when posts/pages are moved (i.e. get a 
   new slug), so that you would be redirected automatically. And if the domain name
   changes, you could easily fix that using one of the available search/replace 
   plugins (or, you could even leave out the domain from the link and use relative
   URLs (starting with `/` to indicate that it’s relative to the document root).
 * Regards,
    Tobias
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/#post-14197671)
 * Hi again,
 * hold, this might actually work with a formula like
 *     ```
       =[pl id="{G2}"]
       ```
   
 * where G2 would be the cell that contains a purely numeric ID.
 * Regards,
    Tobias
 *  Thread Starter [AlexPR](https://wordpress.org/support/users/alexpr/)
 * (@alexpr)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/#post-14197929)
 * I see your point. Unfortunately I would need to refer to a whole column (similar
   to Excel). Could we use a `DataTables` function instead, e.g. the function [Columns.Render](https://datatables.net/reference/option/columns.render)?
    -  This reply was modified 5 years, 2 months ago by [AlexPR](https://wordpress.org/support/users/alexpr/).
    -  This reply was modified 5 years, 2 months ago by [AlexPR](https://wordpress.org/support/users/alexpr/).
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/#post-14200247)
 * Hi,
 * but how do you refer to a whole column? Or do you basically repeat this for every
   cell in the column?
 * I don’t think that the DataTables approach would help, as that would all run 
   in the browser, but you need the information on the server.
 * Regards,
    Tobias
 *  Thread Starter [AlexPR](https://wordpress.org/support/users/alexpr/)
 * (@alexpr)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/#post-14200882)
 * That makes perfectly sense.
    Thank you very much, Tobias.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/#post-14202139)
 * Hi,
 * sure, no problem!
 * Best wishes,
    Tobias

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

The topic ‘Shortcode with reference to different column’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-reference-to-different-column/#post-14202139)
 * Status: resolved