Skip to content

Instantly share code, notes, and snippets.

<?php
add_shortcode( 'shortcodename', 'display_custom_post_type' );
function display_custom_post_type(){
$args = array(
'post_type' => 'my-custom-post-type',
'post_status' => 'publish'
);
$string = '';
@ingozoell
ingozoell / wp-hide-backend-htaccess
Created May 11, 2016 18:38
WP Hide Backend (Login)
# Hide Backend
RewriteRule ^(/DIR/)?SLUG/?$ /DIR/wp-login.php [QSA,L]
var myOptions = {
...
scrollwheel: false
<?php if( wp_is_mobile() ) : ?>
,draggable: false
<?php endif; ?>
};
$(window).scroll(function(){
if ($(this).scrollTop() > 135) {
$('#task_flyout').addClass('fixed');
} else {
$('#task_flyout').removeClass('fixed');
}
});
/* equivalent to li:nth-child(1) */
.classname> li:first-child {
// your css code
}
/* equivalent to li:nth-child(2) */
.classname> li:first-child + li {
// your css code
define( 'WP_HTTP_BLOCK_EXTERNAL', TRUE );
@ingozoell
ingozoell / Remove WP Emoji.php
Last active September 22, 2017 12:37
Remove WP "Emoji" Quelle: http://fastwp.de/4903/
/**
* Remove WP "Emoji"
* https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
*
*/
function iz_remove_emoji() {
// all actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@ingozoell
ingozoell / jquery-touch-detection.js
Last active March 26, 2016 12:31
Touch detection
$(document).ready(function() {
/* https://coderwall.com/p/7mjjeg/check-if-touch-device */
//Check Mobile Devices
var checkMobile = function(){
//Check Device
var isTouch = ('ontouchstart' in document.documentElement);
//Check Device //All Touch Devices
$("#help_icon").hover(
function () {
$("#msg_div").show();
},
function () {
$("#msg_div").hide();
}
);
@ingozoell
ingozoell / wp_remove_unused_archive_pages.php
Last active August 19, 2024 02:40
WordPress: Remove unused archive Pages (tax, cat ) and redirect 404
/*
function taxonomies_redirect() {
if( is_tax('filter') ) {
wp_redirect( home_url('/fotouebersicht/'), 301 );
exit;
}
}
add_action( 'template_redirect', 'taxonomies_redirect' );
*/