Skip to content

Instantly share code, notes, and snippets.

View Oliviercreativ's full-sized avatar

Démontant Oliviercreativ

View GitHub Profile
@laurelstreng
laurelstreng / archive.php
Last active March 13, 2023 18:53
WordPress filtering content with multiple dropdowns, 1 taxonomy with different children, using ajax.
<?php
/**
* The template for displaying archive pages
*/
get_header();
global $wp_query;
?>
<form id="misha_filters" action="#">
@iqbalrony
iqbalrony / instagram_basic_display_api.php
Last active April 4, 2023 12:30
how to get access token for instagram basic display API
<?php
$endpoint = 'https://api.instagram.com/oauth/access_token';
// params the endpoint requires
$params = array(
'app_id' => 'your Instagram_APP_ID', // our instagram app id
'app_secret' => 'your Instagram_APP_SECRET', // our instagram app secret
'grant_type' => 'authorization_code',
'redirect_uri' => 'your redirect url', // our redirect uri
'code' => $_GET['code'] ? $_GET['code'] : '' // code instagram sent us in the URL
@jsnelders
jsnelders / wordpress_export_to_json.php
Last active April 17, 2024 05:24
Export all core WordPress data (posts, pages, attachments, comments, tags, categories and users) to a JSON formatted file.
<?php
/**
* Plugin Name: WordPress Export to JSON
* Plugin URI: https://jsnelders.com/
* Description: Export all WordPress posts, pages, comments, tags, commments and users to a JSON file.
* Author: Jason Snelders
* Author URI: http://jsnelders.com
* Version: 2020-01-30.1
**/
@tripflex
tripflex / functions.php
Last active August 13, 2023 18:16
Programmatically create a WooCommerce Subscription and associated WooCommerce Order
<?php
public function give_user_subscription( $product, $user_id, $note = '' ){
// First make sure all required functions and classes exist
if( ! function_exists( 'wc_create_order' ) || ! function_exists( 'wcs_create_subscription' ) || ! class_exists( 'WC_Subscriptions_Product' ) ){
return false;
}
$order = wc_create_order( array( 'customer_id' => $user_id ) );
@wpchannel
wpchannel / mu-gravity-forms.php
Last active April 30, 2022 08:06
Best tweaks for Gravity Forms plugin for creating forms with WordPress. Enhance Bootstrap 4 compatibility and increase performances. More informations in this tutorial: https://wpchannel.com/wordpress/tutoriels-wordpress/astuces-optimiser-formulaires-gravity-forms
<?php if (!defined('ABSPATH')) die('Restricted Area');
/*
* Plugin Name: Gravity Forms Enhancements
* Description: Tweaks for Gravity Forms plugin.
* Version: 20191102
* Author: Aurélien Denis
* Author URI: https://wpchannel.com/
*/
@iqbalrony
iqbalrony / functions.php
Last active May 30, 2023 10:09
How to add/use/register elementor dynamic tag with elementor free version. This is a very easy and useful system of Elementor. Especially I feel the need for this when I use URL control. Help link -> (https://developers.elementor.com/dynamic-tags/)
<?php
/**
* Post URL list
*/
if (!function_exists('prefix_get_all_posts_url')) {
function prefix_get_all_posts_url($posttype = 'post') {
$args = array(
'post_type' => $posttype,
'post_status' => 'publish',
@iqbalrony
iqbalrony / wp-custom-reset-password-form.php
Last active March 6, 2024 16:09
WordPress custom reset password form
<?php
/*
*Example Follw:-https://code.tutsplus.com/tutorials/build-a-custom-wordpress-user-flow-part-3-password-reset--cms-23811
*/
// Create the custom pages at plugin activation
register_activation_hook( __FILE__, 'dgm_plugin_activated' );
function dgm_plugin_activated() {
// Information needed for creating the plugin's pages
$page_definitions = array(
@Lysindr
Lysindr / collection.liquid
Last active September 29, 2023 14:59
Shopify AJAX filter collection page with TAGS
<div class="collection__main">
<!-- COLLECTION SIDEBAR -->
{%- capture categories -%}
{%- for tag in collections[collection.handle].tags -%}
{%- if tag contains 'categories' -%}
{%- assign tag_patterns = tag | split: '_' -%}
<li class="collection-sidebar__filter-item main-filter" data-tag="{{ tag | handle }}">{{ tag_patterns[1] }}</li>
{%- endif -%}
{%- endfor -%}
@yanknudtskov
yanknudtskov / functions.php
Last active June 20, 2023 19:30
WooCommerce Subscriptions check if the current user has an active subscription
<?php
function yanco_has_active_subscription( $user_id = '' ) {
if( function_exists( 'wcs_user_has_subscription' ) ) {
// When a $user_id is not specified, get the current user Id
if( '' == $user_id && is_user_logged_in() ) {
$user_id = get_current_user_id();
}
// User not logged in we return false
@karlhillx
karlhillx / macos_mojave_homebrew_apache_php_mariadb_2019.md
Last active February 21, 2024 09:51
macOS Mojave Setup: Homebrew + Apache + PHP + MariaDB (Regularly updated)

macOS Mojave Setup: Homebrew + Apache + PHP + MariaDB

This document provides help on getting your macOS development environment up and running with the latest versions of Homebrew, Apache, PHP, etc.

Homebrew Logo

Homebrew Installation

Homebrew is an excellent package manager for macOS; let's install it.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"