Skip to content

Instantly share code, notes, and snippets.

View golchha21's full-sized avatar

Ulhas Vardhan Golchha golchha21

View GitHub Profile
@golchha21
golchha21 / wordpress-filter-custom-post-types-by-custom-taxonomies.php
Created April 27, 2020 07:24 — forked from koskinenaa/wordpress-filter-custom-post-types-by-custom-taxonomies.php
Add filtering by custom taxonomies to a post type. Note when registering the custom taxonomies 'query_var' should not be set to false. If so, this function won't work,
/**
* Add taxonomy filtering to custom post types
*
* Original example for one post type, https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/
*
*/
function filter_cpt_by_taxonomies( $post_type, $which ) {
// Affected post types
$post_types = array(
'my_post_type',
@golchha21
golchha21 / .htaccess
Created July 27, 2019 19:22 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://andreas-hecht.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@golchha21
golchha21 / meta-tags.md
Created June 1, 2019 20:26 — forked from lancejpollard/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 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">
<meta name="language" content="ES">
@golchha21
golchha21 / EqualSpacingItemDecoration.java
Created October 5, 2018 20:21 — forked from alexfu/EqualSpacingItemDecoration.java
Add equal spacing to RecyclerView items automatically. Can handle horizontal, vertical, and grid display modes
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spacing;
private int displayMode;
public static final int HORIZONTAL = 0;
@golchha21
golchha21 / gist:60fc578a7e0e0de30070204f9f4960c5
Created October 5, 2018 19:52 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
<?php
/*
Plugin Name: Easy Download Media Counter
Plugin URL: http://remicorson.com
Description: This plugin allows you to easily count downloads for a wordpress media and display it
Version: 1.0
Author: Rémi Corson
Author URI: http://remicorson.com
*/
<?php
/*
Plugin Name: Easy Default Parameters
Plugin URI: http://remicorson.com
Description: Set your own default parameters on a fresh WordPress install
Version: 0.1
Author: Rémi Corson
Author URI: http://remicorson.com
Contributors: Rémi Corson, corsonr
*/