Skip to content

Instantly share code, notes, and snippets.

@w33zy
w33zy / paginationsequence.php
Created Dec 7, 2021 — forked from bramus/paginationsequence.php
Pagination Sequence Generator
View paginationsequence.php
<?php
/**
* Generate a sequence of numbers for use in a pagination system, the clever way.
* @author Bramus Van Damme <bramus@bram.us>
*
* The algorithm always returns the same amount of items in the sequence,
* indepdendent of the position of the current page.
*
* Example rows generated:
View sf.php
<?php
function themename_custom_logo_setup( $args ) {
$args['height'] = 116;
$args['width'] = 250;
return $args;
}
add_filter( 'storefront_custom_logo_args', 'themename_custom_logo_setup' );
View index.php
<?php
add_filters( 'wp_list_pages_excludes', function( $exclude_array ) {
$exclude_array = array( '121' );
return $exclude_array;
}
);
View example.php
<?php
/**
* Filter the content of the new user registration email
* @param $message The email content
* @param $user The user object
* @param $blogname The name of the site
* @param $url The url for the user profile
*/
function prefix_new_registration_email_content( $message, $user, $blogname, $url ) {
$_message = $meessage . '<br>';
@w33zy
w33zy / wordpress_export_to_json.php
Created Oct 8, 2020 — forked from jsnelders/wordpress_export_to_json.php
Export all core WordPress data (posts, pages, attachments, comments, tags, categories and users) to a JSON formatted file.
View wordpress_export_to_json.php
<?php
/**
* Plugin Name: WordPress Export to JSON
* Plugin URI: https://jsnelders.com/
* Description: Export all WordPress posts, pages, comments, tags, commments and users to a JSON file.
* Author: Jason Snelders
* Author URI: http://jsnelders.com
* Version: 2020-01-30.1
**/
View shortcode.php
<?php
function callout_shortcode( $atts ) {
$out = '';
$atts = shortcode_atts(
array(
'callout_h4' => 'This is a header',
'callout_p' => 'This is the paragraph below it',
),
$atts
View content.php
<?php
/**
* The Template for displaying content of post format standard
*
* @author tokoo
* @version 2.0
* @file wp-content/themes/pustaka-child/template-parts/content.php
*/
View RatchetServer.php
<?php
namespace App\Services;
use Ratchet\Http\HttpServer;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
class RatchetServer implements MessageComponentInterface
View gist:949a95a7960d7202fe9bad4e3d93b77c
jQuery(document).ready(function() {
jQuery("#the-empty-div").click(function(){
jQuery.ajax({
type: 'POST',
url: my_ajax_data.ajax_url,
data: {
action: 'my_ajax_action_callback',
security: my_ajax_data.security_nonce,
first_name: 'John', // Get this however
last_name: 'Smith', // Get this however
View gist:55fedea70ef392cb6baf359f3719b628
<?php
function generate_json_ld() {
if ( ! is_single() ) {
return null;
}
$data = [];