Skip to content

Instantly share code, notes, and snippets.

@igorbenic
igorbenic / facebook.php
Last active August 22, 2018 21:18
How to get the Share Counts from Social Media in WordPress | www.ibenic.com/how-to-get-the-share-count-from-social-media-in-wordpress
<?php
/**
* Facebook Shares
*/
class FacebookShareCount implements Share_Counter {
public static function get_share_count( $url ) {
$facebook_app_id = "YOUR_APP_ID";
$facebook_app_secret = "YOUR_APP_SECRET";
/**
* ReactDOM v15.3.0
*
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
@igorbenic
igorbenic / babel.php
Last active November 21, 2020 11:18
How to create a WordPress Login Plugin with React | www.ibenic.com/create-wordpress-login-plugin-with-react
<?php
// ...
add_action('wp_footer', 'react_login_add_babel_script', 999);
function react_login_add_babel_script() {
?>
<script type="text/babel">
@igorbenic
igorbenic / dump.txt
Last active June 29, 2022 08:15
How to Create a WordPress Custom Menu with Nav Walker Class | www.ibenic.com/how-to-create-a-wordpress-custom-menu-with-walker-nav-menu-class
object(WP_Post)#497 (40) {
["ID"]=>
int(160)
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2016-03-26 17:59:07"
["post_date_gmt"]=>
string(19) "2016-03-26 17:59:07"
["post_content"]=>
@igorbenic
igorbenic / modal.php
Last active September 9, 2016 14:32
Use YouTube API to Create a WordPress Video Modal | www.ibenic.com/use-youtube-api-to-create-a-wordpress-video-modal
<?php
add_action('wp_footer', 'youtube_video_html');
function youtube_video_html(){
?>
<div class="video_modal">
<button class="video_modal_close" onClick="closeVideo();">x</button>
<div id="videoPlayer"></div>
</div>
<?php
<?php
add_filter( 'cron_schedules', 'six_hours_custom_schedule' );
function six_hours_custom_schedule( $schedules ) {
$schedules['every_six_hours'] = array(
'interval' => 6 * HOUR_IN_SECONDS,
'display' => esc_html__( 'Every Six Hours' ),
);
@igorbenic
igorbenic / footer.php
Last active September 23, 2016 07:21
How make Fixed Meta Data in Twenty Sixteen
@igorbenic
igorbenic / change_link.php
Last active February 21, 2024 21:31
Custom WordPress Rewrite Rule to Combine Taxonomy and Post Type | www.ibenic.com/custom-wordpress-rewrite-rule-combine-taxonomy-post-type
@igorbenic
igorbenic / class.php
Last active October 14, 2016 22:30
How to Handle WordPress Errors with WP_Error Class | http://www.ibenic.com/how-to-handle-wordpress-errors-with-wp_error-class
<?php
$error_code = 'my_error_code';
$error_message = __( 'My Error Message', 'my_textdomain' );
$api_error = new WP_Error( $error_code, $error_message );
@igorbenic
igorbenic / plugin.php
Last active October 21, 2016 08:41
MailChimp WordPress Plugin with React: Introduction | http://www.ibenic.com/mailchimp-wordpress-plugin-with-react-introduction
<?php
/**
* Plugin Name: MailChimp WordPress Plugin
* Description: Create MailChimp forms in WordPress to collect emails
* Version: 1.0
* Author: Igor Benic
* Author URI: https://ibenic.com
*
* Text Domain: wp_mailchimp