Skip to content

Instantly share code, notes, and snippets.

View AchalJ's full-sized avatar

Achal Jain AchalJ

View GitHub Profile
@AchalJ
AchalJ / code.php
Created September 24, 2024 07:45
Add custom tabs to PowerPack Advanced Tabs module using PHP
<?php // <-- ignore this.
/** Copy the code below. */
add_filter('pp_tabs_items', 'custom_tab_items', 10, 2);
function custom_tab_items( $items, $settings ) {
// Add custom tabs.
$new_items = array(
array(
'label' => 'My custom tab 1', // Tab label (required)
@AchalJ
AchalJ / code.php
Last active August 22, 2024 16:35
PowerPack Advanced Accordion - Get items from ACF Repeater on the current taxonomy page
<?php // <-- ignore this line.
// If you've ACF repeater field setup for the taxonomy then
// Add this code to your current theme's functions.php file.
add_filter( 'pp_accordion_acf_post_id', function( $post_id, $settings ) {
if ( is_tax() ) {
$post_id = get_queried_object();
}
return $post_id;
}, 10, 2 );
@AchalJ
AchalJ / code.php
Created May 4, 2024 14:07
Vagonic Sortable compatibility with Content Grid AJAX pagination
<?php // <- ignore this line.
// Add Vagonic sort compatibility with Content Grid AJAX pagination.
add_action( 'woocommerce_product_query', function( $query, $wc_query ) {
if ( ! is_admin() && $query->is_main_query() && is_array( $_POST ) && isset( $_POST['current_tax'], $_POST['current_term'] ) ) {
$term = get_term_by( 'slug', wp_unslash( $_POST['current_term'] ), wp_unslash( $_POST['current_tax'] ) );
if ( $term && ! is_wp_error( $term ) ) {
$term_id = $term->term_id;
if ( $term->taxonomy == 'product_tag' ) {
$meta_key = '_vgnc_tag_menu_order_' . $term_id;
@AchalJ
AchalJ / layou.html
Created February 20, 2024 18:01
PowerPack Content Grid - Replicate Style 8 with custom layout (Beaver Themer)
<div class="pp-content-grid-post-body">
[wpbb-if post:featured_image]
<div class="pp-content-grid-post-image">
[wpbb post:featured_image size="large" display="tag" linked="yes"]
</div>
[/wpbb-if]
<div class="pp-content-grid-post-text">
<h3 class="pp-content-grid-post-title">[wpbb post:link text="title"]</h3>
@AchalJ
AchalJ / code.php
Last active August 7, 2023 07:29
PowerPack Content Grid - Group post terms by taxonomies in meta
<?php // ignore this.
// Instructions:
// 1. Add the following CSS class to the Content Grid module: cg-with-meta-tags
// 2. Add the below code to your current theme's functions.php file.
add_action( 'pp_cg_before_post_content', function( $post_id, $settings ) {
if ( false === strpos( $settings->class, 'cg-with-meta-tags' ) ) {
return;
}
@AchalJ
AchalJ / code.js
Created June 8, 2023 11:03
PowerPack Google Map - Show Info Window on Hover Over Marker
// 1. Add the following CSS class to the PowerPack's Google Map module under the Advanced settings > HTML Element > Class: show-info-on-hover
// 2. Add this JavaScript code to Beaver Builder's Global JavaScript editor or in a JS file in your current child theme.
;(function($) {
var showInfoOnHover = function() {
var mapModules = $('.show-info-on-hover');
if ( mapModules.length === 0 ) {
return;
}
mapModules.each(function() {
@AchalJ
AchalJ / layout.css
Last active May 23, 2023 10:59
Content Grid - Custom Layout - 1 (Beaver Themer)
.pp-content-grid-post {
font-size: 14px;
background-color: #fff !important;
}
.pp-content-grid-post-image {
padding: 0;
position: relative;
}
.pp-content-grid-post-image a img {
filter: saturate(1.6) contrast(1.1);
@AchalJ
AchalJ / layout.css
Created March 29, 2023 07:42
PowerPack Content Grid - Replicate Style 9 with Custom Layout (Beaver Themer)
.pp-content-grid-post-tile {
position: relative;
height: 275px;
}
.pp-content-grid-post-image {
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
height: 100%;
position: relative;
@AchalJ
AchalJ / layout.css
Created March 14, 2023 07:48
PowerPack Content Grid - Replicate Style 5 with Custom Layout (Beaver Themer)
.pp-content-grid-post {
font-size: 14px;
}
.pp-content-grid-post-image {
padding: 0px;
padding-bottom: 0;
height: 260px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
@AchalJ
AchalJ / code.php
Last active December 21, 2022 08:26
Posts matching filters fix for Beaver Builder Posts Grid + Content Grid
<?php // <- Ignore this
// Copy the code below and paste it to your child theme's functions.php file
add_filter( 'fl_builder_loop_query_args', function( $args ) {
$settings = $args['settings'];
$post_type = $args['post_type'];
$post__in = $post__not_in = array();