135 |
Database malware search manually for malicious tags |
Search manually for these keywords
base64_encode, shell_exec, exec, gzinflate, error_reporting, iframe, document.write, curl, eval, <script, <styl |
2024-10-02 16:10:24 |
|
134 |
CSS Restart by TSW playground test DOM replacing CSS Reset in a webpage example |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="view |
2024-08-10 19:08:08 |
|
133 |
CSS Restart CSS reset |
*
from:
https://www.joshwcomeau.com/css/custom-css-reset/
& https://pi |
2024-08-10 16:08:05 |
|
132 |
recent post shortcode for wp |
nt posts shortcode
function artech_child_recent_posts_shortcode($atts, $content = null) {
global $post;
extract(shortcode_atts(a |
2024-08-04 21:08:34 |
|
131 |
minify the output of additional CSS used in the Customizer wp |
Minify the customizer css output
add_action('wp_head', 'tn_minify_customizer_css_head');
function tn_minify_customizer_css_head(){
remove_a |
2024-07-23 15:07:14 |
|
130 |
Apache Line too-long error was leading to the 502 error when accessing URL fix htaccess woocommerece woo wc-settings |
# BEGIN Line too long fix
<IfModule mod_substitute.c>
SubstituteMaxLineLength 10M
</IfModule>
# END Line too long fix"
# source of line too lon |
2024-07-04 21:07:02 |
|
129 |
Add HTML attributes applied to the menu item anchor links |
add_filter( 'nav_menu_link_attributes', 'snippwiki_label_menu_items', 10, 4 );
/**
* Filter nav menu items
*
* @param array $atts {
* |
2024-07-03 15:07:12 |
|
128 |
using gettext to change words in wordpress strings. text get text gettext translate i18n |
**
* Change wording for In Stock
*
* @since Jun 2 2024
* @return string
*/
add_filter( 'gettext', 'change_wording_woocommerce_strings', 1 |
2024-06-02 18:06:21 |
|
127 |
Add new submenu to woocommerce menu |
[php]
function snippwiki_menu_links() {
add_submenu_page('woocommerce', 'Bulk Variations', 'Bulk Variations', 'manage_options', 'wcbv', 'wcbv_bu |
2024-06-01 15:06:41 |
|
126 |
HTML table consisting of 52 weeks of the year with each cell containing strings labeled "start"and "finish" |
<table>
<tbody>
<?php
// Assuming you have a function to calculate the start and end dates for a week
function getWeekDates($w |
2024-05-21 20:05:35 |
|
125 |
plugin for wordpress that extends woocommerce plugin to show total count for the parent product stock only |
[php]
/**
* Plugin Name: WooCommerce Parent Stock Display
* Plugin URI:
* Description: This plugin displays the total stock quantity for th |
2024-05-19 15:05:29 |
|
124 |
Menu toggle for website using details summary to open and close menu navigation bar |
<nav id="nav" class="navbar navigation-top" aria-label="<?php esc_attr_e( 'Primary Menu', 'april' ); ?>">
<?php
if ( has_nav_menu( 'primary' |
2024-05-14 20:05:32 |
|
123 |
wp settings api, option page example for plugin or theme |
function ltdi_register_settings() {
add_settings_section(
'ltdi_theme_settings_section',
__('Theme Settings', 'ltdi') |
2024-05-01 13:05:31 |
|
122 |
Why Are There Shadows? Poem by Larry Judd |
Why Are There Shadows?
When you are sad, do not sit under a happy tree,
Or the leaves will rain on you and bare the listening branches of concern. |
2024-04-25 12:04:42 |
|
121 |
syntax is commonly specified using a formal grammar, constructs: variables, expressions, functions, models |
https://en.wikipedia.org/wiki/Category:Programming_language_concepts
syntax is commonly specified using a formal grammar, constructs: variables, ex |
2024-04-25 12:04:18 |
|
120 |
Agile workflow process |
Goals
Ready
In Progress
In Review
Back Log Features
The Agile Process Flow
Concept - Projects are envisioned and prioritized
In |
2024-04-25 12:04:10 |
|
119 |
display date time javascript |
var currentdate = new Date();
var datetime = currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ |
2024-04-24 22:04:00 |
|
118 |
Dynamically update woocommerce single product page price using ajax |
<?php /* for woocommerce and wordpress only
You need to open woo > templates > cart file to add a rendering div to ( id=updatedPrice ) */
add_act |
2024-04-18 23:04:49 |
|
117 |
Breakpoint media calls for css screen sizes |
Breakpoints.
breakpoints({
xlarge: [ '1141px', '1680px' ],
large: [ '981px', '1140px' ],
medium: [ '737px', '980px' ], |
2024-04-03 15:04:03 |
|
116 |
wp admin menu and sections settings option api example with tab tabbed tabs |
<?php
// Register settings, sections, and fields
function cwpai_register_settings() {
register_setting('help_options', 'help_options'); |
2024-03-30 15:03:53 |
|
115 |
most commonly used metacharacters in regular expressions regex plus docblocks zend vs wp |
Metacharacter Description Example
. Matches any single character except a new line /./ matches anything that has a single character
^ Matches t |
2024-03-18 15:03:46 |
|
114 |
Render excerpt for wordpress custom post type |
**
* Custom excerpt rendering
*
* @since 1.0.0
* @param $post_id string Post ID
* @return excerpt
*/
// When using loop first arg is |
2024-03-18 15:03:30 |
|
113 |
Flexbox Grid System works with nested rows and uses flex columns HTML CSS |
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flexbox Grid System</title>
<link rel="stylesheet" href="css/fb-grid.css">
<style>. |
2024-03-03 19:03:59 |
|
112 |
Grid Holy Grid grid template columns at 768 pixels |
<style>body {
font-size: 16px;
margin: 0;
font-family: system-ui, Helvetica, Arial, sans-serif;
color: rgb(40, 46, 50);
min-h |
2024-01-27 16:01:05 |
|
111 |
Align three divs horizontally CSS float |
<style>.page{box-sizing:border-box;height:100%;}
.container{width: 100%; padding: 0;margin:0;}
section{display:block; padding: 10px; box-sizing:inh |
2024-01-27 16:01:02 |
|
110 |
Woocommerce get shipping methods get zone locations WC_Shipping_Zone class tbody fix missing shipping zones and regions. |
<tbody class="wc-shipping-zone-rows wc-shipping-tables-tbody">
<?php
// Getting shipping methods for what context. Valid values, admin, json. |
2024-01-07 17:01:30 |
|
109 |
Adding a Custom Description Field in the Shipping Method Backend in WooCommerce |
add_filter('woocommerce_shipping_instance_form_fields_flat_rate', 'ts_add_extra_fields_in_flat_rate', 10, 1);
function ts_add_extra_fields_in_flat_ra |
2023-12-26 16:12:04 |
|
108 |
Get viewport size button. Button to show size of screen view. Developer Tool |
<script>
function getViewportSize() {
var width = window.innerWidth || document.documentElement.clientWidth;
var height = window.innerHeight | |
2023-12-10 17:12:50 |
|
107 |
wp theme custom logo function. wp output date and comment count on one line of blog post excerpt |
**
* Support for logo upload, output.
*
* @param string $custom_logo_id id of logo
* @param string $logo src of logo
*
* @s |
2023-12-03 18:12:24 |
|
106 |
WP translatable strings passed in a function. Will pass WPCS. Solutions for i18n translation method when using a string. |
** #A8
* Action to output excerpt to blog page.
*
* @param string $enumb Theme_mod sets length of excerpt
* @param string $excerpt Excerpt |
2023-12-03 18:12:04 |
|
105 |
toggle open close mobile menu javascript |
(function() {
'use strict';
const mobileMenu = document.querySelector('.page-nav-wrapper');
var openMenuBtn = document.querySelector('.js |
2023-11-20 15:11:12 |
|
104 |
Plugin to remove wp, wordpress, administrator panel popups and notice messages |
*
Plugin Name: Remove Admin Notices
Description: This plugin will remove all admin notices and popups.
Version: 1.0
Author: CodeWP
*/
if (! |
2023-10-20 15:10:30 |
|
103 |
wp mail example send mail wordpress |
**
* Wordpress send mail routine
*/
add_action('extend_vdocipher_sendmail_test','extend_vdocipher_sendmail_onexpired', 10, 2);
function ext |
2023-10-10 15:10:22 |
|
102 |
user meta get current user id wordpress, wp, user_meta |
if ( is_user_logged_in() ):
$user_id = get_current_user_id();
$first_name = get_user_meta( $user_id, 'first_name', true );
$last_nam |
2023-10-08 15:10:47 |
|
101 |
Creating a Ajax Call in wordpress without a form jquery wp |
<div>
<input id="fname" name="fname" />
<input id="lastname" name="lastname" />
<button id="btnSend">Send</button>
</div>
<div id="show |
2023-10-07 21:10:04 |
|
100 |
How to remove a user role after checkout based on a specific product variation. Woo woocommerce wp |
add_action('woocommerce_thankyou', 'remove_role_after_purchase');
function |
2023-09-26 22:09:18 |
|
99 |
modify the renewal / expiration time of a daily subscription, so that it happens at midnight, woo, woocommerce |
add_action('woocommerce_subscription_status_active', 'update_next_payment_date', 10, 1);
function update_next_payment_date($subscription) { |
2023-09-16 22:09:25 |
|
98 |
wpdb sql update table wc admin notes remove woo admin notice coupon notice menu |
sql to run in myadmin
UPDATE wp_wc_admin_notes
SET status = 'actioned'
WHERE name = 'wc-admin-coupon-page-moved';
// Add code to functions.ph |
2023-09-04 21:09:18 |
|
97 |
woocommerce form field defaults woo wp fields |
$defaults = array(
'type' => 'text',
'label' |
2023-08-31 18:08:08 |
|
96 |
wp unisnstall plugin options, Fired when the plugin is uninstalled |
**
* Fired when the plugin is uninstalled.
*
* As a sample there is some code that checks for a custom option and if it is set it will delete a |
2023-08-13 16:08:52 |
|
95 |
wp_kses array of allowed HTML for escaping HTML output of an admin side form or settings api |
Good read: https://www.tollmanz.com/wp-kses-performance/
function shapeSpace_al |
2023-07-27 19:07:39 |
|
94 |
escaping function WordPress escape, check nonce, escape inputs, server request |
|
2023-07-27 17:07:28 |
|
93 |
esc_url_raw() is deprecated in favor of the now-undeprecated sanitize_url(). Can be used for DB queries, redirects, and HTTP requests: |
As of WP 5.9-6.1, the confusingly-named esc_url_raw() is deprecated in favor of the now-undeprecated sanitize_url(). Can be used for DB queries, redi |
2023-07-24 22:07:22 |
|
92 |
WP get ooption that has similar name for settings options + check if admin or editor user role + get user role by user id |
**
* Get option table head name.
*
* @since 1.0.02
*/
function profile_details_tsw_thead($opt)
{
$opt = ( '' != $opt ) ? $opt : '' |
2023-07-20 20:07:09 |
|
91 |
Disable emojis in wp head Defers emojis back to core files |
**
* Disable emojis in wp head
* Defers emojis back to core files.
*
* |
2023-07-06 15:07:05 |
|
90 |
WordPress detected a specific browser and add body_class |
** #F5
* Check if WordPress detected a specific browser and add body_class
*
* @since 1.0
* @param Global WP Browser detect
* @return b |
2023-06-30 20:06:59 |
|
89 |
wp checkbox checked function value of checkbox in options settings admin page |
settings checkbox
add_settings_field(
'grandchile_debug_radio' |
2023-06-23 18:06:32 |
|
88 |
get_longitude latitude datetime python |
#!/usr/bin/env python3
import os
import sys
import numpy as np
import astropy.units as u
from zoneinfo import ZoneInfo
from astropy.time import |
2023-06-20 17:06:35 |
|
87 |
Print render share buttons on generic page, wp |
<?ph-p
/**
* Prints HTML with share buttons
*/
function wp_entry_share() {
$permalink = wp_get_shortlink();
?>
<ul class="entry-share"> |
2023-06-19 22:06:10 |
|
86 |
Back-to-Top Button Vanilla JS |
* https://codepen.io/completewebco/pen/Powwxbd */
/* begin Back to Top button |
2023-06-19 19:06:38 |
|
85 |
Custom post type transactions and meta box save metabox to post |
**
* CPT for transactions - Load as early as possible on init
*/
add_action( 'init', 'create_transactions_post_type' );
function create_transa |
2023-05-31 19:05:31 |
|
84 |
Woocommerce Booking shortcode to display all bookings on front. table view shows resource name and dates |
add_shortcode( 'wcip_bookable', 'wc_bookings_interact_list_shortcode' );
function wc_bookings_interact_list_shortcode($att='', $content=null){
ob_ |
2023-05-18 22:05:03 |
|
83 |
Get selected value of select form field dropdown with jQuery |
(function( $ ) {
"use strict";
$(document).ready( function(){
$(function() {
/* friday-teachers is the id of the dropdown |
2023-05-12 23:05:56 |
|
82 |
Count the views when someone refreshes or views page. WP |
**
* Count the views when someone refreshes or views page.
* Remove comment from 'issues with prefetching' to kill refresh counts.
*/
// Remov |
2023-05-06 23:05:56 |
|
81 |
PHP function to print numbers as roman numerals |
function numberToRoman($number) {
$roman = array(
'M' => 1000,
'CM' => 900,
'D' => 500,
'CD' => 400,
'C' => 100,
'XC' |
2023-04-27 17:04:23 |
|
80 |
Admin notice on activation of plugin with transient Wordpress update notices |
activate/deactivate hooks
function vicpreview_plugin_activation()
{
set_transient( 'vicpreview-admin-notice-dependancies', true, 5 );
}
|
2023-04-01 17:04:39 |
|
79 |
Enqueue needed dependency scripts to child theme WordPress theme Child Theme action |
**
* Enqueue for Divi child theme
*
* @param string $parent Parent th |
2023-03-31 16:03:20 |
|
78 |
TwoSides plugin MAY REQUIRE you to replace your comments.php file inside a child-theme |
<?php
/**
* The template for displaying comments.
*
* This is the templat |
2023-03-27 18:03:36 |
|
77 |
display comments by author or user WordPress comments list loop comments |
**
* The [twosides_debate_author] shortcode.
*
* Accepts a user id and wi |
2023-03-26 22:03:15 |
|
76 |
scramble text using text shadow css property - scribbling on top of text makes text unreadable |
text-shadow: 1px 1px #fff, -1px -1px #fff, 1px -1px #fff, -1px 1px #fff,
2px 2px #fff, -2px -2px #fff, 2px -2px #fff, -2px 2px #fff,
3px 3px # |
2023-03-07 21:03:31 |
|
75 |
Parent theme using get_styleshheet so child theme needs to load both parent and child stylesheets |
** id= A2
* Child theme to Relational
* @uses get_stylesheet_ Parent theme using get_styleshheet so child theme needs
* |
2023-02-14 19:02:48 |
|
74 |
modify loop order of wordpress post wp |
function to modify default WordPress query
function wpb_custom_query( $query |
2023-01-31 19:01:58 |
|
73 |
activate deactivate widget to show date plugin was activated wp |
**
* activate/deactivate hooks
*/
function wordness_plugin_activation()
{
$format = get_option('date_format');
$timestamp = get_the_ |
2023-01-26 16:01:10 |
|
72 |
Outputs some database query information on page load for logged in admins |
*
Plugin Name: wp-Database-Performance-Monitor
*/
function qpm_performance() {
$stat = sprintf( '%d database queries in %.3f seconds, using %.2 |
2023-01-09 18:01:42 |
|
71 |
BASH function for checking PHP 7 and PHP 8 deprecation compatibility |
hpcs-test-compat() {
# $1 - file or directory to scan, default current directory
# $2 - PHP version to check compatibility, default 8.0
SOURC |
2022-12-18 22:12:32 |
|
70 |
WP Login log out url shortcode |
**
* Add a login/logout shortcode button
* @since 1.0.0
*/
add_shortcode( 'login_logout', 'snippwiki_custom_login_logout' );
function snippw |
2022-12-09 17:12:05 |
|
69 |
prepared staments for sql wordpress query |
from https://hookturn.io/custom-wordpress-sql-queries-for-beginners/
function get_some_data( $value ){
global $wpdb;
$sql = $wpdb->prepa |
2022-11-22 19:11:16 |
|
68 |
Is woocommerce active |
if (!function_exists('is_woocommerce_active')){
function is_woocommerce_active(){
$active_plugins = (array) get_option('active_plugins', a |
2022-11-07 23:11:51 |
|
67 |
use array to define objects as constants inside file |
$mailpoetPlugin = [
'version' => '3.99.1',
'filename' => __FILE__,
'path' => dirname(__FILE__),
'autoloader' => dirname(__FILE__) . '/ven |
2022-10-24 15:10:59 |
|
66 |
wp query meta query custom post type with pagination as table view |
function views_addon_wpbd_add_content_statistics(){
if ( ! is_admin() ) return;
$current_judge = '';
$wp_query = '';
echo '<div |
2022-10-18 21:10:06 |
|
65 |
wp wpdb query get_results from any table using foreach loop |
**
* Alternate method using formatted table
* @uses OBJECT array
* `fput |
2022-10-17 17:10:12 |
|
64 |
wp verify nonce - user roles allowed roles edit - login redirect to page |
@see https://wp-punk.com/best-data-sanitization-secure-guide-for-the-wordpres |
2022-09-26 16:09:28 |
|
63 |
Challenge: Using only string and tissue paper and balloons, creaet a confetti release event. |
Challenge: Using only string and tissue paper and balloons, create a confetti release event.
1. Tie balloons together as grouped balloons (circl |
2022-08-13 19:08:37 |
|
62 |
log window size on screen change javascript |
window.addEventListener('resize', function(event){
var newWidth = window.in |
2022-05-12 17:05:14 |
|
61 |
date time clock on page wordpress html javascript get datetime date format current time |
**
* Retrieves the date in localized format
* @param $timestamp
*/
funct |
2022-05-09 19:05:34 |
|
60 |
Path helpers for urls Get id by slug name or category wordpress |
**
* Path helpers for urls
*
* @since 1.0.2
*/
function texmod_get_ID_by_slug($page_name)
{
global $wpdb, $page_name; |
2022-04-27 16:04:38 |
|
59 |
htaccess for wordpress variations for gzip and creating staging site to redirect to subdomain |
use the same standard .htaccess configuration for Wordpress on a single domain i |
2022-04-18 17:04:28 |
|
58 |
PHP Javascript comment heading standard DocBlock |
**
* Summary.
*
* Description.
*
* @since x.x.x
*
* @see Function |
2022-04-09 21:04:31 |
|
57 |
Woocommerce leave coupon section below product totals open |
**
* Add footer styles to checkout page to show Coupon code section open.
* @since 2022-02-12 Larry Judd (codeable)
* @return CSS
*/
//a |
2022-02-17 19:02:50 |
|
56 |
Load cart data from session Woocommerce |
**
* Load cart data from session
* @param array $cart_item
* @param array $other_data
* @return array
*/
add_filter( 'woocommerce_get_ |
2022-02-12 18:02:22 |
|
55 |
Retreives Post Id from Meta Key wordpress Add Administrator as admin to database |
function get_post_id_by_meta_key_and_value($key, $value) {
global $wpdb;
$ |
2022-02-08 21:02:54 |
|
54 |
wp add template for custom post type taxonomy get terms by category in loop |
add_filter( 'taxonomy_archive ', 'profile_details_tsw_taxonomy_page' );
fun |
2022-01-07 23:01:26 |
|
53 |
set JQuery Event Handlers Debug Hooks display all js events in console |
https://www.py4u.net/discuss/276892
function setJQueryEventHandlersDebugHooks(bMonTrigger, bMonOn, bMonOff)
{
jQuery.fn.___getHookName___ = fu |
2021-12-05 00:12:05 |
|
52 |
woocommerce get cart item custom values meta metadat |
**
* @see http://www.example.com/?wc-ajax=get_refreshed_fragments
*/
funct |
2021-12-04 20:12:54 |
|
51 |
woocommerce show cart count and link to cart with total price showing |
<a class="cart-customlocation" href="<?php echo wc_get_cart_url(); ?>"
title="<?php _e( 'items' ); ?>"><?php echo sprintf ( _n( '%d item', '%d it |
2021-12-03 04:12:28 |
|
50 |
woocommerce change summary cats below add to cart button |
function porto_child_change_single_summary_order(){
global $product;
if ( has_term( array(), 'product_tag', $product->get_id() ) ) :
remove_acti |
2021-11-27 20:11:25 |
|
49 |
various often used CSS rules clearfix |
.clearfix:before,.clearfix:after{content:"";display:table}.clearfix:after{clear: |
2021-10-26 16:10:20 |
|
48 |
js wait until page is loaded to query element |
b_start();
?><script type="text/javascript" id="delivery-validation-tsw-footer">
jQuery( document ).ready(function($) {
const waitUntilElemen |
2021-10-24 18:10:39 |
|
47 |
Show metadata aka get post meta - Store meta values for custom fields, Wordpress |
**
* For debug only
*/
//add_action('wp_footer', 'delivery_validation_tsw_ |
2021-10-06 17:10:43 |
|
46 |
wp query meta query for key compare loop post query posts |
$args = array(
'post_type' => 'listing',
'post_status' => 'publish',
'posts_per_page' => - 1, |
2021-09-01 22:09:49 |
|
45 |
date pattern to format two digits for days with single digits in PHP regex |
$field = "01/08/2021"; // 1st of Aug (d/m/Y format)
$pattern = '/([0-9])+/';
$is_match = preg_match($pattern, $field, $match);
$next_day = $m |
2021-08-29 20:08:31 |
|
44 |
Get product id from order id in Woocommerce orders then get author meta email from author id |
**
* Retrieve author email from order meta from product id
* @see https://www.webroomtech.com/woocommerce-add-product-id-in-order-received-url |
2021-08-25 19:08:16 |
|
43 |
git Github git commit git push cheatsheet |
> git init (on new local folder)
Initialize Git: git init
> git clone https://github.com/tradesouthwest/twosides
You can propose changes (add it |
2021-08-11 23:08:03 |
|
42 |
CSS class selectors extended complex matches ends with starts with and Combinators explained |
Combinator CSS selectors
General child selector (space), e.g., A B
Di |
2021-08-11 22:08:56 |
|
41 |
Wordpress wp config error debug display errors + jQuery and post id post_id selectors cheatsheet |
fine('WP_DEBUG', true);
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'dis |
2021-08-11 22:08:52 |
|
38 |
Select HTML form selected = selected as a function with two variables |
function
function tsw_selected( $opt, $val )
{
$sel = '';
$opt = |
2021-08-11 17:08:11 |
|
37 |
Refresh hard refresh for desktops all |
-----Refresh
Hold down the Shift key and left-click the Reload button |
2021-08-11 15:08:50 |
|
31 |
Javascript submit form inline using anchor or button codepen menu drop downs pure CSS and csv export xml file script export any table |
<button value="xyz" onClick="document.getElementById(this.form).submit(.form);"> |
2021-08-06 17:08:25 |
|
26 |
php cut string after x characters |
substr(string,start,length)
// add character after x characters in
$newstr = |
2021-08-04 20:08:47 |
|
24 |
dynamically search all keywords using PDO SELECT |
$queried="abc,test, testing";
$values=explode(',',$queried);
$sql="SELECT * |
2021-08-03 14:08:40 |
|
22 |
Strip white spaces from strings |
For just spaces, use str_replace:
$string = str_replace(' ', '', $string); |
2021-08-02 06:08:25 |
|
19 |
Clean url using constant using a function |
function tsw_clean_url($str)
{
return htmlspecialchars( SNIPP_BASE . $st |
2021-07-31 20:07:09 |
|
18 |
clean inputs on php form submit POST switch case wp nonce |
function clean_input($data) {
$data = trim($data);
$data = stripslashes($ |
2021-07-31 19:07:58 |
|