• Resolved akiikiwporg

    (@akiikiwporg)


    Hi,

    I’m building a MPG template page in Thrive Architect.

    Each page contains a customized shortcode, which inserts a Ninja Table and filters the table’s data differently depending on the individual page.

    I’ve put all the customized shortcodes into my source file (Google Sheets.) For example, “[ninja_tables id=”49236″ filter=’c_booksandauthors’ hide_default_filter=”yes”]

    The Ninja Tables shortcode works when I insert it directly into the MPG template (in Thrive Architect’s WordPress Content block.)

    However, when I try to pass the same Ninja Table Shortcode via MPG only text is shown – the shortcode isn’t fired.

    What’s the correct way to pass an actual shortcode from the source file into the MPG template, so the shortcode actually fires?

    -Tomas

    P.S. The template contains other MPG shortcodes that inserts regular text, so the connection is otherwise working.

    P.S. I should also mention, that I earlier tested to pass the Ninja Table shortcode via MPG to a template page built in the Gutenberg editor. That worked without a glitch, so it seems the problem is related to Thrive Architect in some way.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, @akiikiwporg

    I’m not sure, if the shortcodes will work properly, if you paste whole block using MPG.

    Try to do the next trick: move to the Google Sheets just ids of tables, but not [ninja] shortcodes, and use it like this:

    [ninja_tables id=”{{mpg_table_id}}” filter=”c_booksandauthors” hide_default_filter=”yes”]

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Hi, Oleksandr.

    I tried the suggested solution in multiple variants of Thrive Architect/Gutenberg and in different types of blocks, but nothing fired the shortcode.

    But, there might be a alternative solution.

    Ninja Tables can filter the table based on URL parameters instead.

    For example, a URL like this produces the desired results:

    http://www.flauntmydesign.com/author-website-design-services/?filter=c_booksandauthors

    I saved the slugs, for example, “author-website-design-services/?filter=c_booksandauthors”, in a Google Sheets column.

    MPG correctly imports the slugs to a shortcode called “mpg_url_slug_w_params”, which I use for generating the URL.

    However, MPG trims away both the “?” and “=” characters in the slug, resulting in incorrect URLs.

    I tried URL encoding the slug. For example, replacing “?” with “%3F”, but then MPG trims away the “%” characters.

    Can you think of any nifty workaround to generate correctly formatted URLs?

    Appreciate any help. 🙂

    -Tomas

    • This reply was modified 3 years, 1 month ago by akiikiwporg.
    • This reply was modified 3 years, 1 month ago by akiikiwporg.
    • This reply was modified 3 years, 1 month ago by akiikiwporg.
    Thread Starter akiikiwporg

    (@akiikiwporg)

    I have found a workaround for how to use MPG for customizing Ninja Table’s shortcode on a page by page basis.

    My MPG field {{mpg_cvht_tag}} contains the page-specific filter.

    I use a PHP snippet to insert {{mpg_cvht_tag}} into the Ninja Tables shortcut:

    <?php 
    $cvht_filter ="{{mpg_cvht_tag}}";
    echo do_shortcode('[ninja_tables id="49326" filter="'.$cvht_filter .'" limit="100" hide_default_filter="yes"]'); ?>

    I then insert the snippet into the MPG template.

    I use the WordPress plugin “PHP Everywhere” to insert the PHP snippet into a “WordPress Content” block in Thrive Architect.

    The above solution creates a page-specific Ninja Table shortcut, which filters the table data differently on each page.

    • This reply was modified 3 years, 1 month ago by akiikiwporg.

    Hi, @akiikiwporg
    Yes, the solution with “do_shortcode()” looks alive.
    I am glad that everything worked out for you and thank you so much for sharing your experience.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problems passing shortcodes via MPG to Thrive Architect’ is closed to new replies.