15 Hacks zur Aufmotzung der WordPress Website

Trotz der Großartigkeit von WordPress PlugIns gibt es Situationen, wenn PlugIns unnötige Kopfschmerzen für Web Masters sind. Die Hauptsache ist jedes PlugIn eine Menge Updates bringt und das kann irgendwann die WordPress Website brocken. Falls Du PHP-Grundkenntnisse (Du kannst also den Teil des Codes kopieren und einfügen) oder Erfahrungen mit Webentwicklung hast, würde es für Dich interessant sein, ein paar kleinen Änderungen in der WordPress Website selbst machen. Dafür haben wir für Dich ein paar kurze und interessante WordPress Hacks, die die WPbasierte-Website ohne Software von dritten Anbietern verbessern, vorbereitet. Es gibt viele einfache Funktionen, die kein Plugin benötigen. Das ist die Seitennummerierung, der Kontaktformular, Buttons für Soziale Netzwerke usw. Auf jeden Fall kritisiert dieser Beitrag nicht die Existenz und die Nutzung von WordPress PlugIns – es ist nur die Alternative, die Du nutzen kannst. Dieser Beitrag ist für den suchenden Seelen, die einfache und interessante Lösungen suchen, um die Funktionalität von WordPress Themes zu verbessern.

WordPress: Wie man eine Paginierung ohne Plugin erstellt

wordpress-theme-hacks

* * *

Beliebteste Beiträge In WordPress ohne Plugin anzeigen

wordpress-theme-hacks

* * *

Wie man Live-Kommentar Vorschau zum Kommentarbereich ohne Plugin hinzufügt

wordpress-theme-hacks

* * *

Retweets-Anzahl in WordPress ohne Plugin zeigen

wordpress-theme-hacks
* * *

Breadcrumbs ohne Plugin

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
function the_breadcrumb() {
		echo '<ul id="crumbs">';
	if (!is_home()) {
		echo '<li><a href="';
		echo get_option('home');
		echo '">';
		echo 'Home';
		echo "</a></li>";
		if (is_category() || is_single()) {
			echo '<li>';
			the_category(' </li><li> ');
			if (is_single()) {
				echo "</li><li>";
				the_title();
				echo '</li>';
			}
		} elseif (is_page()) {
			echo '<li>';
			echo the_title();
			echo '</li>';
		}
	}
	elseif (is_tag()) {single_tag_title();}
	elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';}
	elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';}
	elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';}
	elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';}
	elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "<li>Blog Archives"; echo'</li>';}
	elseif (is_search()) {echo"<li>Search Results"; echo'</li>';}
	echo '</ul>';
}
?>

* * *

Top Kommentatoren In WordPress Ohne Plugin zeigen

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function top_comment_authors($amount = 5){

	global $wpdb;

	$results = $wpdb->get_results('
		SELECT
			COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
		FROM
			'.$wpdb->comments.'
		WHERE
			comment_author_email != "" AND comment_type = "" AND comment_approved = 1
		GROUP BY
			comment_author_email
		ORDER BY
			comments_count DESC, comment_author ASC
		LIMIT '.$amount

	);

	$output = "<ul>";
	foreach($results as $result){
		$output .= "<li>".$result->comment_author."</li>";
	}
	$output .= "</ul>";

	echo $output;

}

* * *

AdminMenü Elementen ja nach Username beschränken

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function remove_menus()
{
    global $menu;
    global $current_user;
    get_currentuserinfo();

    if($current_user->user_login == 'username')
    {
        $restricted = array(__('Posts'),
                            __('Media'),
                            __('Links'),
                            __('Pages'),
                            __('Comments'),
                            __('Appearance'),
                            __('Plugins'),
                            __('Users'),
                            __('Tools'),
                            __('Settings')
        );
        end ($menu);
        while (prev($menu)){
            $value = explode(' ',$menu[key($menu)][0]);
            if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
        }// end while

    }// end if
}
add_action('admin_menu', 'remove_menus');

* * *

Wie man WordPress Feeds zu FeedBurner ohne Plugin umleitet

1
2
3
4
5
6
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-] )?/?$ http://feeds.feedburner.com/wpbeginner [R=302,NC,L]
</IfModule>

* * *

WordPress Admin Bar kontrollieren

 1
2
3
4
5
6
7
8
9
10
11
12
function my_admin_bar_link() {
	global $wp_admin_bar;
	if ( !is_super_admin() || !is_admin_bar_showing() )
		return;
	$wp_admin_bar->add_menu( array(
	'id' => 'diww',
	'parent' => 'my-blogs',
	'title' => __( 'Do It With WordPress'),
	'href' => admin_url( 'http://www.doitwithwp.com/wp-admin.php' )
	) );
}
add_action('admin_bar_menu', 'my_admin_bar_link');

* * *

Wie man Google Maps in WordPress einfügt

 1
2
3
4
5
6
7
8
9
10
//Google Maps Shortcode
function do_googleMaps($atts, $content = null) {
   extract(shortcode_atts(array(
      "width" => '640',
      "height" => '480',
      "src" => ''
   ), $atts));
   return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'&amp;output=embed" ></iframe>';
}
add_shortcode("googlemap", "do_googleMaps");

* * *

Aktuelle Beitröge mit Thumbnails In WordPress ohne Plugin

wordpress-hacks

* * *

Beitrag-Spalten löschen

 1
2
3
4
5
function remove_post_columns($defaults) {
  unset($defaults['comments']);
  return $defaults;
}
add_filter('manage_posts_columns', 'remove_post_columns');

* * *

Wie man Perfekte WordPress Title Tags ohne Plugin generiert

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<title>

<?php 

if (function_exists('is_tag') && is_tag()) { 

	echo 'Tag Archive for &quot;'.$tag.'&quot; - '; 

} elseif (is_archive()) { 

	wp_title(''); echo ' Archive - '; 

} elseif (is_search()) { 

	echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; 

} elseif (!(is_404()) && (is_single()) || (is_page())) { 

	wp_title(''); echo ' - '; 

} elseif (is_404()) {

	echo 'Not Found - '; 

}
bloginfo('name'); 

?>

</title>

* * *

Zufällige WordPress Zitaten ohne Plugin

wordpress-hacks

* * *

Social-Links zu WordPress ohne Plugin platzieren

wordpress-hacks

* * *


Nataly Ohlsen

Ist Expertin auf dem Gebiet Content-Marketing bei TemplateMonster. Nataly auf Facebook.