Skip to content

Instantly share code, notes, and snippets.

View metinsaylan's full-sized avatar
🤘
rocking on!

Metin Şaylan metinsaylan

🤘
rocking on!
View GitHub Profile
@metinsaylan
metinsaylan / wpbase
Created August 11, 2014 20:33 — forked from jsoningram/wpbase
#!/bin/bash
# Set up WP install with base plugins
# Usage: wpbase <dirname>
# Assumes you're in your home directory and installing into ~/DIRNAME
dir=$1
# Install latest WP
cd ~/$dir
wget http://wordpress.org/latest.tar.gz
@metinsaylan
metinsaylan / searchform.php
Created January 16, 2015 20:56
WordPress HTML4 Search Form
<form role="search" method="get" id="searchform" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div>
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="<?php echo esc_attr_x( 'Search', 'submit button' ); ?>" />
</div>
</form>
@metinsaylan
metinsaylan / mobile-shortcodes.php
Created January 19, 2015 18:41
WordPress desktoponly and mobileonly shortcodes
<?php
// [desktoponly] shortcode
add_shortcode('desktoponly', 'shailan_desktop_only_shortcode');
function shailan_desktop_only_shortcode($atts, $content = null){
if( !wp_is_mobile() ){
return wpautop( do_shortcode( $content ) );
} else {
return null;
}
@metinsaylan
metinsaylan / bootstrap-navbar.php
Created January 20, 2015 21:57
Bootstrap Navbar for WordPress
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Navbar Header -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#collapsible">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<?php
// woo-remove-billing.php | metinsaylan | 2015-03-15
// This filter removes billing fields from woocommerce checkout page.
// Usage:
// You can include this file in your functions.php file,
// or you can copy and paste this filter to your functions.php file.
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
@metinsaylan
metinsaylan / pager.php
Created March 18, 2015 00:44
Bootstrap pager links for WordPress single.php template
<?php
// This template can be included in your single.php template to display <Previous-Next> links below your post.
// It uses aligned pager template stated here > http://getbootstrap.com/components/#aligned-links
?>
<nav>
<ul class="pager">
<?php
$post_permalink = get_permalink();
$previous_post = get_permalink(get_adjacent_post(false,'',false));
@metinsaylan
metinsaylan / custom.css
Created October 24, 2015 22:52
Goran Theme color customization CSS
a {
color: #3BA0B7;
}
mark, ins {
background: transparent;
}
.site-header, .featured-page .more-link, .grid .more-link, button, input[type="button"], input[type="reset"], input[type="submit"] {
background: #3BA0B7;
@metinsaylan
metinsaylan / custom.css
Last active December 1, 2015 21:32
Twentyfifteen customization CSS for business site
body, html { overflow-y: auto; }
body.home.page main#main { display: none; }
body:before { display: none }
#colophon{ display: none }
article.hentry {
box-shadow: rgba(0,0,0,0.5) 0 2px 7px;
}
#secondary .nav-menu li {
@metinsaylan
metinsaylan / DataHelper.vb
Created June 27, 2016 11:59
Rotate DataTable
Public Shared Function RotateTable(dt As DataTable) As DataTable
Dim dt2 As New DataTable()
For i As Integer = 0 To dt.Rows.Count
dt2.Columns.Add()
Next
For i As Integer = 0 To dt.Columns.Count - 1
dt2.Rows.Add()
dt2.Rows(i)(0) = dt.Columns(i).ColumnName
Next
For i As Integer = 0 To dt.Columns.Count - 1
@metinsaylan
metinsaylan / DataHelper.vb
Created June 27, 2016 12:00
Convert DataTable to HTML
Public Shared Function ConvertDataTableToHTML(ByVal dt As DataTable, Attributes As String, Optional IncludeHeaders As Boolean = True) As String
Dim TableStart As String = "<table " & Attributes & ">"
Dim TableHeader As String =
<thead>
<tr>
<%=
From col As DataColumn In dt.Columns.Cast(Of DataColumn)()
Select <th><%= col.ColumnName %></th>
%>
</tr>