Skip to content

Instantly share code, notes, and snippets.

@fysalyaqoob
fysalyaqoob / functions.php
Last active February 23, 2023 19:13
WooCommerce Shortcode to show products that are dynamically selected based on sales velocity and total sales
function fy_product_loop_shortcode( $atts ) {
$atts = shortcode_atts( array(
'limit' => 12,
), $atts );
$args = array(
'status' => 'publish',
'limit' => -1,
);
@fysalyaqoob
fysalyaqoob / functions.php
Created April 29, 2022 21:00 — forked from pingram3541/functions.php
Add Elementor Widget Control to Remove Schema from Star Rating Widget
/**
* add toggle control to star rating widget for schema
**/
add_action( 'elementor/element/star-rating/section_rating/before_section_end', function( $element, $args ) {
$element->add_control(
'use_schema',
[
'type' => \Elementor\Controls_Manager::SWITCHER,
'label' => __( 'Use Schema', 'elementor' ),
'label_on' => __( 'Enable', 'elementor' ),
@fysalyaqoob
fysalyaqoob / custom-post-taxonomy-permalinks.php
Created May 2, 2019 23:46 — forked from kasparsd/custom-post-taxonomy-permalinks.php
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
@fysalyaqoob
fysalyaqoob / wp_auto_thumbnail_functions.php
Created November 16, 2018 20:47 — forked from sosukeinu/wp_auto_thumbnail_functions.php
WP function auto featured image
<?php
/*
* This function will get the first image in this order:
*
* 1) Featured image
* 2) First image attached to post
* 3) First image URL in the content of the post
* 4) YouTube screenshot
* 5) Default images for different categories [SET MANUALLY]
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>