Skip to content

Instantly share code, notes, and snippets.

<?php
function myFluentCrmTagIdBySlug($slug) {
$tag = \FluentCrm\App\Models\Tag::where('slug', $slug)->first();
if($tag) {
$tagId = $tag->id;
}
<?php
/**
* A Hack to generate mock WP Post objects from any arbitrary array
* A possible use case is to render a list of taxonomy terms using Oxygen Builder's repeater element,
* as the repeater allows only WP_Query as a source of data
*
* @author: Gagan S Goraya
* @link: https://gagangoraya.com
*
@alex-authlab
alex-authlab / ff-reset-user-pass.php
Created January 23, 2021 09:24
wp fluent form reset user pass
add_action('fluentform_before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 8) { // 23 is your form id. Change the 23 with your own login for ID
return;
}
$redirectUrl = home_url(); // You can change the redirect url after successful login
if (get_current_user_id()) { // user already registered
wp_send_json_success([
'result' => [
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active September 6, 2023 19:25
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
@yankiara
yankiara / customization-plugin.php
Last active July 12, 2022 06:26
Oxygen Builder dummy theme used to increase plugins compatibility
/**
* Oxy-Dummy activation (thank you Sridhar Katakam)
* Paste this code snippet in your Oxygen's customization plugin
* or copy the file to /wp-content/plugins/customization-plugin/
*/
remove_filter( 'template', 'ct_oxygen_template_name' );
remove_filter( 'template_directory', 'ct_disable_theme_load', 1, 1 );
remove_filter( 'stylesheet_directory', 'ct_disable_theme_load', 1, 1 );
@mgburns
mgburns / acf-field-registration-example.php
Created September 1, 2015 13:14
Example programmatic registration of Advanced Custom Fields fields
<?php
/**
* Example programmatic registration of Advanced Custom Fields fields
*
* @see http://www.advancedcustomfields.com/resources/register-fields-via-php/
*/
function register_custom_acf_fields() {
if ( function_exists( 'acf_add_local_field_group' ) ) {
@kylephillips
kylephillips / favorites-display.php
Last active October 14, 2022 19:33
Using the Favorites get_user_favorites() function to display favorited post data in a custom format
<?php
// Method 1: simple foreach loop
$favorites = get_user_favorites();
if ( isset($favorites) && !empty($favorites) ) :
foreach ( $favorites as $favorite ) :
// You'll have access to the post ID in this foreach loop, so you can use WP functions like get_the_title($favorite);
endforeach;
endif;