Skip to content

Instantly share code, notes, and snippets.

View UVLabs's full-sized avatar
🏠
Probably coding

Uriahs Victor UVLabs

🏠
Probably coding
View GitHub Profile
/**
* Change styles applied to one page
*
* Uses 'wp' to run after WP class object so page content is available
*/
function sv_hide_header_footer_for_page() {
if( is_page( 2576 ) ) {
?> <style>
header#header,
imports system.io
ComboBox1.Items.AddRange(File.ReadAllLines(filepath))
@UVLabs
UVLabs / vertical_align_text.css
Last active March 26, 2017 06:44
Verical align text in any element. Make parent element display: table, then make item display: table-cell and vertical-align: middle
#instructor .num {
display: table;
font-size: 20px;
font-weight: bold;
color: white;
line-height: 24px;
height: 240px;
width: 240px;
text-align: center;
background: #dd5638;
@UVLabs
UVLabs / randomize_woocommerce_related_products.php
Created January 11, 2016 14:21
Add this snippet to your functions.php file to randomize your related products. Edit the pool size for a larger set of random products.
add_action( 'admin_init', 'redirect_non_admin_users' );
/**
* Redirect non-admin users to home page
*
* This function is attached to the 'admin_init' action hook.
*/
function redirect_non_admin_users() {
if ( ! current_user_can( 'administrator' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) {
wp_redirect( home_url() );
exit;
<?php
$myposts = get_posts(array(
'showposts' => -1,
'post_type' => 'gallery',
'tax_query' => array(
array(
'taxonomy' => 'gallery_cat',
'field' => 'slug',
'terms' => array('sunsets', 'nature'))
))
<body oncontextmenu = "return false"></body>
or
<body oncopy = "return false"></body>
@UVLabs
UVLabs / auto-css-color-change.css
Last active March 3, 2016 17:38
Automatically cycle css colors. Property used here was color for text color. Could be replaced with "background" for background color of an element.
.element{
animation: colorchange 5s linear infinite; /* animation-name followed by duration in seconds*/
/* you could also use milliseconds (ms) or something like 2.5s */
-webkit-animation: colorchange 5s linear infinite; /* Chrome and Safari */
-moz-animation: colorchange 5s linear infinite; /* Firefox */
-o-animation: colorchange 5s linear infinite; /* Opera */
}
@keyframes colorchange
@UVLabs
UVLabs / 403_forbidden_fix
Created March 24, 2016 05:25
From https://mediatemple.net/community/products/dv/204643050/making-directories-browsable-solving-403-errors This will fix 403 forbidden error on subdirectories of public_html. Add to bottom of .htaccess
Options +Indexes
@UVLabs
UVLabs / get_all_categories_on_site.php
Created April 7, 2016 21:45
Get all categories on site, whether custom post type or w/e. change parent array to '', to get all categories, including children.
$args = array(
'type' => 'post',
'child_of' => 0,
'parent' => 0,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0,
'hierarchical' => 1,
'exclude' => '',
'include' => '',