Skip to content

Instantly share code, notes, and snippets.

View flx9000's full-sized avatar

icantouchthis flx9000

  • inter webz
View GitHub Profile
<!-- Line break in WordPress meta box text area: the PHP way -->
<?php echo nl2br( esc_html( get_post_meta( get_the_ID(), 'my-meta-field', true) ) ); ?>
@flx9000
flx9000 / .htaccess
Created October 6, 2014 11:40
Remove .php extension with .htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
<?php
/**
* Example filter to add text style to TinyMCE filter with Mark's "MRW TinyMCE Mods" plugin
*
* Adds a "Text Styles" submenu to the "Formats" dropdown
*
* This would go in a functions.php file or mu-plugin so you don't have to modify the original plugin.
*
* $styles array Contains arrays of style_format arguments to define styles.
* Note: Should be an "array of arrays"
@flx9000
flx9000 / functions.php
Last active August 29, 2015 14:01
Wordpress Adding more User Fields with Dropdown & Radiobuttons ( calling with wp_user_box(); )
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * WP User Felder * * * * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
<h3>Alumni Informationen</h3>
@flx9000
flx9000 / main.js
Created April 2, 2014 06:52
full screen element height
$('#yoholder').css("height", $('#yoscroll').height());
$('.checkyo').css("top", $(window).height());
window.onresize = function() {
$('#yoholder').css("height", $('#yoscroll').height());
$('.checkyo').css("top", $(window).height());
}
@flx9000
flx9000 / content-single.php
Created November 8, 2013 11:38
WP Linking to next post ( whole content linked )
<?php
if (in_category ('news')) {
echo '<div class="content">';
echo the_content();
echo '</div>';
} else {
$supercontent = get_the_content();
@flx9000
flx9000 / functions.php
Last active December 19, 2015 13:59
custom excerpt with formatting: <? the_excerpt(); ?>
function custom_wp_trim_excerpt($text) {
$raw_excerpt = $text;
if ( '' == $text ) {
//Retrieve the post content.
$text = get_the_content('');
//Delete all shortcode tags from the content.
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
@flx9000
flx9000 / .htaccess
Created June 12, 2013 10:43
#hash links and nice urls, internal working links: rewrite domain.com/#name to domain.com/name
RewriteEngine On
RewriteRule ^((?:[a-z0-9-_]+/){0,7})([a-z0-9-_]+)$ /#$2 [NE,R,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} !ajax
RewriteRule ^(.*)$ /#/$1 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
@flx9000
flx9000 / jquery
Last active December 18, 2015 08:48
open hidden elements with url-hash http://domain.com/#beispiel
$(document).ready(function() {
var hash = window.location.hash;
$(hash).delay(1000).slideDown(700, function() {
$('html,body').animate({scrollTop:$(this).offset().top-30}, 1000, 'easeInOutExpo');
});
});
@flx9000
flx9000 / gist:5721398
Created June 6, 2013 13:15
wordpress stripped menu ( just <a>linktitle</a> )
<?php
$menuParameters = array(
'menu' => 'unternehmen',
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0,
);
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
?>