Skip to content

Instantly share code, notes, and snippets.

View prayas-sapkota's full-sized avatar

Prayas Sapkota prayas-sapkota

View GitHub Profile
@prayas-sapkota
prayas-sapkota / custom-wp-nav-menu-classes.php
Created December 8, 2023 17:15 — forked from davidwebca/custom-wp-nav-menu-classes.php
Allow adding custom classes to WordPress menu ul, li, a and at different depths. Perfect for TailwindCSS and AlpineJS usage.
<?php
/**
* WordPress filters to allow custom arguments to wp_nav_menu to,
* in turn, allow custom classes to every element of a menu.
*
* You can apply a class only to certain depth of your menu as well.
*
* The filters use the depth argument given by WordPress
* which is an index, thus starts with level 0 (zero).
*

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

@prayas-sapkota
prayas-sapkota / yoast_seo_opengraph_change_image_size.php
Created December 1, 2022 13:25 — forked from amboutwe/yoast_seo_opengraph_change_image_size.php
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail'
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/
*/
@prayas-sapkota
prayas-sapkota / bitbucket-pipelines.yml
Created March 9, 2018 14:27 — forked from mcnamee/bitbucket-pipelines.yml
Bitbucket Pipelines - Deploy via FTP to shared hosting
image: samueldebruyn/debian-git
pipelines:
custom: # Pipelines that are triggered manually
init: # -- First time init
- step:
script:
- apt-get update
- apt-get -qq install git-ftp
- git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://$FTP_HOST
@prayas-sapkota
prayas-sapkota / meta-tags.md
Created May 11, 2017 08:04 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@prayas-sapkota
prayas-sapkota / gist:26289b405b2003c6378ad6248d4674b8
Created March 13, 2017 11:00 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@prayas-sapkota
prayas-sapkota / gist:3f583038fde457474cbd
Created March 16, 2016 16:05 — forked from mikejolley/gist:11171530
Hide all/some shipping options when free shipping is available
/**
* woocommerce_package_rates is a 2.1+ hook
*/
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
/**
* Hide shipping rates when free shipping is available
*
* @param array $rates Array of rates found for the package
* @param array $package The package array/object being shipped
@prayas-sapkota
prayas-sapkota / functions.php
Created March 16, 2016 16:05 — forked from jameskoster/functions.php
WooCommerce - 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_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if ( $image ) {
echo '<img src="' . $image . '" alt="" />';
}
@prayas-sapkota
prayas-sapkota / gravity-forms-disable-autocomplete.php
Created March 16, 2016 15:59 — forked from ronalfy/gravity-forms-disable-autocomplete.php
Disable autocomplete on the front-end for Gravity Forms
<?php
add_filter( 'gform_form_tag', 'gform_form_tag_autocomplete', 11, 2 );
function gform_form_tag_autocomplete( $form_tag, $form ) {
if ( is_admin() ) return $form_tag;
if ( GFFormsModel::is_html5_enabled() ) {
$form_tag = str_replace( '>', ' autocomplete="off">', $form_tag );
}
return $form_tag;
}
add_filter( 'gform_field_content', 'gform_form_input_autocomplete', 11, 5 );
@prayas-sapkota
prayas-sapkota / gw-gravity-forms-value-exists-validation.php
Created March 11, 2016 03:51 — forked from spivurno/gw-gravity-forms-value-exists-validation.php
Gravity Wiz // Gravity Forms // Validate that a Value Exists
<?php
/**
* Gravity Wiz // Gravity Forms // Validate that a Value Exists
*
* Ensure that a value entered in Form A has been previously submitted on Form B. This is useful if you're generating a reference number of some sort
* on Form B and would like the user to enter it on Form A.
*
* @version 1.2
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+