Skip to content

Instantly share code, notes, and snippets.

View tonydjukic's full-sized avatar
🏠
Working from home

Tony Djukic tonydjukic

🏠
Working from home
View GitHub Profile
#ADD THIS TO .HTACCESS FILE TO FIX FONT AWESOME CROSS DOMAIN DISPLAY ISSUE
<IfModule mod_headers.c>
<FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
@tonydjukic
tonydjukic / nested-wp-query-arguments.php
Last active February 4, 2018 22:25
Nested WP Query Arguments
<?php
$sitesuper_notification_args = array(
'post_type' => 'cs_submissions',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'DESC',
//The meta_query will list any customer satisfaction survey responses that answered a question negatively or below an accepted threshold.
//It also only lists those items that have NOT yet been flagged as 'resolved'.
'meta_query' => array(
@tonydjukic
tonydjukic / hide-polldaddy-menu-items.php
Created November 6, 2017 18:46
Hide Automattic's Poll Daddy plugin's menu items from a specific user role. Using the normal remove_menu_page() and remove_submenu_page() doesn't work in this instance and I couldn't find a solid solution online, so here's what I came up with after digging into the Poll Daddy plugin itself.
<?php
function remove_menus_for_USER_ROLE () {
if ( is_user_logged_in() && current_user_can('USER_ROLE') ) {
global $menu;
$restricted = array(
//__( 'Settings' ), //Uncomment if you still have POLLS showing up under settings, it really depends on the user role you're targeting.
__( 'Feedback' ),
__( 'Polls' ),
__( 'Ratings' ),
);
@tonydjukic
tonydjukic / wp-if-admin.php
Created January 23, 2017 21:17
WordPress if ADMIN User
<?php global $user_ID; if( $user_ID ) : ?>
<?php if( current_user_can('level_10') ) : ?>
<!--do something-->
<?php else : ?>
<!--//do something else-->
<?php endif; ?>
<?php endif; ?>
@tonydjukic
tonydjukic / CONCAT & UPDATE MySQL Tables.txt
Last active January 12, 2017 21:23
Search for queries in WP tables and concatenate a string onto them in one fell swoop.
UPDATE `xxx_postmeta` SET `meta_value` = CONCAT(meta_value,'string-to-add') WHERE `xxx_postmeta`.`meta_key` = 'meta-key-value' AND `meta_value` LIKE '%xxx%';
@tonydjukic
tonydjukic / htaccess-compression-caching.txt
Last active May 7, 2019 12:54
Enable GZIP Compression and Expire Headers with .htaccess
# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
@tonydjukic
tonydjukic / Azure-IIS-web-config.txt
Last active October 20, 2016 18:08
Settings to add to Windows Azure IIS web.config file to enable GZIP Compression & Browser Caching
<!-- ENABLE GZIP COMPRESSION, BROWSER CACHING & CORRECTING .woff FONT 404 ERRORS ON IIS SERVERS -->
<!-- FOR COMPRESSION -->
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
<httpCompression>
<dynamicTypes>
<clear />
<add enabled="true" mimeType="text/*"/>
<add enabled="true" mimeType="message/*"/>
@tonydjukic
tonydjukic / copyright.php
Created September 28, 2016 02:28
Simple copyright snippet for WordPress' footer.php files.