Skip to content

Instantly share code, notes, and snippets.

View gagimilicevic's full-sized avatar

Milicevic Dragan gagimilicevic

View GitHub Profile
@gagimilicevic
gagimilicevic / geocoder_example.html
Created October 23, 2017 10:16 — forked from lazarofl/geocoder_example.html
Google Maps V3 - Geocoder example
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Geocoding Simple</title>
<link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
@gagimilicevic
gagimilicevic / swedish_mobile_phone_regex.rb
Created October 6, 2017 12:56 — forked from sandnuggah/swedish_mobile_phone_regex.rb
Regular Expression for validating swedish mobile phone numbers.
/A\+?(?:0{0,2}[46]*){1}7{1}[0-9]{8}/z
// Shortcode
// source : https://wpbakery.atlassian.net/wiki/pages/viewpage.action?pageId=524362
if(!function_exists('carousel_content')){
function carousel_content( $atts, $content = null ) {
return '<div class="owl-carousel content-carousel content-slider">'.do_shortcode($content).'</div>';
}
add_shortcode('carousel_content', 'carousel_content');
}
@gagimilicevic
gagimilicevic / kunena
Created September 18, 2017 09:52 — forked from csotelo/kunena
Kunena converter for bbPress 2.4
<?php
/**
* Implementation of Example converter.
*/
class Kunena extends BBP_Converter_Base {
function __construct() {
parent::__construct();
$this->setup_globals();
@gagimilicevic
gagimilicevic / image-upload-field-custom-taxonomy
Created September 5, 2017 13:34 — forked from mathetos/image-upload-field-custom-taxonomy
Add Image Upload Field to Custom Taxonomy
<?php
/* Add Image Upload to Series Taxonomy */
// Add Upload fields to "Add New Taxonomy" form
function add_series_image_field() {
// this will add the custom meta field to the add new term page
?>
<div class="form-field">
<label for="series_image"><?php _e( 'Series Image:', 'journey' ); ?></label>
@gagimilicevic
gagimilicevic / latest-and-first.php
Created September 4, 2017 09:20 — forked from gbyat/latest-and-first.php
get latest and first post in WordPress
/******************************************
* get latest post
* use in loop if ( is_latest() ) { stuff; }
******************************************/
function is_latest() {
global $post;
$loop = get_posts( 'numberposts=1' );
$latest = $loop[0]->ID;
return ( $post->ID == $latest ) ? true : false;
}
@gagimilicevic
gagimilicevic / wp-get_id_by_slug
Created September 1, 2017 12:53 — forked from davidpaulsson/wp-get_id_by_slug
WordPress: Get page ID from slug
// Usage:
// get_id_by_slug('any-page-slug');
function get_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
}
<html>
<head>
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
</head>
<body>
<div id="map" style="height: 400px; width: 500px;">
</div>
<script type="text/javascript">
@gagimilicevic
gagimilicevic / bootstrap-pagination.php
Created August 23, 2017 08:39 — forked from ediamin/bootstrap-pagination.php
Bootstrap Pagination for WordPress
/*
* custom pagination with bootstrap .pagination class
* source: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/
*/
function bootstrap_pagination( $echo = true ) {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
@gagimilicevic
gagimilicevic / paging.php
Created August 23, 2017 08:39 — forked from sloped/paging.php
Bootstrap Paging and Wordpress
<?php
//Use this function to create pagingation links that are styleable with Twitter Bootstrap
function paging() {
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));