Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi Olaf,
    sorry at the moment the do_shortcode() will not work with our plugin because it should do some stuff during wp init, i.e. enqueue scripts and styles, process cookies etc, while to my knowledge the do_shortcode() function comes just too late for this.

    Thread Starter Olaf Lederer

    (@finalwebsites)

    Hi,

    right your port from shiftexec to WordPress is not like most other WP plugins ??

    I tried a custom shortcode because I need a page that shows only the shifts from a single user (using a dynamic user ID). I solved it by creating a short code with a dynamic link using your link structure:

    https://domain.com/mypage/?/wall/index/staff/3

    Do you have plans for localization? Would be cool to have the plugin in Dutch language too.

    Hello Olaf,
    by the way, did you want to display the shifts of the currently logged in user? If yes, then we have an undocumented ?? feature: you can supply the ‘_current_user_id_’ for the ‘staff’ shortcode parameter and it will translate it to the current user:

    [shiftcontroller staff="_current_user_id_"]

    Regarding localization, internally it’s already there but it it’s not in the WP way, you will need to translate a language file: create a new subfolder for your language here:
    shiftcontroller/application/language
    then copy the app_lang.php language file from the English subfolder, then translate it. Then you will need to edit this file:
    shiftcontroller/happ/application/config/config.php
    on line 137 change the language:
    $config['language'] = 'dutch';

    Please note that this changes will be overwritten by automatic updates so it’ll be required to keep a backup somehow. We also plan to add localization options that can be manages through the admin control panel.

    Thread Starter Olaf Lederer

    (@finalwebsites)

    by the way, did you want to display the shifts of the currently logged in user? If yes, then we have an undocumented ?? feature:

    Nice, but a bit too late ??

    Thanks for this information regarding the translations.

    aaron2310

    (@aaron2310)

    I’m having the same issue with my theme. Unfortunately shortcodes don’t work in it (and I can’t figure out why despite reading many pages on the issue) so I rely on do_shortcode.

    Would you fix work for me, Olaf? And how did you get it to display?

    Thanks ??

    Thread Starter Olaf Lederer

    (@finalwebsites)

    Hi Aaron, do you tried the shortcode suggested by the plugin author?

    aaron2310

    (@aaron2310)

    Hi Olaf,

    I’ve tried it. It just returns the shortcode as text where I post it. I’ve built a custom theme that just wont support shortcodes. So I’m wondering if there was an alternate way to display the rota since it doesn’t support do_shortcode?

    aaron2310

    (@aaron2310)

    Just to a little more specific, I was trying to put it into my template, not a page (it works in a page). Having found out a little more I understand shortcodes wont work directly in the template and do need the do_shortcode to work for that.

    Is there any workaround for this?

    Thread Starter Olaf Lederer

    (@finalwebsites)

    Hi,

    You can’t use a shiftcontroler shortcode in your theme.
    If I add this shortcode to a new page, I get the shifts for the current user:

    [shiftcontroller staff="_current_user_id_"]

    I’m sure you can use other shortcode attributes too.

    hitcode

    (@hitcode)

    Hello Aaron,
    sorry at the moment the do_shortcode() will not work with our plugin because it should do some stuff during wp init, i.e. enqueue scripts and styles, process cookies etc, while to my knowledge the do_shortcode() function comes just too late for this.

    aaron2310

    (@aaron2310)

    Hi guys,

    Thanks for the replies. I’ve realized I can’t put the output into my theme via Shortcode or the do_shortcode line.

    I was experimenting with using a text widget to do it instead. So I’ve added the filter to my Functions.php that allows this and then put the shortcode into the text widget.

    And it displays fine on the same page that I’m already using the shortcode within the content. On any other page it doesn’t.

    Is this related to the inability to do the do_shortcode?

    hitcode

    (@hitcode)

    Hello,
    yes currently our plugin will only work on the page with our shortcode – during the WP init we catch if the page has the shortcode, then we invoke some init code, enqueue scripts and styles, all this is required for the plugin to work, and it can be done only during WP init, the widgets and templates are coming too late for that.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Using shortcodes in template files’ is closed to new replies.