Skip to content

Instantly share code, notes, and snippets.

View dgoze's full-sized avatar
💭
I may be slow to respond.

Daniel dgoze

💭
I may be slow to respond.
View GitHub Profile
@bappi-d-great
bappi-d-great / code.php
Created July 25, 2014 16:04
Add Excerpt in WPMU Events+ plugin
<?php
add_filter( 'eab-event-post_type-supports', 'adding_excerpt_support' );
function adding_excerpt_support($supports) {
$supports[] = 'excerpt';
return $supports;
}
@bappi-d-great
bappi-d-great / code.php
Created July 26, 2014 01:38
Stop accessing themes.php for subsite admin in a multisite
<?php
add_action('admin_init', 'disallowed_theme_page');
function disallowed_theme_page() {
global $pagenow;
if($pagenow == 'themes.php' && !is_super_admin()){
wp_redirect(admin_url());
exit;
}
}
@AlphaBlossom
AlphaBlossom / woocommerce-move-price.php
Last active May 6, 2020 15:30
Move WooCommerce Pricing on Single Product Page
/**********************************
*
* Move WooCommerce Price on Single Product Page
*
* @author AlphaBlossom / Tony Eppright
* @link http://www.alphablossom.com
*
* Reference hook locations using woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title – 5
@bappi-d-great
bappi-d-great / How to write dynamic css in a php file in wordpress.php
Last active December 19, 2024 18:37
How to write dynamic css in a php file in wordpress
<!-- functions.php -->
<?php
add_action( 'wp_enqueue_scripts', 'theme_custom_style_script', 11 );
function theme_custom_style_script() {
wp_enqueue_style( 'dynamic-css', admin_url('admin-ajax.php').'?action=dynamic_css', '', VERSION);
}
add_action('wp_ajax_dynamic_css', 'dynamic_css');
add_action('wp_ajax_nopriv_dynamic_css', 'dynamic_css');
@mattradford
mattradford / acf_body_class.php
Last active September 18, 2020 20:30
Echo ACF custom field in body class
// ACF field added to body class
// Adapted from http://krogsgard.com/2012/wordpress-body-class-post-meta/
add_filter('body_class','tend_custom_field_body_class');
function tend_custom_field_body_class( $classes ) {
global $wp_query;
$postid = $wp_query->post->ID;
if ( is_page_template('template-service-index.php') ) {
@JiveDig
JiveDig / acf_create_posts_acf_form.php
Last active February 28, 2023 06:29
Page template to create posts on the front end via Advanced Custom Fields Pro
<?php
/**
* Template Name: Create Post
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-posting-with-acf-pro/
* @uses Advanced Custom Fields Pro
*/
/**
@danielpataki
danielpataki / add-help-text.php
Last active August 1, 2024 23:43
Simplify the admin
function my_post_guidelines() {
$screen = get_current_screen();
if ( 'post' != $screen->post_type )
return;
$args = array(
'id' => 'my_website_guide',
'title' => 'Content Guidelines',
@yratof
yratof / functions.php
Created March 10, 2015 14:37
ACF OEmbed with thumbnails
<?php
/* Pull apart OEmbed video link to get thumbnails out*/
function get_video_thumbnail_uri( $video_uri ) {
$thumbnail_uri = '';
// determine the type of video and the video id
$video = parse_video_uri( $video_uri );
// get youtube thumbnail
@johnbillion
johnbillion / hierarchy.php
Last active June 12, 2025 14:11
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Theme Template Hierarchy Last updated for WordPress 5.4
==================================
This diagram is partially simplified for legibility. To view the complete template hierarchy in use on your site see the
Template panel in the Query Monitor plugin.
@DevinWalker
DevinWalker / gist:6fb2783c05b46a2ba251
Created April 17, 2015 17:31
WordPress: Loop through Categories and Display Posts Within
<?php
/*
* Loop through Categories and Display Posts within
*/
$post_type = 'features';
// Get all the taxonomies for this post type
$taxonomies = get_object_taxonomies( array( 'post_type' => $post_type ) );
foreach( $taxonomies as $taxonomy ) :