Skip to content

Instantly share code, notes, and snippets.

@prajwal-stha
prajwal-stha / added.html
Created June 21, 2017 14:28
Added HTML
<div class="layout-options third-setting">
<h4>3. Select Border Type</h4>
<div id="gallery-wrapped" data-border-style="gallery-wrapped" class="layouts-select col-xs-12 col-sm-2 col-md-2 gallery-wrapped">
<img src="<?php echo get_stylesheet_directory_uri() .'/assets/img/mirror-img.jpg'; ?>" alt="<?php echo get_bloginfo( 'name') ; ?>">
<h4>Gallery Wrapped</h4>
</div>
<div id="mirror-wrapped" data-border-style="mirror-wrapped" class="layouts-select col-xs-12 col-sm-2 col-md-2 mirror-wrapped">
<img src="<?php echo get_stylesheet_directory_uri() .'/assets/img/wrap-img.jpg'; ?>" alt="<?php echo get_bloginfo( 'name') ; ?>">
<h4>Mirror Wrapped</h4>
</div>
@prajwal-stha
prajwal-stha / custom.js
Created June 21, 2017 12:34
Part that deals with uploading image
document.getElementById('chooseFiles').addEventListener("change", function (e) {
var file = e.target.files[0];
var reader = new FileReader();
//alert(reader);
reader.onload = function (f) {
$("html, body").animate({
scrollTop: 0
}, 900);
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
<?php
/**
* The Template for displaying all single posts.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary" class="site-content">
@prajwal-stha
prajwal-stha / git.md
Created January 15, 2017 09:52
The remote end hung up unexpectedly while git push: With this kind of error, raise the postBuffer size by:

git config --global http.postBuffer 524288000

@prajwal-stha
prajwal-stha / magento-check.php
Created December 31, 2016 16:39
Snippet to test server meets magento specifications or not.
<?
extension_check(array(
'curl',
'dom',
'gd',
'hash',
'iconv',
'mcrypt',
'pcre',
'pdo',
@prajwal-stha
prajwal-stha / magento-cleanup.php
Created December 31, 2016 16:38
Set the correct permissions for complete magento installations.
<?php
## Function to set file permissions to 0644 and folder permissions to 0755
function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){
$d = new RecursiveDirectoryIterator( $dir );
foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){
if( $path->isDir() ) chmod( $path, $dirModes );
else if( is_file( $path ) ) chmod( $path, $fileModes );
}
<?php
abstract class WPAS_Model {
static $primary_key = 'id';
private static function _table() {
global $wpdb;
$tablename = strtolower( get_called_class() );
$tablename = str_replace( 'wpas_model_', 'wpas_', $tablename );
return $wpdb->prefix . $tablename;
}
private static function _fetch_sql( $value ) {
@prajwal-stha
prajwal-stha / Mark parent navigation active when on custom post type single page Mark (highlight) custom post type parent as active item in Wordpress Navigation. When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Getting the post type of the current post
@prajwal-stha
prajwal-stha / README.md
Created November 3, 2016 07:34 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/