Skip to content

Instantly share code, notes, and snippets.

View neverything's full-sized avatar
🍀
Good vibes for you

Silvan Hagen neverything

🍀
Good vibes for you
View GitHub Profile
@nico-martin
nico-martin / post-as-frontpage.php
Last active August 2, 2018 22:18
Set post as WP Front-Page
<?php
add_filter( 'get_pages', 'add_posts_to_frontpage_dropdown', 20, 2 );
add_action( 'pre_get_posts', 'update_frontpage_post_query' );
function add_posts_to_frontpage_dropdown( $pages, $r ) {
if ( array_key_exists( 'name', $r ) && 'page_on_front' == $r['name'] ) {
$args = [
'post_type' => 'post',
@davewarfel
davewarfel / expand-learndash-course-nav-widget-lessons.css
Last active March 31, 2021 16:42
(For LearnDash 2.x. Does not work with LearnDash 3.0+.) Auto-Expand Lessons in LearnDash Course Navigation Widget
/**
* This code will do two things:
*
* 1. Expand the topics (beneath each lesson) in the LearnDash
* course navigation widget.
*
* 2. Hide the arrow that allows lessons to be expanded/collapsed.
*
* NOTE: Be careful using this if you have a large number of lessons and/or topics.
* It could make for a REALLY long sidebar.
@danielmcclure
danielmcclure / functions.php
Last active November 17, 2022 14:36
Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce
<?php
/* Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce */
/* Add Courses Link to My Account menu */
add_filter ( 'woocommerce_account_menu_items', 'wc_ld_link', 40 );
function wc_ld_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'courses' => 'My Courses' )
+ array_slice( $menu_links, 5, NULL, true );
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active December 3, 2024 21:48
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@obiPlabon
obiPlabon / wp-time-constants.txt
Created October 19, 2017 11:08
WordPress time constants added in 3.5
// WordPress Time Constants
MINUTE_IN_SECONDS = 60 (seconds)
HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS
DAY_IN_SECONDS = 24 * HOUR_IN_SECONDS
WEEK_IN_SECONDS = 7 * DAY_IN_SECONDS
MONTH_IN_SECONDS = 30 * DAY_IN_SECONDS
YEAR_IN_SECONDS = 365 * DAY_IN_SECONDS
@trongcong
trongcong / .htaccess
Last active January 22, 2019 15:35
Wordpress login to download uploaded files | Protect uploaded files with login | Edit by trongcong
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L]
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active April 17, 2025 02:05
UPDATE 2024/03: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@kellenmace
kellenmace / get-id-of-main-site-in-wordpress-multisite.php
Created May 26, 2017 18:59
Get the Blog ID of the Main Site in a WordPress Multisite Network
<?php
/*
* Get the Blog ID of the main site in a multisite network.
*
* @return int The blog_id of the main site.
*/
function km_get_main_site_blog_id() {
return get_network()->site_id;
}
@zgordon
zgordon / learndash-topic-parent-lesson.php
Last active February 3, 2021 11:42
This snippets lets you get the lesson for a topic in your topic.php file
<?php
$parent_lesson_id = learndash_get_setting( $post, 'lesson' );
$parent_lesson = get_post( $parent_lesson_id );
?>
@protorob
protorob / artowoo.sh
Last active May 4, 2024 11:52
Bash Sript to Automate the Configuration of the Artomultiplo's Woocommerce Starter Kit
#!/bin/bash -e
# Start allways the same
wpuser='yourusername'
wpuseremail='[email protected]'
wpuserpass=$(date +%s | sha256sum | base64 | head -c 16)
dpprefix=$(date +%s | sha256sum | base64 | head -c 6)
clear