Skip to content

Instantly share code, notes, and snippets.

View softiconic's full-sized avatar

Softiconic softiconic

View GitHub Profile
@softiconic
softiconic / index.html
Created April 27, 2024 16:54
Swiper Slider with right offside
<!-- Swiper -->
<div class="sc_scroll_sclide">
<div class="swiper sc_slider_02">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="assets/images/big-3.jpg" alt="">
<div class="image_sc_slide">
<h3>title here</h3>
</div>
</div>
@softiconic
softiconic / gist:20383b0a4af900cda4d2c9f82854e387
Created April 14, 2024 08:59
Custom redirect to a thank you page after a customer creates an account on Shopify
Navigate to your Shopify Admin dashboard.
Go to Online Store > Themes.
Click on Actions > Edit code for the theme you are currently using.
In the Sections folder, locate or create a file named register.liquid.
Add the following code to the register.liquid file:
@softiconic
softiconic / index.html
Created March 22, 2024 14:22
To create a jQuery function that triggers a state change event when a city is selected from a dropdown menu.
<select id="stateSelect">
<option value="">Select State</option>
<option value="California">California</option>
<option value="New York">New York</option>
<!-- Add more states as needed -->
</select>
<select id="citySelect">
<option value="">Select City</option>
<!-- Add cities for each state -->
@softiconic
softiconic / function.php
Last active May 14, 2024 16:15
Adjust the positioning offset of the Elementor anchor element/links
add_action( 'wp_footer', function() {
if ( ! defined( 'ELEMENTOR_VERSION' ) ) {
return;
}
?>
<script>
jQuery( function( $ ) {
// Add space for Elementor Menu Anchor link
$( window ).on( 'elementor/frontend/init', function() {
elementorFrontend.hooks.addFilter( 'frontend/handlers/menu_anchor/scroll_top_distance', function( scrollTop ) {
@softiconic
softiconic / index.html
Last active December 3, 2023 02:57
Create a horizontal accordion with custom design.
<div class="sc_hr_accord">
<ul class="sc_list_hr">
<li id="step_sc_01" class="schide scshow">
<div class="sc_tab_title">
<h4>tab 1</h4>
<svg xmlns="http://www.w3.org/2000/svg" width="12.323" height="21.553" viewBox="0 0 12.323 21.553">
<path id="Icon_ionic-ios-arrow-forward" data-name="Icon ionic-ios-arrow-forward" d="M19.855,16.969,11.7,8.819a1.534,1.534,0,0,1,0-2.175,1.553,1.553,0,0,1,2.182,0l9.24,9.234A1.537,1.537,0,0,1,23.166,18l-9.279,9.3a1.54,1.54,0,1,1-2.182-2.175Z" transform="translate(-11.246 -6.196)" fill="#403e38"/>
</svg>
</div>
<div class="sc_tab_body">
@softiconic
softiconic / gist:fd7f0866a974b02d3b983d423c802888
Last active December 3, 2023 02:57
Design a unique preloader
<!-- Preloader HTML -->
<div id="preloader">
<!-- Add your preloader content here -->
<p>Loading...</p>
</div>
<!-- Your website content goes here -->
/* Add your preloader styles here */
#preloader {
position: fixed;
@softiconic
softiconic / gist:e67bd602f90466fe47c310e16b427446
Last active December 2, 2023 18:33
WooCommerce single product - navigate to the next or previous product.
//add_action( 'woocommerce_before_single_product', 'add_custom_text_before_product_title' );
add_shortcode( 'scnextprev', 'productnextprev_shortcode' );
function productnextprev_shortcode(){
echo '<div class="prev_next_buttons">';
// 'product_cat' will make sure to return next/prev from current category
$previous = next_post_link('%link', '&larr; %title', TRUE, ' ', 'product_cat');
$next = previous_post_link('%link', '%title &rarr;', TRUE, ' ', 'product_cat');
@softiconic
softiconic / functions.php
Last active December 2, 2023 18:33
Restrict access to the media library in WordPress.
// Limit media library access
add_filter( 'ajax_query_attachments_args', 'wpb_show_current_user_attachments' );
function wpb_show_current_user_attachments( $query ) {
$user_id = get_current_user_id();
if ( $user_id && !current_user_can('activate_plugins') && !current_user_can('edit_others_posts
') ) {
$query['author'] = $user_id;
}
@softiconic
softiconic / gist:d2b2a154ac68884e37ffd9966a54d1c3
Last active December 2, 2023 18:33
Create a custom post navigation in WordPress
<?php
add_shortcode( 'fs_prev_next_thumbs', 'generate_faq_landing_link_shortcode' );
function generate_faq_landing_link_shortcode( $atts, $content ) {
global $post; // if outside the loop
$prev_next = '';
$prev_post = get_previous_post();
$next_post = get_next_post();
@softiconic
softiconic / custom.js
Last active December 2, 2023 18:34
Add or remove a class in a section-based loop for multiple items.
$(document).ready(function() {
$('.scshow').click(function() {
var parentDiv = $(this).closest('.scteto');
if (parentDiv.hasClass('highlighted')) {
parentDiv.removeClass('highlighted');
} else {
parentDiv.addClass('highlighted');
}
});