Skip to content

Instantly share code, notes, and snippets.

View skjaved's full-sized avatar
👨‍💻
</>

Javed Shaikh skjaved

👨‍💻
</>
View GitHub Profile
@skjaved
skjaved / wp-query-ref.php
Created January 28, 2021 04:38 — forked from luetkemj/wp-query-ref.php
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@skjaved
skjaved / wc-display-category-image-archive.php
Last active December 31, 2020 18:21 — forked from woogists/wc-display-category-image-archive.php
[Theming] Display category image on category archive
/**
* Display category image on category archive
*/
add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 );
function woocommerce_category_image() {
if ( is_product_category() ){
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
@skjaved
skjaved / change.js
Created October 16, 2020 09:28 — forked from DmitriyRF/change.js
Remove or don't redirect “thank you” page Mailchimp
/* To use this example:
1. Download this html file
2. Replace the form action url with your own from the MailChimp supplied embed code
3. Within the action url, replace "subscribe/post" with "subscribe/post-json"
4. Be sure the action url starts with http://. If it doesn't, the form will hang when testing the html as a local file in your browser.
5. Open this file in a browser on your local machine
*/
@skjaved
skjaved / echo-enqueued-styles-scripts-wordpress.php
Last active December 31, 2020 18:23 — forked from omurphy27/echo-enqueued-styles-scripts-wordpress.php
Wordpress - Print Out All Enqueued Scripts And Styles On A Page
<?php
// add the below to your functions file
// then visit the page that you want to see
// the enqueued scripts and stylesheets for
function se_inspect_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2><ul>";
foreach( $wp_styles->queue as $handle ) :
echo "<li>" . $handle . "</li>";
@skjaved
skjaved / adding-css-to-wordpress-theme.php
Created May 9, 2020 06:49 — forked from zgordon/adding-css-to-wordpress-theme.php
A simple example of Adding CSS to WordPress Theme Via functions.php File
// Load the theme stylesheets
function theme_styles()
{
// Example of loading a jQuery slideshow plugin just on the homepage
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );
// Load all of the styles that need to appear on all pages
wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );
@skjaved
skjaved / form.html
Created April 23, 2020 13:12 — forked from escopecz/form.html
An example of how to send a form submission to a Mautic form with jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mautic Form Test</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
@skjaved
skjaved / storefront-logo-size-adjust-example.css
Created February 24, 2020 11:51 — forked from jameskoster/storefront-logo-size-adjust-example.css
Adjust the dimensions of the header logo in the Storefront theme.
@media screen and (min-width: 768px) {
.site-header .site-branding, .site-header .site-logo-anchor, .site-header .site-logo-link, .site-header .custom-logo-link {
width: 21%; /* Adjust this percentage up or down to make the logo larger or smaller. */
}
}
@skjaved
skjaved / WP Customizer - Color Control.php
Last active December 31, 2020 18:19 — forked from ajskelton/WP Customizer - Color Control
Add a Color Control field to the WordPress Customizer.
$wp_customize->add_setting( 'core_color_setting_id', array(
'sanitize_callback' => 'themeslug_sanitize_hex_color',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control( $wp_customize, 'core_color_setting_id',
array(
'label' => __( 'Core Color Setting' ),
'description' => __( 'Select a color for something' ),
'section' => 'custom_section', // Add a default or your own section
@skjaved
skjaved / gist:facc2952aead86d314ec78f8d07a3d16
Created January 21, 2020 05:32 — forked from yagopv/gist:8470185
Wordpress Snippets

###Custom Post Types

Docs

function codex_custom_init() {
  $labels = array(
    'name'               => 'Books',
    'singular_name'      => 'Book',
    'add_new'            => 'Add New',
@skjaved
skjaved / reset.css
Created November 30, 2019 07:05 — forked from DavidWells/reset.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,