Skip to content

Instantly share code, notes, and snippets.

View timiwahalahti's full-sized avatar
💻
Working hard, as usual

Timi Wahalahti timiwahalahti

💻
Working hard, as usual
View GitHub Profile
<?php
add_filter( 'bp_get_template_part', 'sippis_short_circuit_activity_post_form', 10, 3 );
function sippis_short_circuit_activity_post_form( $templates, $slug, $name ) {
if ( 'activity/post-form' === $slug ) {
return false;
}
return $templates;
} // end sippis_short_circuit_activity_post_form
@timiwahalahti
timiwahalahti / sunrise.php
Created November 19, 2020 16:28
WordPress Network sunrise.php with shared development and staging environment databse
<?php
if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
$current_site = new stdClass;
$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
$current_site->domain = $domain = DOMAIN_CURRENT_SITE;
$current_site->path = $path = PATH_CURRENT_SITE;
if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
$current_site->blog_id = BLOG_ID_CURRENT_SITE;
@timiwahalahti
timiwahalahti / social-share-urls.md
Created August 13, 2020 10:01
Social share urls

Facebook

https://www.facebook.com/sharer/sharer.php?u={{URL}}

Twitter

https://twitter.com/share?url={{URL}}&text={{CONTENT}}

Linkedin

https://www.linkedin.com/sharing/share-offsite/?url={{URL}}

Telegram

<div class="background-image preview lazyload" style="background-image: url('https://cdn.ark.fi/20191106161432/nattours_studio-puisto_photos-decopic-1.jpg');" data-src="https://cdn.ark.fi/20191106161432/nattours_studio-puisto_photos-decopic-1.jpg" data-src-mobile="https://cdn.ark.fi/20191106161432/nattours_studio-puisto_photos-decopic-1.jpg"></div>
<div class="background-image full-image reveal" style="background-image: url('https://cdn.ark.fi/20191106161432/nattours_studio-puisto_photos-decopic-1.jpg');"></div>
<noscript><div class="background-image full-image" style="background-image: url('https://cdn.ark.fi/20191106161432/nattours_studio-puisto_photos-decopic-1.jpg');"></div></noscript>
@timiwahalahti
timiwahalahti / gotta-go-fast.php
Created March 14, 2019 09:51
WP Gotta Go Fast
<?php
/*
Plugin Name: WP Gotta Go Fast
Plugin URI: https://dude.fi
Description: Gotta Go Fast
Author: Timi Wahalahti
Version: 0.1.0
Author URI: https://sipp.is
Text Domain: wp-gotta-go-fast
*/
// see https://carbonfields.net/docs/fields-select/
Field::make( 'select', 'crb_content_align', 'Text alignment' )
->add_options( 'emrezavarcbrgist2317' )
// see https://secure.php.net/manual/en/language.types.callable.php
function emrezavarcbrgist2317() {
// see https://developer.wordpress.org/reference/functions/get_categories/
$terms = get_categories( array(
'fields' => 'id=>name'
) );
<?php
function wpfi_rest_api_search_init() {
register_rest_route( 'wpfi/v1', '/search', array(
'methods' => 'GET',
'callback' => 'wpfi_rest_api_search',
) );
}
add_action( 'rest_api_init', 'wpfi_rest_api_search_init' );
@timiwahalahti
timiwahalahti / wp_mail.md
Created August 24, 2017 13:05 — forked from johnbillion/wp_mail.md
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.8, and includes some upcoming changes in WordPress 4.9.

There are a few TODOs left. Please bear with me.

@timiwahalahti
timiwahalahti / GitHub-Forking.md
Created August 22, 2017 07:41 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

<?php if ( ! is_wp_error( $topics ) && ! empty( $topics ) ) : ?>
<div class="cats" data-filter="cat">
<h4><?php pll_e( 'Valitse aihe' ) ?></h4>
<ul>
<li><a href="<?php echo get_term_link( $term_id ); ?>"<?php echo ( ! isset( $_GET['cat'] ) ) ? ' class="selected"' : ''; ?>><?php _e( 'Kaikki' ) ?></a></li>
<?php foreach ( $topics as $topic ) : ?>
<li>
<a href="<?php echo yeahboy_make_filter_url( $base_url_term_id, 'cat', $topic->term_id ) ?>" data-id="<?php echo $topic->term_id ?>" <?php echo ( $_GET['cat'] == $topic->term_id ) ? ' class="selected"' : ''; ?>>
<?php echo $topic->name ?>
</a>