Skip to content

Instantly share code, notes, and snippets.

@pixelstrolch
pixelstrolch / change_login_logo.php
Created Nov 30, 2012
Ersetze das WordPress Logo auf der Login-Seite mit deinem eigenem Logo.
View change_login_logo.php
function custom_login_logo() {
echo
'<style type="text/css">
h1 a {
background-image:url('.get_site_url().'/wp-content/uploads/login.png) !important;
background-size: 100% auto !important;
margin-left: 8px !important;
width: 312px !important;
}
</style>';
@pixelstrolch
pixelstrolch / moving_wordpress
Created Jun 13, 2013
Moving WordPress: 1. Replacing WordPress’ base URL path. 2. Update the GUID that controls WordPress’ translating paths and post locations. 3. Update the URL paths in the content. 4. Update the URLs in the meta data of posts, such as attachments.
View moving_wordpress
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost:8888/wordpress', 'http://www.YOUR_SITE_URL.com') WHERE option_name = 'home' OR option_name = 'siteurl';
@pixelstrolch
pixelstrolch / excerpt_readmore.php
Last active Dec 26, 2015
Custom excerpt read more link
View excerpt_readmore.php
<?php function excerpt_readmore($more) {
return '... <a href="'. get_permalink($post->ID) . '" class="readmore">' . 'Read More' . '</a>';
}
add_filter('excerpt_more', 'excerpt_readmore'); ?>
@pixelstrolch
pixelstrolch / Deaktiviere WP Galerie head styles
Created Dec 27, 2013
Styling von WordPress-Galerien über die functions.php ausschalten
View Deaktiviere WP Galerie head styles
add_filter( 'use_default_gallery_style', '__return_false' );
@pixelstrolch
pixelstrolch / wp_auto_twitter_links.php
Last active Jan 3, 2016
Automatische Verlinkung von Twitter-Benutzernamen.
View wp_auto_twitter_links.php
@pixelstrolch
pixelstrolch / back-to-top.js
Created Jan 22, 2014
Button um mit einer Animation an den Seitenanfang zu gelangen. Benötigt jQuery.
View back-to-top.js
// Back To Top
$('a.top').click(function(){
$(document.body).animate({scrollTop : 0},800);
return false;
});
//Create an anchor tag
<a class=”top” href=#>Back to top</a>
@pixelstrolch
pixelstrolch / bilder-geladen.js
Created Jan 22, 2014
Überprüft ob Bilder geladen wurden. Benötigt jQuery
View bilder-geladen.js
$(‘img’).load(function() {
console.log(‘image load successful’);
});
@pixelstrolch
pixelstrolch / wp_ad_after_2nd_paragraph.php
Created Feb 17, 2014
WordPress Snippet um Werbung, z.B. AdSense, nach dem zweiten Absatz eines Posts einzublenden. Source: http://www.wpbeginner.com/wp-tutorials/how-to-insert-ads-within-your-post-content-in-wordpress/
View wp_ad_after_2nd_paragraph.php
<?php
//Insert ads after second paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
$ad_code = '<div>Ads code goes here</div>';
@pixelstrolch
pixelstrolch / wp_neue_bildformate_media_uploader.php
Created Feb 18, 2014
WordPress Snippet (für functions.php oder Plugin). Werden zu den Standardgrössen zusätzliche Bildformate definiert, werden diese nicht im Media-Uploader angezeigt. Blogartikel: http://www.pixelstrol.ch/blog/2014/02/wp-snippet-alle-bildgroessen-im-medien-uploader-anzeigen/ Quellen: http://wp-snippets.com/show-custom-image-sizes-in-admin-media-upl…
View wp_neue_bildformate_media_uploader.php
<?php
function show_image_sizes( $sizes ) {
$new_sizes = array();
$added_sizes = get_intermediate_image_sizes();
// $added_sizes is an indexed array, therefore need to convert it
// to associative array, using $value for $key and $value
foreach( $added_sizes as $key => $value) {
$new_sizes[$value] = $value;
@pixelstrolch
pixelstrolch / wp_excerpt_weiterlesen_link.php
Last active Aug 29, 2015
WordPress Snippet (für functions.php oder Plugin). Dieses Snippet fügt dem Auszug (Excerpt) in jedem Fall ein Weiterlesen-Link hinzu. Quelle: http://www.transformationpowertools.com/wordpress/read-more-on-all-excerpts-in-wordpress
View wp_excerpt_weiterlesen_link.php