Skip to content

Instantly share code, notes, and snippets.

@igorbenic
igorbenic / ponav-meta1.php
Last active August 29, 2015 14:13
Ponavljajuća Polja za Metabox
<?php
/*
* Plugin Name: Ponavljajući Meta Field
* Plugin URI: www.lakotuts.com
* Description: Dodatak u koji dodaje ponavljajuće polje.
* Version: 1.0.0
* Author: Igor Benić
* Author URI: www.twitter.com/igorbenic
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@igorbenic
igorbenic / client.php
Last active August 29, 2015 14:24
Braintree Primjer
<?php
//Nekakva funkcija koja će nam dati product ID proizvoda kojeg se kupuje
//npr. WordPress Custom Post Type "product", u Loop-u se može koristiti get_the_id();
$productID = get_productID();
//Dohvaćamo library od Braintree-a
require_once "putanja/do/braintree/Braintree.php";
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('tvoj_id');
Braintree_Configuration::publicKey('tvoj_public_key');
@igorbenic
igorbenic / embed.html
Last active August 29, 2015 14:24
html5_2
<embed src="myFlashFile.swf" >
<a href="/go/getflashplayer/">
<img src=http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif alt="Get Adobe Flash player" />
</a>
</embed>
@igorbenic
igorbenic / index.html
Created August 26, 2015 13:50
WebSocketi
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script >
//Ovdje ide kod
</script>
</head>
@igorbenic
igorbenic / index.html
Created October 5, 2015 08:28
HTML5 File API demo
<!doctype HTML5>
<html>
<head>
<title>Demo</title>
<script>
//Skripta ide ovdje
</script>
<style>
/*CSS ide ovdje*/
</style>
@igorbenic
igorbenic / error.js
Last active November 3, 2015 13:00
Geo Pozicioniranje u HTML-u
function pokaziGresku(greska) {
switch (greska.code) {
case greska.PERMISSION_DENIED:
prikaziPoruku("Korisnik nije dopustio dohvat Geolokacije.");
break;
case greska.POSITION_UNAVAILABLE:
prikaziPoruku("Informacije lokacije nije dostupna.");
break;
case greska.TIMEOUT:
prikaziPoruku("Zahtjev za dohvaćanje lokacije korisnike je istekao.");
@igorbenic
igorbenic / get_the_term_list.php
Last active January 5, 2016 10:39
Display the Terms of a Custom WordPress Taxonomy |
<?php get_the_term_list( $id, $taxonomy, $before, $sep, $after ) ?>
@igorbenic
igorbenic / button.php
Last active May 24, 2017 09:32
Download a File From WordPress
<?php
/**
* Get the link of the attachment for download
*/
function ibenic_the_file_link( $attachment_id ){
// This must be improved by using wp_nonce!
echo '<a href="' . get_permalink( $attachment_id ) . '?attachment_id='. $attachment_id.'&download_file=1">';
echo get_the_title( $attachment_id );
echo '</a>';
@igorbenic
igorbenic / content.php
Last active January 8, 2016 09:19
How to create WordPress Related Posts | Article on www.ibenic.com
<?php
add_filter( 'the_content','ibenic_related_content' );
function ibenic_related_content( $content ){
// Check if the content is of a single article
if( is_singular( 'post' ) ) {
global $post;
// Variable that will be used to create the HTML of related content
$related_content = "";
@igorbenic
igorbenic / plugin.php
Last active February 21, 2024 21:34
Show a WordPress Post in a Modal - Article on Ibenic.com
<?php
/**
* Plugin Name: IBenic Bootstrap Modal
* Plugin URI: http://www.ibenic.com/show-a-wordpress-post-in-a-modal/
* Description: Show an article in a modal on the same page.
* Version: 1.0
* Author: Igor benić
* Author URI: http://www.ibenic.com
* License: GPL2
*