Skip to content

Instantly share code, notes, and snippets.

Daniel Pataki danielpataki

Block or report user

Report or block danielpataki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danielpataki
danielpataki / alt-cron.php
Last active Nov 14, 2019
WordPress Config File
View alt-cron.php
define( 'ALTERNATE_WP_CRON', true );
@danielpataki
danielpataki / content.php
Last active Nov 9, 2019
Basics Of Theme Development
View content.php
<h2><a href='<?php the_permalink() ?>'><?php the_title() ?></a></h2>
<div class="content">
<?php the_excerpt() ?>
</div>
@danielpataki
danielpataki / ajax-action.php
Last active Oct 27, 2019
Twenty Fifteen AJAX
View ajax-action.php
add_action( 'wp_ajax_nopriv_ajax_pagination', 'my_ajax_pagination' );
add_action( 'wp_ajax_ajax_pagination', 'my_ajax_pagination' );
function my_ajax_pagination() {
echo get_bloginfo( 'title' );
die();
}
@danielpataki
danielpataki / cached-posts.php
Last active Jul 24, 2019
WordPress REST API
View cached-posts.php
public function get_remote_posts() {
$posts = get_transient( 'remote_posts' );
if( empty( $posts ) ) {
$response = wp_remote_get( 'http://mysite.com/wp-json/wp/v2/posts/' );
if( is_wp_error( $response ) ) {
return array();
}
$posts = json_decode( wp_remote_retrieve_body( $response ) );
@danielpataki
danielpataki / activation.php
Last active Jul 3, 2019
WordPress Custom Database Tables
View activation.php
register_activation_hook( __FILE__, 'my_plugin_create_db' );
function my_plugin_create_db() {
// Create DB Here
}
@danielpataki
danielpataki / basic-deactivation.php
Last active Jun 30, 2019
Installation And Uninstallation Hooks
View basic-deactivation.php
register_deactivation_hook( __FILE__, 'my_plugin_deactivation' );
function my_plugin_deactivation() {
// Deactivation rules here
}
@danielpataki
danielpataki / add-section.php
Last active Jun 4, 2019
Customizer Tutorial
View add-section.php
$wp_customize->add_section( 'cd_colors' , array(
'title' => 'Colors',
'priority' => 30,
) );
View adding-plugins.sh
vagrant plugin install vagrant-hostsupdater
vagrant plugin install vagrant-triggers
@danielpataki
danielpataki / compatibility.js
Last active Apr 10, 2019
jQuery in WordPress
View compatibility.js
/* Regular jQuery */
$('.hideable').on('click', function() {
$(this).hide();
})
/* Compatibility Mode */
jQuery('.hideable').on('click', function() {
jQuery(this).hide();
})
@danielpataki
danielpataki / basics.php
Last active Apr 5, 2019
Creating a Plugin
View basics.php
<?php
/**
* Plugin Name: My Facebook Tags
* Plugin URI: http://danielpataki.com
* Description: This plugin adds some Facebook Open Graph tags to our single posts.
* Version: 1.0.0
* Author: Daniel Pataki
* Author URI: http://danielpataki.com
* License: GPL2
*/
You can’t perform that action at this time.