Skip to content

Instantly share code, notes, and snippets.

@hostz-frank
hostz-frank / front-page.php
Created December 10, 2015 11:53
Full width stream of Instagram posts on a WordPress frontpage
<?php
// Into front-page.php; exact location depends on the theme, e.g. just before sth. like:
// <div id="sidebar-footer" class="footer-widget-area clearfix" role="complementary">
if ( is_active_sidebar( 'instagrid_full_width' ) ) : ?>
<div id="instagrid" class="site-content">
<?php dynamic_sidebar( 'instagrid_full_width' ); ?>
</div><!-- #instagrid -->
<?php endif; ?>
@hostz-frank
hostz-frank / fusion-core-for-events.php
Last active November 18, 2016 20:44
Enable the Fusion Core Builder on other WordPress CPT's (custom post types).
<?php
/*
Plugin Name: Fusion Core on Events
Description: Enables the ThemeFusion Core page builder on post type "tribe_events" of The Events Calendar
*/
defined( 'ABSPATH' ) OR die();
/**
* Enable Fusion Pagebuilder for post type "tribe_events" (The Events Calendar).
@hostz-frank
hostz-frank / functions.php
Created January 12, 2016 09:23
Make the Fusion builder work with large amounts of shortcode data, while editing a post or page.
<?php
/**
* Copy into functions.php of your Avada child theme!
*/
add_action( 'wp_ajax_fusion_content_to_elements', function(){
@ini_set('memory_limit', '256M');
}, 5 );
@hostz-frank
hostz-frank / functions.php
Last active January 23, 2016 14:41
Do not show related YouTube videos when using the oembed feature of WordPress - put the code into functions.php of your theme or into a custom plugin.
<?php
/**
* Youtube-Video verbieten, related vids am Ende anzuzeigen.
*/
add_filter( 'oembed_dataparse', 'this_add_youtube_norel', 11, 3 );
function this_add_youtube_norel( $return, $data, $url ) {
if( false !== strpos( $return, 'youtube.com' ) )
return str_replace( '=oembed', '=oembed&rel=0', $return );
else
return $return;
@hostz-frank
hostz-frank / functions.php
Last active May 22, 2018 21:02
Remove search field for Theme "Divi" (too close to other links: Pagespeed Insights).
<?php
/**
* Remove search field for Theme "Divi" (to close to other links: Pagespeed Insights).
* Requires the Autoptimze option "Minimize HTML" to be activated.
*/
add_filter( 'autoptimize_html_after_minify', 'divi_remove_search' );
function divi_remove_search( $content ) {
$content = preg_replace(
'/\<div class="et_search.*close_search_field"\>\<\/span\>\<\/div\>\<\/div\>/',
@hostz-frank
hostz-frank / register-wpcourseware-users.php
Last active December 8, 2017 00:33
Weist automatisch neue User in WordPress einem WP-Courseware-Kurs zu.
<?php
/*
Plugin name: WP Courseware frontend user sync
Description: Weist automatisch neue User in WordPress einem WP-Courseware-Kurs zu, die programmatisch erstellt werden.
*/
defined( 'ABSPATH' ) || die();
// Anpassen: Kurs-ID des WP-Courseware-Kurses || Assign your WPCW course ID here!
$wpc_course_id = 1;
@hostz-frank
hostz-frank / functions.php
Created February 18, 2018 11:19
Copy to sender via Divi's contact form
<?php
/**
* Copy lines below into functions.php of your Divi child theme.
*/
add_filter( 'et_contact_page_headers', 'mycopytosender', 10, 4 );
function mycopytosender( $headers, $contact_name, $contact_email ) {
$headers[] = "Cc: \"{$contact_name}\" <{$contact_email}>";
return $headers;
}
@hostz-frank
hostz-frank / functions.php
Last active March 13, 2018 11:05
Im Divi-Theme das Laden externer Google-Fonts abschalten. / Disable external pulled web fonts from Google for the Divi theme
<?php
// Copy the code below into your Divi child(!) theme's functions.php
/**
* Disable external font load from Google.
*
* Useful after putting Google fonts on your own server;
* see https://google-webfonts-helper.herokuapp.com/fonts
*/
@hostz-frank
hostz-frank / wp-config.php
Created May 11, 2018 17:10
Enable debugging in WP into file wp-content/debug.log
<?php
// paste directly above: "/* That's all, stop editing! Happy blogging. */"
define('WP_DEBUG', true );
if ( WP_DEBUG ) {
define( 'SAVEQUERIES', true );
define( 'SCRIPT_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
}
@hostz-frank
hostz-frank / functions.php
Created May 21, 2018 18:03
Impressum-Link neben Datenschutz-Link auf der wp-login.php
/**
* Impressum-Link zum Privacy Policy Link auf Login-Seite hinzufügen (wp-login.php).
*/
add_filter( 'the_privacy_policy_link', function( $link, $privacy_policy_url ) {
return $link . '&nbsp; | &nbsp;<a href="/impressum/">Impressum</a>';
}, 10, 2 );