Skip to content

Instantly share code, notes, and snippets.


Ivan Dorić ivandoric

View GitHub Profile
ivandoric / wl-api.php
Last active Nov 8, 2022
WordPress Rest API Custom Endpoints Video Tutorials Notes - Check out the videos: and
View wl-api.php
* Plugin Name: Custom API
* Plugin URI:
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI:
ivandoric / all.tsx
Created May 30, 2021
Infinite Scroll And Filters With React Query
View all.tsx
import Container from "components/ui/Container"
import VideoCard from "components/VideoCard"
import fetchData from "helpers/fetchData"
import { useEffect, useState, Fragment, useRef } from "react"
import { useInfiniteQuery } from "react-query"
import useIntersectionObserver from "../hooks/useIntersectionObserver"
import Select from "react-select"
import { useUIDSeed } from "react-uid"
import { useRouter } from "next/router"
import Seo from "components/Seo"
ivandoric / gulpfile.js
Last active Sep 18, 2022
Adding Svelte To Your Website Using Gulp and Webpack
View gulpfile.js
// This is the code used in video "How To Add Svelte To Your Site?"
// Check out the video here:
const gulp = require('gulp')
const sass = require('gulp-sass')
const browsersync = require('browser-sync').create()
const webpack = require('webpack')
const webpackStream = require('webpack-stream')
ivandoric / .htaccess
Last active Jun 27, 2022
.htaccess file for video tutorial about deploying Node apps to shared hosting. Checkout the video:
View .htaccess
RewriteEngine On
RewriteRule ^$ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$$1 [P,L]
ivandoric / gist:11212191
Created Apr 23, 2014
wordpress: WPML Custom Language switcher
View gist:11212191
/*Just add this anywhere in yopur template where you want language switcher to appear.
This switcher just shows the flags. But you can make it work anyway you like */
<ul class="lang-switcher">
$languages = icl_get_languages('skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str');
foreach($languages as $language){
$flag = $language['country_flag_url'];
ivandoric / wl-api.php
Created Oct 5, 2020
WordPress Rest API Custom Filters (Video Tutorials Notes) - Check out the video:
View wl-api.php
* Plugin Name: Custom API
* Plugin URI:
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI:
ivandoric / index.php
Last active Jan 7, 2022
WordPress Rest API Add Posts From Frontend (Video Tutorials Notes) - Check out the video:
View index.php
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo get_template_directory_uri() ?>/style.css">
<title>Watch Learn Theme</title>
<h1>Hello World</h1>
ivandoric / [id].jsx
Last active Jun 6, 2021
Code used in video - [Next + Strapi - Internationalization](
View [id].jsx
import Link from "next/link";
import { useRouter } from "next/router";
function Page({ content }) {
const router = useRouter();
return (
<div className="container">
ivandoric / list.phtml
Last active Mar 17, 2021
magento: Check if product is new in product listing
View list.phtml
$newFromDate = Mage::getModel('catalog/product')->load($_product->getID())->getNewsFromDate();
$newToDate = Mage::getModel('catalog/product')->load($_product->getID())->getNewsToDate();
$now = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
if(($newFromDate < $now && $newFromDate != NULL) && ($newToDate > $now || $newToDate == "")){
echo "New Product";
ivandoric / gist:e4e46294c4d35eac0ec8
Created Jun 5, 2014
wordpress: create custom reset password page
View gist:e4e46294c4d35eac0ec8
<?php //Add all of this tu custom page template ?>
global $wpdb;
$error = '';
$success = '';
// check if we're in reset form
if( isset( $_POST['action'] ) && 'reset' == $_POST['action'] )