Skip to content

Instantly share code, notes, and snippets.

@fritz-gerneth
Last active August 29, 2015 14:02
Show Gist options
  • Save fritz-gerneth/bcf6233f7be61a7367b7 to your computer and use it in GitHub Desktop.
Save fritz-gerneth/bcf6233f7be61a7367b7 to your computer and use it in GitHub Desktop.
function funct_vcExtension_tabDeepLink_tabIDChanged()
{
jQuery('.funct_vcExt_deepLink_tabId').text(jQuery('.tab_id_field').val());
}
<?php
/**
* Plugin Name: funct Visual Composer Extensions
* Plugin URI: http://funct.co
* Version: 1.0
* Author: funct GmbH
* Author URI: http://funct.co
* Description: Stand-Alone Extensions and tweaks for Visual Composer not provided by other plugins
*
* Build: {{buildNumber}}
* Date: {{buildTimeStamp}}
* Revision: {{repository.revision.number}}
* Branch: {{repository.branch.name}}
*/
add_action('init', function () {
WpbakeryShortcodeParams::addField(
'vc_tab_deepLink',
'renderTabDeepLinkFormField',
plugins_url('/public/js/funct_vc-extensions.min.js', __FILE__)
);
WPBMap::addParam(
'vc_tab',
array(
"type" => "vc_tab_deepLink",
"holder" => "div",
"class" => "",
"heading" => "Direct Link to this tab",
"param_name" => "vc_tour_deepLink",
"value" => '',
"description" => 'Use this link to to directly link to this tab',
'dependency' => array(
'element' => 'tab_id',
'callback' => 'funct_vcExtension_tabDeepLink_tabIDChanged',
)
)
);
});
function renderTabDeepLinkFormField()
{
$permaLink = isset($_POST['post_id'])
? get_permalink($_POST['post_id'])
: false;
if (false === $permaLink) {
$permaLink = 'This page has no URL yet. It must be saved first.';
}
return '<div class="funct_vcExt_deepLink"><span class="funct_vcExt_deepLink_permaLink">' . $permaLink . '#</span><span class="funct_vcExt_deepLink_tabId"></span></div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment