Skip to content

Instantly share code, notes, and snippets.

@jmabbas
jmabbas / functions.php
Created July 19, 2024 18:12
Electro arcade custom codes
<?php
/**
* Recommended way to include parent theme styles.
* (Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
*
*/
add_action( 'wp_enqueue_scripts', 'electro_child_style' );
function electro_child_style() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
@jmabbas
jmabbas / gist:9a4801435f9c33aa3340a283e166bccf
Created July 15, 2024 06:45
Bookworm- Header v7 Search
function bookworm_site_search_v7() {
if ( apply_filters('bookworm_enable_site_search' , true )):
?>
<div class="site-search ml-xl-0 ml-md-auto w-r-100 flex-grow-1 mr-md-5 py-2 py-md-0">
<?php if ( bookworm_is_woocommerce_activated() ) : ?>
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" class="form-inline my-2 my-xl-0">
<div class="input-group w-100">
<div class="input-group-prepend z-index-2 d-none d-xl-block">
<?php $selected_cat = isset( $_GET['product_cat'] ) ? $_GET['product_cat'] : 0;
$navbar_search_dropdown_text = apply_filters( 'bookworm_navbar_search_category_dropdown_default_text', esc_html__( 'All Categories', 'bookworm' ) );
@jmabbas
jmabbas / header-v3.php
Created July 15, 2024 05:23
Electro - Sticky Header v3 with Topbar
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package electro
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
@jmabbas
jmabbas / functions.php
Created July 13, 2024 18:20
Electro - Arcade specification tab
add_filter( 'woocommerce_product_tabs', 'woo_custom_product_tabs' );
function woo_custom_product_tabs( $tabs ) {
// phpinfo();die;
$product_id = get_the_id();
$technical_specifications = get_field( "technical_specification",$product_id );
$console_x_technical_specifications = get_field('console_x_technical_specifications',$product_id );
$lego_technical_specifications = get_field('lego_technical_specifications',$product_id );
@jmabbas
jmabbas / functions.php
Created July 9, 2024 12:22
Tokoo - Single post tags
function tokoo_post_meta() {
?>
<aside class="entry-meta">
<div class="vcard author">
<?php
echo '<div class="label">' . esc_html__( 'Posted by', 'tokoo' ) . '</div>';
echo sprintf( '<a href="%1$s" class="url fn" rel="author">%2$s</a>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() );
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'tokoo' ) );
if ( $tags_list ) :
@jmabbas
jmabbas / functions.php
Last active July 15, 2024 17:47
Electro - Iconic discount
function ec_child_iconic_discount() { ?>
<script>
const actualPriceText = document.querySelector('.iconic-wsb-product-bumps__total-price-amount del').innerText;
const discountPriceText = document.querySelector('.iconic-wsb-product-bumps__total-price-amount ins').innerText;
const actualPrice1 = parseFloat(actualPriceText.replace('$', ''));
const discountPrice1 = parseFloat(discountPriceText.replace('$', ''));
const discountValue1 = actualPrice1 - discountPrice1;
@jmabbas
jmabbas / functions.php
Created July 4, 2024 06:14
Electro - Mobile header my account to custom link
function electro_handheld_header_links() {
$links = array(
'search' => array(
'priority' => 10,
'callback' => 'electro_handheld_header_search_link',
),
'cart' => array(
'priority' => 30,
@jmabbas
jmabbas / style.css
Created June 28, 2024 11:52
Bookworm - Shop page Recommended Books move to bottom
body.archive .site-main {
display: flex;
flex-direction: column;
}
body.archive .site-main > .position-relative.mb-6 {
order:1;
}
@jmabbas
jmabbas / functions.php
Created June 27, 2024 11:24
Vodi - Hide tab tittle there is no movies
function vc_child_hide_person_tabs_there_is_no_content() { ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
function hasRequiredContent(tabPane, requiredClass) {
return tabPane.querySelector('.' + requiredClass) !== null;
}
const tabPanes = document.querySelectorAll('.tab-content > .tab-pane');
const navItems = document.querySelectorAll('.nav > .nav-item');
@jmabbas
jmabbas / functions.php
Created June 26, 2024 09:48
MAS video - Person know credits count update
function masvideos_template_single_person_credits() {
global $person;
$movie_cast = $person->get_movie_cast() ? $person->get_movie_cast() : array();
$movie_crew = $person->get_movie_crew() ? $person->get_movie_crew() : array();
$tv_show_cast = $person->get_tv_show_cast() ? $person->get_tv_show_cast() : array();
$tv_show_crew = $person->get_tv_show_crew() ? $person->get_tv_show_crew() : array();
$credits = array_unique( array_merge ( $movie_cast, $movie_crew, $tv_show_cast, $tv_show_crew ) );