Skip to content

Instantly share code, notes, and snippets.

View sterndata's full-sized avatar
🐈
napping with cats

Steven Stern sterndata

🐈
napping with cats
View GitHub Profile
{
".500": "Errors like this are logged. Check the error log on your server. If you can’t find the log, please contact your host.\n\nMeantime, enable wp_debug and wp_debug_log and after an error, look at wp-content/debug.log to see if anything gets logged there. https://wordpress.org/support/article/debugging-in-wordpress/\n\nYou can also try this: Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles. \n\nIf you cannot access wp-admin, there are other ways to <a href=\"https://wordpress.org/support/article/faq-troubleshooting/#how-to-deactivate-all-plugins-when-not-able-to-access-the-administrative-menus\">deactivate plugins</a>.",
".askcred": "@%clip% I've deleted your offer to login to your user's site. I'm am 100% sure you mean well but please <em>never ask for credentials on these forums.</em>\n\n<a href=\"https://wordpress.org/support/guidelines/#the-bad-stuff\">https://wordpress.org
<!-- wp:cover {"url":"http://tt.sterndata.com/wp-content/uploads/video/CBD-plant-slow-AVC-50FPS-PBR-4.mp4","id":55,"backgroundType":"video","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim"><video class="wp-block-cover__video-background" autoplay muted loop src="http://tt.sterndata.com/wp-content/uploads/video/CBD-plant-slow-AVC-50FPS-PBR-4.mp4"></video><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
<p class="has-text-align-center has-large-font-size">Premium, organically grown hemp-based broad-spectrum CBD products with zero THC. A natural alternative to relieve pain, inflammation, and anxiety.<br>[shop-now]</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover -->
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"verticalAlignment":"bottom"} -->
<div class="wp-block-column is-vertically-aligned-bottom"><!-- wp:heading -->
<h2>Our Products</h2>
@sterndata
sterndata / functions.php
Created October 1, 2018 15:40
get related products by taxonomy
function related_product_id_by_tax( $id, $tax ) {
$transient_name = 'related_' . $id . '_' . $tax;
$transient_time = 60 * 60 * 12; // 12 hours
if ( false === ( $transient_results = get_transient( $transient_name ) ) ) {
$tags_array = array();
$tags = wp_get_post_terms( $id, $tax );
foreach ( $tags as $tag ) {
$tags_array[] .= $tag->term_id;
}
$args = array(
function tachp_make_department_menu( $items, $args ) {
global $wp;
if ( 'main' != $args->menu->slug ) {
return $items;
}
$terms = get_terms('Department', array(
'orderby' => 'name',
function sds_post_title ( ) {
return get_the_title();
}
add_shortcode( 'the_title', 'sds_post_title' );
#! /bin/sh
export DAY
declare DAY=`date|cut -c 1-3`
USER="root"
PASSWORD="password"
MYSQLDUMP="/usr/bin/mysqldump"
MYSQL="/usr/bin/mysql"
OUTPUTDIR="/home/sdstern/Backup/sugaree/sql"
In the appropriate template file, replace
<?php _theme_content_nav( 'nav-below' ); ?>
with
<?php _sds_numeric_posts_nav( 'nav-below' ); ?>
The file may be index.php, archive.php or something else, depending on your theme
@sterndata
sterndata / optimize.php
Last active November 20, 2016 16:49
Optimize mysql/maria databases
#
# This does NOT work with PHP 7
#
# as a result, I am now using a simple shell script with this one line:
# mysqlcheck -o -A -pmysql_root_password
#
#! /usr/bin/php
<?php
@sterndata
sterndata / functions.php
Last active November 11, 2016 05:09
Underscores Snippets
<?
/* replace this part of the function theme_scripts in "Enqueue scripts and styles" */
function theme_scripts() {
$themecsspath = get_stylesheet_directory() . '/style.css';
wp_enqueue_style( 'theme-style', get_stylesheet_uri(), array(), filemtime( $themecsspath )
);
/* change the excerpt's more.. to a linked text Read More...
* be sure to add a class for more-link
*/
function lcas_list_children( $atts, $content ) {
global $post;
ob_start();
$args = array(
'post_parent' => $post->ID,
'post_type' => 'page',
'orderby' => 'title',
'order' => 'ASC',
);
$myquery = new WP_Query( $args );