最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Embed Kajabi into WP

programmeradmin2浏览0评论

I am trying to embed kajabi into a WP page, I am using WPBakery if this is necesarry. The Kajabi is an email capture form and I need it to in a specific part of a page. Can anyone help me with this? Thank you! This is the sample code of kajabi

<script src=.js></script>

I am trying to embed kajabi into a WP page, I am using WPBakery if this is necesarry. The Kajabi is an email capture form and I need it to in a specific part of a page. Can anyone help me with this? Thank you! This is the sample code of kajabi

<script src=https://mykajabiwebsite/forms/123456/embed.js></script>

Share Improve this question asked May 12, 2020 at 9:12 kwestionablekwestionable 991 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Welcome to WPSE. When asking a question it is recommended to include your research and what you've already tried in your question.

One option would be to turn the script into a shortcode with add_shortcode(). With a custom shortcode you can have any Kajabi form anywhere on your site as long as the shortcode takes the form ID as parameter. For example,

// add for example to child theme functions.php
add_shortcode( 'my_kajabi_form', 'kajabi_form_shortcode' );

function kajabi_form_shortcode( $atts ) {
  // assuming form ids are always integers
  if ( empty( $atts['id'] ) || ! is_numeric( $atts['id'] ) ) {
    return;
  }

  return sprintf(
    '<div class="kajabi-wrap">
      <script src="https://mykajabiwebsite/forms/%d/embed.js"></script>
    </div>',
    absint($atts['id'])
  );

}

Then use it in your post content with [my_kajabi_form id="123456"].

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论