Skip to content

Instantly share code, notes, and snippets.

@zephyrmike
zephyrmike / gp-gb-buttons
Last active January 19, 2024 10:38
Button classes for GeneratePress and GenerateBlocks
/* Use the classes below to style all the GeneratePress and GenerateBlocks buttons */
/* GeneratePress button */
.button,
.button:visited,
.button:focus {
/* add styles here */
}
@senlin
senlin / classic-editor-addon.php
Last active February 3, 2019 03:13
Classic Editor Addon by SO WP & Greg Schoppe - Classic Editor plugin doesn't remove Gutenberg by default. With this addon function we set the option that controls this from no-replace to replace, we remove the Settings link from the main Plugins page and we hide the Settings from the Settings > Writing screen. We also suppress the Nag screen tha…
<?php
/**
* Plugin Name: Classic Editor Addon
* Plugin Author: Pieter Bos (https://so-wp.com) and Greg Schoppe (https://gschoppe.com)
* Description: The Classic Editor plugin doesn't remove Gutenberg by default. With this function we set the option that controls this from no-replace to replace and we remove the Settings link from the main Plugins page
*/
function classic_editor_addon_hardcode_replace( $value ) {
return 'replace';
add_action( 'woocommerce_order_status_completed', 'change_role_on_purchase' );
function change_role_on_purchase( $order_id ) {
$order = wc_get_order( $order_id );
$items = $order->get_items();
$products_to_check = array( '1', '2', '3' );
foreach ( $items as $item ) {
if ( $order->user_id > 0 && in_array( $item['product_id'], $products_to_check ) ) {
$role = 'new-role';
if ( ! function_exists( 'generate_paging_nav' ) ) :
function generate_paging_nav() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
@generatepress
generatepress / gist:d57105c71e6b1b285a40
Last active April 14, 2020 07:39
Show full menu on mobile and tablets
@media (max-width: 769px) {
.menu-toggle,
.main-navigation.toggled .main-nav > ul {
display: none !important;
}
.main-navigation ul,
.main-navigation ul li:hover > ul,
.sf-menu li:hover > ul, .sf-menu li.sfHover > ul {
display: block;
}
@troydean
troydean / lgbk_add_member.php
Created March 3, 2014 10:51
WooCommerce Change User Role on Purchase of Specific Product
function lgbk_add_member( $order_id ) {
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $items as $item ) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
}
@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+