Skip to content

Instantly share code, notes, and snippets.

function wpse_media_extra_column( $cols ) {
$cols["alt"] = "ALT";
return $cols;
}
function wpse_media_extra_column_value( $column_name, $id ) {
if( $column_name == 'alt' )
echo get_post_meta( $id, '_wp_attachment_image_alt', true);
}
add_filter( 'manage_media_columns', 'wpse_media_extra_column' );
add_action( 'manage_media_custom_column', 'wpse_media_extra_column_value', 10, 2 );
@ingozoell
ingozoell / remove_outline_glow.css
Created February 25, 2017 21:40
CSS remove outline/glow
.class {
outline: none !important;
border: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
<?php echo do_shortcode( $YOUR_GLOBAL_NAME['YOUR_FIELD_ID'] ); ?>
@ingozoell
ingozoell / scrollTop.js
Created February 22, 2017 10:19
scrollTop
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 70) {
$('.intro-link').fadeOut(400);
} else {
$('.intro-link').fadeIn();
}
});
});
@ingozoell
ingozoell / js_browser_detection.js
Last active February 22, 2017 17:07
Browser Detection JS – HTML Class
(function(){
var htmlTag = document.getElementsByTagName("html")[0];
if ( navigator.userAgent.indexOf("MSIE 10.0") > -1 ) {
htmlTag.className += ' ie10';
}
if ( !!navigator.userAgent.match(/Trident.*rv\:11\./) ) {
htmlTag.className += ' ie11';
}
@ingozoell
ingozoell / wp_shortcode_loop_cpt_tax.php
Created January 17, 2017 16:52
WordPress: Shortcode Loop with taxanomy
function sc_loop_highlights_lehrer() {
$args = array( 'post_type' => 'lehrer', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => array('publish'),
'tax_query' => array(
array(
'taxonomy' => 'highlights',
'field' => 'slug',
'terms' => array('ja')
)
)
);
@ingozoell
ingozoell / wp-slug-name-outside-loop.php
Last active June 5, 2017 13:23
WordPress get slug name
// Outside the loop:
<?php
$post_id = 11;
$post = get_post($post_id);
$slug = $post->post_name;
?>
/* $('a[href*="#"]:not([href="#"])').click(function() { */
$('.scroll').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000 );
return false;
@ingozoell
ingozoell / wp_widget.php
Created December 15, 2016 15:20
WordPress Widget
function shop_widgets() {
register_sidebar( array(
'name' => 'Shop – Footer 1',
'id' => 'shop-footer-1',
'before_widget' => '<div id="%1$s" class="cb-footer-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="cb-footer-widget-title"><span>',
'after_title' => '</span></h3>'
) );
@ingozoell
ingozoell / add_class_parent_element.js
Created November 13, 2016 16:56
Add class on parent element
$(this).parent().addClass('newClass');