Skip to content

Instantly share code, notes, and snippets.

View Aleksandar-Mitic's full-sized avatar
🏠
Working from home

Aleksandar Mitic Aleksandar-Mitic

🏠
Working from home
View GitHub Profile
@Aleksandar-Mitic
Aleksandar-Mitic / user-data.php
Created March 23, 2017 08:36 — forked from mrbobbybryant/user-data.php
code snippet from the User Generated data video
<?php
function register_user_question_content_type() {
$post_labels = array(
'name' => 'User Questions',
'singular_name' => 'User Question',
'add_new' => 'Add New',
'add_new_item' => 'Add New User Question',
'edit' => 'Edit',
'edit_item' => 'Edit User Question',
'new_item' => 'New User Question',
$( document).ready( function() {
var userSubmitButton = document.getElementById( 'user-submit-button' );
var adminAjaxRequest = function( formData, action ) {
$.ajax({
type: 'POST',
dataType: 'json',
url: screenReaderText.adminAjax,
data: {
action: action,
<div style="width: 70%; margin: 0 auto;">
<form id="user-post">
<?php wp_nonce_field( basename( __FILE__ ), 'user-submitted-question' ) ?>
<input type="text" id="user-name" name="user-name" placeholder="Name" style="margin-bottom: 10px;">
<input type="text" id="user-email" name="user-email" placeholder="Email" style="margin-bottom: 10px;">
<select name="product" id="product" style="margin-bottom: 10px;">
<option value=""></option>
<option value="hosting">Hosting</option>
<option value="themes">Themes</option>
<option value="plugins">Plugins</option>
@Aleksandar-Mitic
Aleksandar-Mitic / responsive_likebox.html
Created May 2, 2017 19:20
Responsive Facebook Like Box
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container" style="width:100%;">
<div class="fb-like-box" data-href="https://www.facebook.com/adobegocreate" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>
</div>
@Aleksandar-Mitic
Aleksandar-Mitic / count_total_project_code_lines_in_sublime
Created May 23, 2017 06:41 — forked from Hexodus/count_total_project_code_lines_in_sublime
Count total code lines in project using Sublime texteditor
// Go to menue:
// find->find in files
// Switch on reg_ex button
// Find:
^(.*)$
// Where:
c:\your_folder\,*.php,*.phtml,*.js,*.inc,*.html, -*/folder_to_exclude/*
// Then click on the find button
// Be careful to not click on Replace!!!
@Aleksandar-Mitic
Aleksandar-Mitic / script.js
Created July 6, 2017 09:13 — forked from LovroM/script.js
mojcimer obvescevalnik
let lastApp;
const reg = /\<a href\=\"\/room\/(.{4})/;
const link = 'https://www.mojcimer.si/search?city=koper&type=&minarea=&maxarea=&bedrooms=&bathrooms=&minprice=&maxprice=';
$.ajax({ url: link, success: function(data) {
lastApp = reg.exec(data)[1];
}});
setInterval(dejPreveri, 30000);
@Aleksandar-Mitic
Aleksandar-Mitic / PHP Date converter
Last active October 23, 2017 18:29 — forked from chrisdigital/PHP Date converter
Little date function to convert XX/XX/XXXX into verbose date (e.g. "January 11, 2015")
<?php
function dateConvert($x_date){
$x_date = explode('/', $x_date, 4);
$x_months = array('','January','Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$x_month = intval($x_date[0]);
$x_day = intval($x_date[1]);
$x_year = $x_date[2];
return ($x_months[$x_month]." ".$x_day. ", ".$x_year);
}
@Aleksandar-Mitic
Aleksandar-Mitic / wp-query-ref.php
Created October 5, 2017 10:25 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@Aleksandar-Mitic
Aleksandar-Mitic / wp_mail.md
Last active November 3, 2017 07:45 — forked from johnbillion/wp_mail.md
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.8, and includes some upcoming changes in WordPress 4.9.

There are a few TODOs left. Please bear with me.

@Aleksandar-Mitic
Aleksandar-Mitic / class-watermark-image.php
Created November 23, 2017 10:39 — forked from tomazzaman/class-watermark-image.php
Watermarking uploads in WordPress with Imagemagick
function register_watermarked_size() {
add_image_size( 'watermarked', 550, 550, true ); // This is what should be uploaded
}
add_action( 'init', 'register_watermarked_size' );
class Watermark_Image {
// The attachment meta array
public $meta = array();