Skip to content

Instantly share code, notes, and snippets.

@igorbenic
igorbenic / sql.php
Created August 29, 2017 19:42
How to Change the BuddyPress User Query with SQL | http://ibenic.com/change-buddypress-user-query-sql
<?php
add_filter( 'bp_user_query_uid_clauses', 'filtering_memberpress', 10, 2 );
/**
* Filtering only users with an active memebership
* @param $sql array
* @param $query BP_User_Query
* @return array
*/
@igorbenic
igorbenic / child.php
Last active September 17, 2017 22:55
The Beginner's Guide to WordPress Theme Development | http://www.ibenic.com/beginners-guide-wordpress-theme-development
<?php
add_action( 'wp_enqueue_scripts', 'child_theme_styles' );
function child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
<?php
/**
* League Table Class
*
* The SportsPress league table class handles individual league table data.
*
* @class SP_League_Table
* @version 2.3
* @package SportsPress/Classes
* @category Class
@igorbenic
igorbenic / footer.php
Last active October 1, 2017 12:26
How to Create a Simple Custom WordPress Theme | www.ibenic.com/how-to-create-a-simple-custom-wordpress-theme
@igorbenic
igorbenic / checkout-form-final.php
Last active February 21, 2024 21:34
How to Customize WooCommerce Checkout Pages like a Hero | https://www.ibenic.com/customize-woocommerce-checkout-pages
<?php
/**
* Checkout Form
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-checkout.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@igorbenic
igorbenic / custom-rule.php
Last active November 2, 2017 21:43
custom-tax-question
<?php
//Add Custom WP Rewrite Rule to add taxo to link for Courses CPT
function resources_cpt_generating_rule( $wp_rewrite ) {
$rules = array();
$terms = get_terms( array(
‘taxonomy’ => ‘cours_topic’,
‘hide_empty’ => false,
));
@igorbenic
igorbenic / enqueue.php
Last active November 13, 2017 21:10
How to create a Repeater Field with wp.template() | https://www.ibenic.com/create-repeater-field-wp-template
<?php
// Front
add_action( 'wp_enqueue_scripts', 'repeater_field_enqueue' );
// Admin
add_action( 'admin_enqueue_scripts', 'repeater_field_enqueue' );
function repeater_field_enqueue() {
wp_enqueue_script( 'repeater-js', plugin_dir_url( __FILE__ ) . 'assets/js/repeater.js', array( 'jquery', 'wp-util' ), '', true );
}
@igorbenic
igorbenic / admin_init.php
Last active November 13, 2017 21:09
Find Unused Shortcodes in WordPress with Code | https://www.ibenic.com/unused-shortcodes-wordpress-code
<?php
add_action( 'admin_init', 'ibenic_get_all_posts_shortcodes' );
function ibenic_get_all_posts_shortcodes() {
if( isset( $_REQUEST['get_shortcodes'] ) ) {
// Our code will go here
die();
}
}
@igorbenic
igorbenic / config.js
Last active February 2, 2018 22:54
Configuring Webpack in WordPress for the First Time | https://www.ibenic.com/configuring-webpack-wordpress
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
};
@igorbenic
igorbenic / admin.php
Last active November 27, 2017 21:15
OOP for Better Conversions in WordPress Plugins | https://www.ibenic.com/oop-conversions-wordpress-plugins
<?php
/**
* Get all integrations. If there are any integrations, the array will be:
* array(
* 'integration_slug' => 'My_Integration_Class'
* )
*/
$integrations = apply_filters( 'my_plugin_integrations', array() );