• Resolved milosh96

    (@milosh96)


    Hello, I find this plugin amazing and what I’m trying to do is to render a web component either by using a shortcode or directly in custom HTML. The issue that I have is that I need to pass the post ID to the shortcode since using get_the_ID() there returns the ID of the current page, not the ID of the item from the loop.

    So in the current version this doesn’t work:

    add_shortcode( 'isf_story_component', function($attributes) {
    $image = wp_get_attachment_url(get_post_thumbnail_id($attributes["id"]));
    return '<isf-story image="'.$image.'"></isf-story>';
    } );


    So to achieve that I added this line in class-bpfwe-post-widget.php (line 9702).

    $html_content = str_replace( '#ID#', esc_html( get_the_ID() ), $html_content );

    So with that I can execute shortcode like this in the post custom HTML:

    <div>[isf_story_component id="#ID#"][/isf_story_component]</div>

    I hope the ID placeholder can be added in the next update. I think it’s a reasonable suggestion since with ID we can do so many things.

    • This topic was modified 2 weeks ago by milosh96.
    • This topic was modified 2 weeks ago by milosh96.
    • This topic was modified 2 weeks ago by milosh96.
    • This topic was modified 2 weeks ago by milosh96. Reason: adding example how i use this placeholder
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Dara

    (@dara4)

    Hi milosh96 (@milosh96),

    Thanks for the suggestion.

    Good news, I’ve added support for the #ID# placeholder in the next update.

    Starting from the upcoming release, you’ll be able to use it with the Custom HTML skin.

    The update will be available shortly.

    Regards,
    Dara

    Thread Starter milosh96

    (@milosh96)

    Thank you, that’s great news!

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

You must be logged in to reply to this topic.