Skip to content

Instantly share code, notes, and snippets.

View derweili's full-sized avatar

Julian Weiland derweili

  • Germany
  • 02:54 (UTC +01:00)
View GitHub Profile
@derweili
derweili / selena-add-author-child-functions.php
Created March 1, 2016 22:50
Code to add the author to the meta function of the sela wordpress theme. Answer for forum topic on wordpress.org https://wordpress.org/support/topic/meta_data-add-author-in-frontend?replies=1
if ( ! function_exists( 'sela_entry_meta' ) ) :
function sela_entry_meta() {
// Sticky
if ( is_sticky() && is_home() && ! is_paged() ) {
echo '<span class="featured-post">' . __( 'Featured', 'sela' ) . '</span>';
}
echo '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ) . '">' . get_the_author() . '</a>';
@derweili
derweili / pregetposts_postnumber_filter.php
Last active May 11, 2016 08:34
Modify main query pased on taxonomy - wordpress
function derweili_change_postnumber_imagegallerycat( $query ) {
if ( $query->is_main_query() && $query->is_tax('bildergalerien-kategorie') ) {
$query->set('posts_per_page', 50);
return;
}
}
add_action( 'pre_get_posts', 'derweili_change_postnumber_imagegallerycat' );
@derweili
derweili / orbit-wp-gallery.php
Created September 5, 2016 15:13
WordPress Gallery based on Zurb Foundation Orbit Carousel
@derweili
derweili / brew.log
Created February 22, 2018 10:14
Brew Log
d
@derweili
derweili / wordpress-plugin-svn-to-git.md
Created March 2, 2018 14:23 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
@derweili
derweili / social-share.php
Created February 12, 2019 09:38
WordPress Social Share Link
<?php
function get_shared_base_url(){
if( is_single() || is_page() ){
return get_permalink( get_the_id() );
}else{
global $wp;
$current_url = home_url(add_query_arg(array(),$wp->request));
return $current_url;
}
@derweili
derweili / disable-acf-blocks-on-edit.js
Last active April 29, 2022 17:09
Disable Links in ACF Block-Edit Method
/*
* Wrap all ACF Blocks in Disabled block to disable all links in edit view
*/
const { createHigherOrderComponent } = wp.compose;
const { Fragment } = wp.element;
import { Disabled } from '@wordpress/components';
const withDisabledCompontent = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
@derweili
derweili / block-string-list-block.js
Created July 24, 2019 09:41
Example Gutenberg Block with array attribute
/**
* BLOCK: string-list-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
@derweili
derweili / template-specific-editor-styles.js
Created February 17, 2020 10:55
Page Template specific editor styles for the WordPress Block Editor (Gutenberg)
const {
subscribe,
select
} = wp.data;
/**
* Add dark-mode class to block-editor based on selected page template
*/
wp.domReady( () => {
const postType = select( 'core/editor' ).getCurrentPostType();
@derweili
derweili / cdn-enabler-cachify-compatibility.php
Created June 8, 2021 14:01
Add Cachify compatibility to CDN Enabler
remove_action( 'setup_theme', array( 'CDN_Enabler_Engine', 'start' ) );
add_action( 'template_redirect', array( 'CDN_Enabler_Engine', 'start' ), 20 );