Support » Plugin: Gutenberg Blocks and Template Library by Otter » Scripts and styles not added when content called dynamicly

  • quasiDigi

    (@quasidigi)


    Hello,

    I’m using Otter Blocks with Neve theme.

    Your integration of Lottie animation is very neat! Thank you for that!

    I have an issue that when I call the content of a post in the front page it’s not loading the lottie script (nor the custom css of the content’s section and its content).

    I’ve several variation of the same code:

    $content_post = get_post($post_id);
    $content = $content_post->post_content;
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;

    and
    echo get_post_field('post_content', $post_id);
    and

    $content = apply_filters('the_content', get_post_field('post_content', $post_id));
    echo $content;

    and

    $post_content = get_post($post_id);
    $content = $post_content->post_content;
    echo do_shortcode( $content );

    and

    $content = get_post_field('post_content', $post_id);
    echo do_shortcode( $content );

    I could add the script manually through a footer hook, but I would like it to be future proof. What is the best way to do that?

    Thank you

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