Skip to content

Instantly share code, notes, and snippets.

php.ini / php configuration option
search in file and change:
post_max_size
upload_max_filesize
optional:
memory_limit
restart apache service and there you go
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Post Types', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Post Type', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Post Types', 'text_domain' ),
'name_admin_bar' => __( 'Post Type', 'text_domain' ),
'archives' => __( 'Item Archives', 'text_domain' ),
'attributes' => __( 'Item Attributes', 'text_domain' ),
global $wp;
$current_url = home_url(add_query_arg(array(),$wp->request));
/**
* Author: Leon Beilis
* Desription: A Program that asks for two dotes
* and calculate their distance on the Coordinate system
* by known math formula
*/
import java.util.Scanner;
public class Line {
@itsKnight847
itsKnight847 / Wordpress search by post title
Created October 30, 2017 08:12
limit wordpress search to search by post title only
// Search by Post Title
function search_by_title_only( $search, &$wp_query )
{
global $wpdb;
if ( empty( $search ) )
return $search; // skip processing - no search term in query
$q = $wp_query->query_vars;
$n = ! empty( $q['exact'] ) ? '' : '%';
$search = '';
$searchand = '';
@itsKnight847
itsKnight847 / SQL
Created October 30, 2017 08:54
sql description
== SQL Snippets ==
-- Lesson1
-- show all
SELECT * FROM {{table_name}};
-- select more then 1 column
SELECT name, imdb_rating FROM movies;
-- create table
@itsKnight847
itsKnight847 / gist:af7d502d7f264f725aa168cc5cb29cb1
Created February 1, 2018 10:20
recursive array check PHP
/**
* check recursive array and spot the diffrence
* @param $_first_array
* @param $_second_array
* @return array
*/
private function recursive_array_check($_first_array, $_second_array) {
$diff = [];
foreach($_first_array as $k => $v) {
if(is_array($v) && isset($_second_array[$k])){
add the following attribute:
allow="autoplay; encrypted-media"
example:
<iframe width="100%" src="https://www.youtube.com/embed/hCgokw_cmxA?modestbranding=1&autoplay=1&showinfo=0&controls=0&playlist=hCgokw_cmxA&loop=1" allow="autoplay; encrypted-media" frameborder="0" allowfullscreen=""></iframe>
@itsKnight847
itsKnight847 / htaccess
Created August 5, 2018 15:11
wordpress caching htaccess
######### CRUNCHIFY SETTING - START ##########
Options All -Indexes
# Disable ETags
<IfModule mod_headers.c>
Header unset ETag
Header set Connection keep-alive
</IfModule>
FileETag None
@itsKnight847
itsKnight847 / functions.php
Created December 26, 2018 09:22
acf init google maps in admin
function my_acf_init() {
acf_update_setting('google_api_key', 'api key here');
}
add_action('acf/init', 'my_acf_init');