Skip to content

Instantly share code, notes, and snippets.

@stalukder03
stalukder03 / custom-domain-localhost-xampp
Created June 6, 2018 07:09 — forked from oozman/custom-domain-localhost-xampp
How to add a custom domain name on your localhost using XAMPP. Codes are based on Windows, but Step 2 onwards are pretty much applicable on other operating system.
Step 1:
Go to: C:\Windows\System32\Drivers\etc\hosts
And add this to the bottom of the file:
=============
127.0.0.1 your.domain.com
=============
Step 2:
Go to [your XAMPP directory]/apache/conf/httpd-xampp.conf
@stalukder03
stalukder03 / awesome-support-custom-fields.php
Created June 7, 2018 09:33 — forked from julien731/awesome-support-custom-fields.php
Awesome Support Custom Fields Starter Kit
<?php
/**
* @package Awesome Support/Custom Fields
* @author ThemeAvenue <[email protected]>
* @license GPL-2.0+
* @link http://themeavenue.net
* @copyright 2014 ThemeAvenue
*
* @wordpress-plugin
* Plugin Name: Awesome Support: My Custom Fields
@stalukder03
stalukder03 / functions.php
Created June 11, 2018 11:34 — forked from jaredatch/functions.php
WordPress Search Autocomplete using WP REST API v2
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@stalukder03
stalukder03 / functions.php
Created June 11, 2018 11:34 — forked from jaredatch/functions.php
WordPress Search Autocomplete using admin-ajax.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@stalukder03
stalukder03 / custom_excerpt_wp.php
Created June 11, 2018 16:03 — forked from sammdec/custom_excerpt_wp.php
Wordpress Custom Excerpt function
<?php
function get_excerpt($count, $post_id){
$permalink = get_permalink($post_id);
$excerpt = get_post($post_id);
$excerpt = $excerpt->post_content;
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $count);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = $excerpt;
// Want a read more link and ellipsis, remove the line above this and replace it with the one below.
@stalukder03
stalukder03 / wp-get-image-alt-text.php
Created July 4, 2018 18:24 — forked from patrickgilmour/wp-get-image-alt-text.php
WordPress Images - echo the Alt text of the Featured image (and other image attributes)
<?php
/**
* Get the Alt text of a Featured Image
*
* And other image attributes
*/
add_action('genesis_before_sidebar_widget_area', 'pgwp_genesis_before_sidebar_widget_area' );
function pgwp_genesis_before_sidebar_widget_area () {
@stalukder03
stalukder03 / wp-updates-theme.php
Created August 9, 2018 22:25 — forked from gilbitron/wp-updates-theme.php
WPUpdates Theme Updater Class (with Envato API verification)
<?php
/*
WPUpdates Theme Updater Class (with Envato API verification)
http://wp-updates.com
v1.1
Example Usage:
require_once('wp-updates-theme.php');
new WPUpdatesThemeUpdater( 'http://wp-updates.com/api/1/theme', 1, basename(get_template_directory()) );
*/
@stalukder03
stalukder03 / WP Customizer - Select
Created February 2, 2019 21:38 — forked from ajskelton/WP Customizer - Select
Add a Select field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_select_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_select',
'default' => 'value1',
) );
$wp_customize->add_control( 'themeslug_select_setting_id', array(
'type' => 'select',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Select Option' ),
<?php
/**
* Escape all translations with
*/
__( ‘Some String’, ‘text-domain’ ); _e( ‘Some string’, ‘text-domain’ );.
/**
* When there is no HTML use:
*/

Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*