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
@dgoze
dgoze / hierarchy.php
Created May 6, 2020 15:29 — forked from johnbillion/hierarchy.php
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Template Hierarchy (as of WordPress 4.9)
is_404() -------------------------------------------------------------------------------------------------> 404.php
is_search() ----------------------------------------------------------------------------------------------> search.php
is_front_page() ------------------------------------------------------------------------------------------> front-page.php
is_home() ------------------------------------------------------------------------------------------------> home.php
@dgoze
dgoze / functions.php
Created May 6, 2020 15:29 — forked from yratof/functions.php
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
@dgoze
dgoze / acf_create_posts_acf_form.php
Created May 6, 2020 15:29 — forked from JiveDig/acf_create_posts_acf_form.php
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
*/
/**
@dgoze
dgoze / acf_body_class.php
Created May 6, 2020 15:29 — forked from mattradford/acf_body_class.php
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') ) {
@dgoze
dgoze / woocommerce-move-price.php
Created May 6, 2020 15:30 — forked from AlphaBlossom/woocommerce-move-price.php
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
@dgoze
dgoze / populate_acf_select_fields
Created May 6, 2020 15:30 — forked from timmcdaniels/populate_acf_select_fields
Populating ACF Select Fields with Post Type Values
// populate acf field (sample_field) with post types (sample_post_type)
function acf_load_sample_field( $field ) {
$field['choices'] = get_post_type_values( 'sample_post_type' );
return $field;
}
add_filter( 'acf/load_field/name=sample_field', 'acf_load_sample_field' );
function get_post_type_values( $post_type ) {
$values = array();
@dgoze
dgoze / admin_menu_separator.php
Created May 6, 2020 15:30 — forked from franz-josef-kaiser/admin_menu_separator.php
WordPress (mu)plugin to add a separator to the admin menu with a call to the default API. Explanation can be found in the doc block. // Screenshots (main menu separator) http://i.stack.imgur.com/HUmKQ.png // (submenu separator) http://i.stack.imgur.com/6AKDY.png
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: Admin Menu Separator
* Description: Adds a separator on whatver priority is needed.
*/
add_filter( 'parent_file', 'admin_menu_separator' );
function admin_menu_separator( $parent_file )
{
@dgoze
dgoze / functions.php
Created May 26, 2020 00:39 — forked from BruceMcKinnon/functions.php
Change Wordpress emails sender adddess and sender name
add_filter('wp_mail_from', 'kmow_mail_from_address');
function kmow_mail_from_address($email){
return '[email protected]';
}
add_filter('wp_mail_from_name', 'kmow_mail_from_name');
function kmow_mail_from_name($from_name){
return "KMOW Web Site";
}
@dgoze
dgoze / functions.php
Created May 26, 2020 00:41 — forked from BODA82/functions.php
Custom WordPress Login Page
<?php
/********************************************************************************************
Example for customizing the WordPress login screen using your theme's functions.php file.
For @halo-diehard on wordpress.org forum:
https://wordpress.org/support/topic/codex-unclear-regarding-custom-login-page/
Relevant CODEX doc:
https://codex.wordpress.org/Customizing_the_Login_Form
*******************************************************************************************/
@dgoze
dgoze / acf-change-file-upload-directory.php
Created May 26, 2020 00:43 — forked from BODA82/acf-change-file-upload-directory.php
Change the upload directory of Advanced Custom Fields file upload field.
<?php
// ACF upload prefilter
function gist_acf_upload_dir_prefilter($errors, $file, $field) {
// Only allow editors and admins, change capability as you see fit
if( !current_user_can('edit_pages') ) {
$errors[] = 'Only Editors and Administrators may upload attachments';
}
// This filter changes directory just for item being uploaded