Skip to content

Instantly share code, notes, and snippets.

View sasqik's full-sized avatar

PAGE Interactive sasqik

View GitHub Profile
@kasparsd
kasparsd / custom-post-taxonomy-permalinks.php
Created June 13, 2012 15:47
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
@ms-studio
ms-studio / wp-gallery-shortcode-override.php
Last active April 17, 2019 14:13
an override of the default WP gallery shortcote
@yaronguez
yaronguez / ACF Country List
Created February 17, 2015 01:37
Country list formatted for Advanced Custom Fields select dropdown
afghanistan : Afghanistan
albania : Albania
algeria : Algeria
american_samoa : American Samoa
andorra : Andorra
angola : Angola
anguilla : Anguilla
antigua_and_barbuda : Antigua and Barbuda
argentina : Argentina
armenia : Armenia
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Last active April 12, 2024 12:38
Wordpress - Password protect a custom post type programmatically
<?php
/**
* Password protects a custom post type programmatically.
*
* @param $post
*/
add_action( 'the_post', function( $post ){
if ( $post->post_type != 'post' ) {
return;
}
@mattradford
mattradford / restrict_acf_menu.php
Created June 11, 2018 09:30
Restrict ACF menu visibility based on the user's email domain
/**
* Restrict ACF Custom Fields menu to example.com domains only
*/
function td_acf_hide_admin() {
$current_user = wp_get_current_user();
$domain = substr(
strrchr(
$current_user->user_email,
@helgatheviking
helgatheviking / wordpress-add-custom-menu-meta-fields.php
Created February 26, 2020 02:06
Add an example custom meta field to WordPress menu and display text on front-end (Requires WP5.4)
<?php
/**
* Add custom fields to menu item
*
* This will allow us to play nicely with any other plugin that is adding the same hook
*
* @param int $item_id
* @params obj $item - the menu item
* @params array $args