• Resolved jtoney7852

    (@jtoney7852)


    I’m working on a task where I’m create a database. I’m using tablepress for the data which isn’t the problem.

    I’m using the code below to allow me to use a shortcode on each post so I can do some filtering. Problem is the filtering isn’t working.

    function dynamic_tablepress_by_slug_shortcode($atts) {
    $atts = shortcode_atts(
    array(
    'table_id' => '',
    'filter_column' => '0',
    ),
    $atts,
    'dynamic_table'
    );

    $slug = get_post_field('post_name', get_post());

    if (!$slug) {
    return '<p><strong>Error:</strong> Could not determine post slug.</p>';
    }

    $shortcode = '[table id="' . esc_attr($atts['table_id']) . '" filter="' . esc_attr($slug) . '" filter_columns="' . esc_attr($atts['filter_column']) . '" datatables_sort="false"]';

    return do_shortcode($shortcode);
    }
    add_shortcode('dynamic_table', 'dynamic_tablepress_by_slug_shortcode');

    However, I still get the entire unfiltered table. I’m using this shortcode in my post.

    [dynamic_table table_id="1" filter_column="0"]

    Any idea what may be the cause of the problem?

    I’ll crosspost on the fixing wordpress page

Viewing 1 replies (of 1 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi!

    Thanks for your post and sorry for the trouble!

    From what I can see, you are trying to use the “filter” and “filter_columns” Shortcode parameters. Note that these are part of the “Row Filtering” feature module, see https://tablepress.org/modules/row-filtering/, which is part of the TablePress premium license plans. So, you would either need to upgrade, or, if you have a premium license, make sure that the feature module is turned on on the “Modules” screen of TablePress.

    Regards,
    Tobias

Viewing 1 replies (of 1 total)

The topic ‘Problems filtering results on post (using tablepress and code snippet)’ is closed to new replies.