Skip to content

Instantly share code, notes, and snippets.

View gagimilicevic's full-sized avatar

Milicevic Dragan gagimilicevic

View GitHub Profile
@gagimilicevic
gagimilicevic / custom-template-plugin.php
Created April 7, 2020 13:52 — forked from ashokmhrj/custom-template-plugin.php
Get Template Part From plugin directory
<?php
/**
* The below function will help to load template file from plugin directory of wordpress
* Extracted from : http://wordpress.stackexchange.com/questions/94343/get-template-part-from-plugin
*/
define('PLUGIN_DIR_PATH','Your-plugin-directory-path');
function ccm_get_template_part($slug, $name = null) {
do_action("ccm_get_template_part_{$slug}", $slug, $name);
@gagimilicevic
gagimilicevic / crawler_detect.php
Created April 1, 2020 18:08 — forked from geerlingguy/crawler_detect.php
Detect crawlers/bots/spiders in PHP (simple and fast)
<?php
/**
* Check if the given user agent string is one of a crawler, spider, or bot.
*
* @param string $user_agent
* A user agent string (e.g. Googlebot/2.1 (+http://www.google.com/bot.html))
*
* @return bool
* TRUE if the user agent is a bot, FALSE if not.
@gagimilicevic
gagimilicevic / custom_robots.php
Created February 28, 2020 14:38 — forked from amboutwe/wordpress_robots_custom.php
Filters and example code for Yoast SEO robots or WP robots.txt
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Replace Disallow with Allow Generated Robots.txt
* Credit: Unknown
* Last Tested: Unknown
*/
add_filter('robots_txt','custom_robots');
@gagimilicevic
gagimilicevic / gist:6b39314cd0cc2700bcb8bf68ca1367e6
Created January 10, 2020 16:23 — forked from zackn9ne/gist:3344158
WordPress if is Default Template
(is_page() && !is_page_template())
@gagimilicevic
gagimilicevic / is_subpage.php
Created October 29, 2019 10:33 — forked from jhebb/is_subpage.php
WordPress is_subpage() function to check if a page against it's immediate parent or all it's parents
/**
* Is SubPage?
*
* Checks if the current page is a sub-page and returns true or false.
*
* @param $page mixed optional ( post_name or ID ) to check against.
* @param $single boolean optional - default true to check against all parents, false to check against immediate parent.
* @return boolean
*/
@gagimilicevic
gagimilicevic / is-private-mode.js
Created October 24, 2019 09:51 — forked from jherax/is-private-mode.js
Detect if the browser is running in Private mode (Promise based)
// uncomment if you are transpiling with Babel + Webpack
// const { window, document } = global;
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise}
*
* Live demo:
* @see http://live.datatables.net/piduzelo/1
*
@gagimilicevic
gagimilicevic / index.html
Created March 14, 2019 22:07 — forked from laurenclark/index.html
Pure CSS Social Media Icons
<div class="footer-social-icons">
<h4 class="_14">Follow us on</h4>
<ul class="social-icons">
<li><a href="" class="social-icon"> <i class="fa fa-facebook"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-twitter"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-rss"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-youtube"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-linkedin"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-google-plus"></i></a></li>
</ul>
@gagimilicevic
gagimilicevic / Uninstall.md
Created February 12, 2019 22:24 — forked from pokisin/Uninstall.md
Uninstall git, ubuntu

Uninstall git

To remove just git package itself from Ubuntu 14.04 execute on terminal:

$ sudo apt-get remove git

Uninstall git and it's dependent packages

To remove the git package and any other dependant package which are no longer needed from Ubuntu Trusty.

$ sudo apt-get remove --auto-remove git

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@gagimilicevic
gagimilicevic / class-wp-numeric-pagination.php
Created November 23, 2018 14:51 — forked from pixeline/class-wp-numeric-pagination.php
Wordpress Numeric Pagination Class that enables you to set the classes of each LI and A html tag.
<?php
/**
* Numeric Pagination Class
* @author Alexandre Plennevaux https://pixeline.be
*
* This class returns a list of LI > A. It is up to you to set the wrapping NAV > UL around your function call.
*
* @usage (setting specific classes)
*
* // Sets the css classes you want to be used for the output