WordPress - Themes
Version vom 18. November 2018, 12:45 Uhr von Flinh1 (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „ == Grundgerüst == ''style.css'': <nowiki> <?php /* Theme Name: Twenty Fifteen Theme URI: https://wordpress.org/themes/twentyfifteen/ Author: the WordPress…“)
Inhaltsverzeichnis
Grundgerüst
style.css:
<?php /* Theme Name: Twenty Fifteen Theme URI: https://wordpress.org/themes/twentyfifteen/ Author: the WordPress team Author URI: https://wordpress.org/ Description: Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer. Version: 1.9 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: blog, two-columns, left-sidebar, accessibility-ready, custom-background, custom-colors, custom-header, custom-logo, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready Text Domain: twentyfifteen This theme, like WordPress, is licensed under the GPL. Use it to make something cool, have fun, and share what you've learned with others. */ ?>
index.php:
<?php the_post(); the_title();
Template Tags
Conditional Tags
Schlagwörter
Schlagwörter aktivieren
Dieser Code wird in die functions.php des Themes eingefügt (wp-content/themes/<themename>/functions.php).[1]
// add tag support to pages function tags_support_all() { register_taxonomy_for_object_type('post_tag', 'page'); } // ensure all tags are included in queries function tags_support_query($wp_query) { if ($wp_query->get('tag')) $wp_query->set('post_type', 'any'); } // tag hooks add_action('init', 'tags_support_all'); add_action('pre_get_posts', 'tags_support_query');
Kommentare
-> You will need to define your custom callback function in your theme's functions.php file.
Hier kann man folgende Vorlage entnehmen:
function mytheme_comment($comment, $args, $depth) { if ( 'div' === $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; }?> <<?php echo $tag; comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID() ?>"><?php if ( 'div' != $args['style'] ) { ?> <div id="div-comment-<?php comment_ID() ?>" class="comment-body"><?php } ?> <div class="comment-author vcard"><?php if ( $args['avatar_size'] != 0 ) { echo get_avatar( $comment, $args['avatar_size'] ); } printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?> </div><?php if ( $comment->comment_approved == '0' ) { ?> <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></em><br/><?php } ?> <div class="comment-meta commentmetadata"> <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ); ?>"><?php /* translators: 1: date, 2: time */ printf( __('%1$s at %2$s'), get_comment_date(), get_comment_time() ); ?> </a><?php edit_comment_link( __( '(Edit)' ), ' ', '' ); ?> </div> <?php comment_text(); ?> <div class="reply"><?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> </div><?php if ( 'div' != $args['style'] ) : ?> </div><?php endif; }
Child Themes
Wichtig ist der Eintrag Template. Beispiel: twentyfifteen-child:
/* Theme Name: Twenty Fifteen Child Theme URI: http://example.com/twenty-fifteen-child/ Description: Twenty Fifteen Child Theme Author: John Doe Author URI: http://example.com Template: twentyfifteen Version: 1.0.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready Text Domain: twenty-fifteen-child */
Bilder
Thumbnail: 880x660 Pixel
Troubleshooting
System Status
- PHP Time Limit
zu niedrig eingestellt.
>> In wp-config.php über der Zeile mit "Happy blogging" z. B. folgende Zeile einfügen:
set_time_limit(180);
- PHP Max Input Vars
zu niedrig.
>> Im Document root eine Datei .user.ini anlegen. Hier z. B. folgenden Eintrag hinterlegen:
max_input_vars = 5000; [3]
Notizen
Mindestens notwendig:
index.php
style.css: wichtig Theme Name:
single.php: > einzelne Beiträge
Links und Quellen
|