Skip to content

Instantly share code, notes, and snippets.

View weszty's full-sized avatar
🏠
Working from home

Vecsei Szilveszter weszty

🏠
Working from home
View GitHub Profile
<?php # -*- coding: utf-8 -*-
/**
* Create a nav menu with very basic markup.
*
* @author Thomas Scholz http://toscho.de
* @version 1.0
*/
class T5_Nav_Menu_Walker_Simple extends Walker_Nav_Menu
{
/**
@weszty
weszty / add-custom-post-type-menu.php
Created October 7, 2019 09:20 — forked from tommcfarlin/add-custom-post-type-menu.php
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
@weszty
weszty / wp-config.php
Created March 30, 2021 08:22 — forked from burstofcode/wp-config.php
There are two things to understand when uninstalling or removing WooCommerce. * If you deactivate and delete the plugin from WordPress, you only remove the plugin and its files. Your settings, orders, products, pages, etc… will still exist in the database. * If you need to remove ALL WooCommerce data, including products, order data, etc., you ne…
<?php
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Open your site’s wp-config file and add
* define( 'WC_REMOVE_ALL_DATA', true);
* on its own line above the
* That’s all, stop editing! Happy blogging. line.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
define( 'WC_REMOVE_ALL_DATA', true);
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@weszty
weszty / read_csv.php
Created July 22, 2021 06:18 — forked from selwynpolit/read_csv.php
Php code to read a csv file of any size without exhausting memory and let you process it in chunks
/*
Reads a CSV file in chunks of 10 lines at a time
and returns them in an array of objects for processing.
Assumes the first line of the CSV file has headings
that will be used as the object name for the item you are
processing. i.e. the heading is CurrentURL then refer to
$item->CurrentURL
@weszty
weszty / wl-api.php
Created August 3, 2021 13:19 — forked from ivandoric/wl-api.php
WordPress Rest API Custom Filters (Video Tutorials Notes) - Check out the video: https://www.youtube.com/watch?v=5rSfAkLO5eo
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/
<!doctype html>
<html>
<head>
<style>
body{
background-color: #dfdfdf;
}
.box {
display: block;
width: 800px;
@weszty
weszty / defer-async-scripts.php
Created December 4, 2021 12:59 — forked from wpscholar/defer-async-scripts.php
Class that allows you to async and defer scripts in WordPress by adding data.
<?php
class WP_Scholar_Defer_Scripts {
public static function initialize() {
add_filter( 'script_loader_tag', array( __CLASS__, 'defer_scripts' ), 10, 2 );
add_filter( 'script_loader_tag', array( __CLASS__, 'async_scripts' ), 10, 2 );
}
public static function defer_scripts( $tag, $handle ) {
@weszty
weszty / installed-plugin-details.php
Created December 14, 2021 14:55 — forked from bradyvercher/installed-plugin-details.php
WordPress Plugin: Show a "Details" link for installed plugins to view information from the WordPress.org plugin directory.
<?php
/**
* Plugin Name: Installed Plugin Details
* Description: Show a "Details" link for installed plugins to view information from the WordPress.org plugin directory.
* Version: 1.0.0
* Author: Blazer Six
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
@weszty
weszty / gist:de4048668be130abc9b65de80d063e66
Created December 14, 2021 15:27 — forked from danielbachhuber/gist:7684646
How to integrate WordPress Core updates with your custom Plugin or Theme
<?php
/**
* How to integrate WordPress Core updates with your custom Plugin or Theme
*
* Filter the `update_plugins` transient to report your plugin as out of date.
* Themes have a similar transient you can filter.
*/
add_filter( 'site_transient_update_plugins', 'wprp_extend_filter_update_plugins' );
add_filter( 'transient_update_plugins', 'wprp_extend_filter_update_plugins' );
function wprp_extend_filter_update_plugins( $update_plugins ) {