Skip to content

Instantly share code, notes, and snippets.

View danielpataki's full-sized avatar

Daniel Pataki danielpataki

View GitHub Profile
@danielpataki
danielpataki / adding-plugins.sh
Last active April 24, 2019 14:48
Using VVV
vagrant plugin install vagrant-hostsupdater
vagrant plugin install vagrant-triggers
<?php
add_post_meta( get_the_ID(), 'checked_by_ceo', true, true );
?>
@danielpataki
danielpataki / abstraction-1.php
Last active April 4, 2019 19:10
OOP in Plugins
<div class='post' id='post-23'>
<h2><?php the_title() ?></h2>
<div class='excerpt'>
<?php
$content = get_the_content();
if( strlen($content) < 250 ) {
echo $content;
}
else {
$content = substr( $content, 0, 250 );
@danielpataki
danielpataki / deregister.php
Last active April 7, 2016 09:23
Deregistering Scripts
wp_deregister_script( 'jquery' );
@danielpataki
danielpataki / compatibility.js
Last active October 17, 2020 00:06
jQuery in WordPress
/* Regular jQuery */
$('.hideable').on('click', function() {
$(this).hide();
})
/* Compatibility Mode */
jQuery('.hideable').on('click', function() {
jQuery(this).hide();
})
@danielpataki
danielpataki / Gruntfile-skeleton.js
Last active February 22, 2016 01:05
Using Grunt For WordPress Development
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
});
grunt.registerTask('default', [] );
};
@danielpataki
danielpataki / default-task.js
Last active February 23, 2016 18:29
Gulp and WordPress
gulp.task('default', ['scripts', 'styles']);
@danielpataki
danielpataki / enqueue-list-style.php
Last active November 29, 2016 16:26
Goal Tracker
add_action( 'admin_enqueue_scripts', 'gt_post_list_style' );
function gt_post_list_style() {
$screen = get_current_screen();
if( 'edit-post' == $screen->id ) {
wp_enqueue_style( 'gt-post-list-style', get_stylesheet_directory_uri() . '/post-list.css' );
}
}
@danielpataki
danielpataki / basichook.php
Last active September 7, 2017 11:13
Getting Started With Plugins
function my_tracking_code() {
echo 'Paste tracking code from Google Analytics here';
}
add_action( 'wp_footer', 'my_tracking_code' );
@danielpataki
danielpataki / background.css
Last active December 28, 2016 03:28
Christmas 2015 Post
#page:before {
margin:21px;
background-image: url("images/new_year_background.png");
position:fixed;
top:0px;
left:0px;
width:100%;
height:100%;
display:block;
content: " ";