Skip to content

Instantly share code, notes, and snippets.

@annuman97
annuman97 / external_scripts_fluent_community.php
Created September 5, 2025 11:17
When you need to add external scripts to the community portal frontend.
add_action('fluent_community/portal_head', function () {
wp_enqueue_script(
'my-ext-on-portal',
'https://cdn.example.com/sdk.min.js',
[],
null,
false
);
@annuman97
annuman97 / custom_ff_userCase.js
Last active August 29, 2025 09:34
Custom Fluent Form use case where if required checkboxes are not selected it will won't go to next step and show a validation error message.
(function () {
var FORM_ID = 47; //Your Form ID
function q(form, sel) { return form.querySelector(sel); }
function qa(form, sel) { return form.querySelectorAll(sel); }
function getErrorStack(form) {
return q(form, '#fluentform_' + FORM_ID + '_errors');
}
@annuman97
annuman97 / ninja_tables_rowspan.js
Created August 28, 2025 11:00
Ninja Tables: JS code for RowSpan. Add the code to the table's custom CSS section and add the class 'combine' to the column advanced setting where you want to add rowspan
/*!
* jQuery Rowspanizer Plugin (Modified) v0.2
* https://github.com/marcosesperon/jquery.rowspanizer.js
*
* Copyright 2011, 2015 Marcos Esperón
* Released under the MIT license
*
* https://github.com/jquery-boilerplate/boilerplate/
*/
;( function( $, window, document, undefined ) {
@annuman97
annuman97 / highlight_words_in_community_post.php
Last active August 13, 2025 09:48
Search and style the Words in the Community Post content
add_action('fluent_community/portal_head', function() {
?>
<style>
.highlighted-day {
background-color: yellow !important;
color: blue !important;
padding: 2px 4px;
border-radius: 3px;
font-weight: bold;
}
@annuman97
annuman97 / fluentCommunitySVGSupport.php
Created August 8, 2025 08:33
By default Wordpress doesn't allow SVG upload for security reason. But if someone wants to support SVG upload in community portal, first it needs to support to the WordPress and then use the fluent community hook
function allow_svg_uploads($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'allow_svg_uploads');
add_filter('fluent_community/support_attachment_types', function($types) {
$types[] = 'image/svg+xml';
return $types;
});
@annuman97
annuman97 / disablePoll.php
Created July 31, 2025 09:05
If someone wants to disable Fluent Community Poll Feature, Use the following code to the functions.php file
add_filter( 'fluent_community/portal_vars', function( $vars ) {
if ( isset( $vars['features'] ) ) {
$vars['features']['has_survey_poll'] = false;
}
return $vars;
}, 20 );
@annuman97
annuman97 / prevent_selecting_a_date_in_calendar.js
Created July 16, 2025 12:03
Use a dropdown field with the class name .evening that includes options like "Noon" and "Evening", and a date/time field with the class name .datee. This form script prevents users from booking appointments on Sundays or during the evening. It shows alerts and disables selections to enforce these scheduling restrictions.
$(document).ready(function () {
var timeDropdown = $('.evening');
var calendarInput = $(".datee");
var fp = flatpickr(calendarInput[0], {
enableTime: true,
dateFormat: "Y-m-d H:i",
minDate: "today",
time_24hr: true,
onChange: function(selectedDates, dateStr, instance) {
@annuman97
annuman97 / ff_country_field_fullValue_inDynamicSmartcode.js
Created July 9, 2025 15:13
In Fluent Forms, Country Field display the Short Value for Dynamic Smartcode in HTML field. Using this JS will replace the Short Value and shows the full country name
(function() {
// Wait for the page and all forms to load (especially if loaded via AJAX)
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
@annuman97
annuman97 / clickable_entirer_row.js
Created June 25, 2025 09:47
If a column contains URLs and users want to enable redirection to that link when clicking anywhere on the row,
function runAll(){
$('.footable tbody tr').click( function() {
}).hover( function() {
$(this).toggleClass('hover');
$(this).css('cursor', 'pointer');
});
$(document).on('click', '.footable tbody tr', function(e){
e.preventDefault();
var url = $(this).find('a').attr('href');
window.open(url, '_blank');
@annuman97
annuman97 / hide_left_sidebar_bottom_icons.php
Created June 20, 2025 05:30
Hide Left bottom icons in Fluent Community
add_action('init', function () {
if (current_user_can('manage_options')) {
remove_all_actions('fluent_community/after_portal_sidebar');
//add your own custom content there
add_action('fluent_community/after_portal_sidebar', function () {
echo '<div class="fcom_side_footer"></div>'; // empty footer
});
}