Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #439197

    Hello!

    I see the exact answer I need in a previous post: https://kriesi.at/support/topic/custom-shortcodes-in-accordion-title/#post-288598 but it doesn’t seem to work for me. I’ve changed the code block from line 199 with the addition of:

    $toggle_atts[‘title’] = do_shortcode($toggle_atts[‘title’]);

    but it still does not run the shortcode. I see some “private” messages in the thread that I can’t read. Did this code not solve the problem, or am I doing something wrong?

    #439256

    You can disregard this question. I believe I found another topic https://kriesi.at/support/topic/custom-tab-shortcode-to-allow-shortcodes-in-the-title-field/#post-428898 that mentions this is not possible. bummer!

    #439420

    I found a workaround for my specific situation if it is helpful to anyone else. The goal was to pull the title of a post into the accordion toggle title so I just added this code in the toggles.php file:

    if(is_numeric($toggle_atts['title']))
    			{
    				$toggle_atts['title'] = get_the_title( $toggle_atts['title'] );
    			}

    Then I use the post ID as the toggle title. Because shortcodes work fine in the content of the toggle, I pull that in using the plugin Posts in Page.

    #439621

    Hey @bill311!

    Sorry for the late answer, not sure if you got your issue fixed or not?

    Regards,
    Rikard

    #439714

    Hey Rikard!

    No worries. I was able to find the solution for what I was trying to accomplish by the code above. I am setting up page sections as editable areas from the front end for my users. They update specific posts for the various page sections via some customizations I did to the plugin WP User Frontend. I wanted to have accordions and icon lists as options and the last snag was pulling in the post title via PHP to the accordion or icon element title. That code did the trick.

    Now I am going to experiment to see if I can use a similar filter to not load an accordion in the title is something like “NOT USED” for example. So I can template the page with say 10 accordion items and they can “turn off” or hide one if they use that key word.

    #439967

    Pretty simple addition to not include an accordion!!
    I added an if statement around the output section in toggles.php. If the title of the post I am dynamically pulling in is “NOT IN USE” then it skips it. I can now template the page with 10 or however many placeholders in the accordion and then the user can edit as needed from the front end. Pretty cool.

    #440180

    Hey!

    Great, sounds like you’re having fun :)

    Please let us know if you should have any other questions or problems.

    Regards,
    Rikard

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.