Skip to content

Instantly share code, notes, and snippets.

View HasanGokce's full-sized avatar
🎯
Focusing

Hasan Gokce HasanGokce

🎯
Focusing
View GitHub Profile
@HasanGokce
HasanGokce / fundamental_functions.php
Last active June 11, 2017 21:05
The sanitizeString and sanitizeMySQL functions
<?php
function sanitizeString($var)
{
$var = stripslashes($var);
$var = strip_tags($var);
$var = htmlentities($var);
return $var;
}
function sanitizeMySQL($connection, $var)
{
@HasanGokce
HasanGokce / style.css
Created June 28, 2017 11:44
Creating Wordpress Theme: style.css file
/*
Theme Name: Go Foundation
Author: Hasan Gökçe
Description: This theme ideal for foundations
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gofoundation
*/
@HasanGokce
HasanGokce / archive.php
Last active July 13, 2017 13:27
Wordpress -> Loop -> Basic loop structure
<?php
if ( have_posts() ) :
while ( have_posts () ) :
the_post();
//loop content (template tags, html, etc)
endwhile;
endif;
?>
@HasanGokce
HasanGokce / functions.php
Created July 28, 2017 11:22
Building bootstrap 3 menu with submenu items without use WP_nav_walker (boostrap)! (Require bootstrap.css and bootstrap.js)
<?php
// Intented to use bootstrap 3.
// Location is like a 'primary'
// After, you print menu just add create_bootstrap_menu("primary") in your preferred position;
#add this function in your theme functions.php
function create_bootstrap_menu( $theme_location ) {
if ( ($theme_location) && ($locations = get_nav_menu_locations()) && isset($locations[$theme_location]) ) {
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/logo_login.png);
height:80px;
width:80px;
background-size: 80px 80px;
background-repeat: no-repeat;
padding-bottom: 00px;
@HasanGokce
HasanGokce / music.html
Created April 28, 2018 08:41
Javascript on/off button for music player
// Html
<img onclick="pauseVid()" src="images/button-sound.png" height="13" width="13" />
<audio id="myVideo" width="0" height="0">
<source src="music.mp3" type="audio/mpeg">
Tarayıcınız Html5'i desteklemiyor.
</audio>
// Music control
<script>
script type="text/javascript">
function changeClass()
{
// Code examples from above
}
window.onload = function()
{
document.getElementById("MyElement").addEventListener( 'click', changeClass);
}
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="messages.css">
<meta charset="utf-8">
</head>
<body>
@HasanGokce
HasanGokce / loop-custom.php
Created September 7, 2018 13:06 — forked from kevinwhoffman/loop-custom.php
WordPress - Custom Post Type Loop
<?php
$loop = new WP_Query( array(
'post_type' => 'Property',
'posts_per_page' => -1
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
var inputFile = document.getElementById("finput");
inputFile.addEventListener("change", handleFile, false);
function handleAudioFile() {
var fileList = this.files; /* now you can work with the file list */
file = fileList[0];
file.src = URL.createObjectURL(file); //If you use
var formData = new FormData(file);
formData.append('file', file);