PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Verschiedene Seiten, verschiedene Sidebars - Wordpress
Beitrag
<blockquote data-quote="FrostAgent" data-source="post: 1930911"><p><strong>AW: Verschiedene Seiten, verschiedene Sidebars - Wordpress</strong></p><p></p><p>Hatte die Datei falsch hochgeladen, nun wird mir auch das Seitentemplate zur Auswahl angeboten.</p><p></p><p>Das Problem, dass ein anderes Menü als gewünscht erscheint besteht dennoch.</p><p></p><p>Hier ist meine functions.php, den ersten Teil hatte ich für die sidebars eingefügt, wobei man dort sich etwas ändern könnte, wenn ich die beiden sidebar.php gar nicht mehr benötige.</p><p></p><p>[php]<?php</p><p>function firsttec_widgets_init() {</p><p> register_sidebar( array( </p><p> 'id' => 'left-sidebar', </p><p> 'name' => __( 'Left Sidebar', $text_domain ), </p><p> 'description' => __( 'This is the left sidebar.', $text_domain ),</p><p> 'before_widget' => '<li id="%1$s" class="widget %2$s">', </p><p> 'after_widget' => '</li>', </p><p> 'before_title' => '<h2 class="widgettitle">', </p><p> 'after_title' => '</h2>', </p><p>) );</p><p> register_sidebar( array( </p><p> 'id' => 'kontakt-sidebar', </p><p> 'name' => __( 'kontakt Sidebar', $text_domain ), </p><p> 'description' => __( 'This is the kontakt sidebar.', $text_domain ),</p><p> 'before_widget' => '<li id="%1$s" class="widget %2$s">', </p><p> 'after_widget' => '</li>', </p><p> 'before_title' => '<h2 class="widgettitle">', </p><p> 'after_title' => '</h2>', </p><p>) );</p><p>}</p><p>add_action( 'widgets_init', 'firsttec_widgets_init' );</p><p></p><p>// ===========</p><p>// = Sidebar =</p><p>// ===========</p><p>if ( function_exists('register_sidebar') )</p><p> register_sidebar();</p><p></p><p>// ====================================</p><p>// = WordPress 2.9+ Thumbnail Support =</p><p>// ====================================</p><p>add_theme_support( 'post-thumbnails' );</p><p>set_post_thumbnail_size( 305, 9999 ); // 305 pixels wide by 380 pixels tall, set last parameter to true for hard crop mode</p><p>add_image_size( 'background', 305, 9999 ); // Set thumbnail size</p><p></p><p>// ===========================</p><p>// = WordPress 3.0+ Nav Menu =</p><p>// ===========================</p><p>register_nav_menus(</p><p> array(</p><p> 'custom-menu'=>__('Custom menu'),</p><p> )</p><p>);</p><p>function custom_menu(){</p><p> wp_list_pages('title_li=&depth=1');</p><p>}</p><p></p><p>// ==================================</p><p>// = WP 3.0 Custom Background Setup =</p><p>// ==================================</p><p>if ( function_exists( 'add_custom_background' ) )</p><p> { add_custom_background(); }</p><p></p><p></p><p>// =========================</p><p>// = Change excerpt lenght =</p><p>// =========================</p><p>add_filter('excerpt_length', 'my_excerpt_length');</p><p>function my_excerpt_length($length) {</p><p>return get_option('imbalance_excln'); }</p><p></p><p>// =================================</p><p>// = Change default excerpt symbol =</p><p>// =================================</p><p>function imbalance_excerpt($text) { return str_replace('[...]', '...', $text); } add_filter('the_excerpt', 'imbalance_excerpt');</p><p></p><p></p><p>// =================================</p><p>// = Add comment callback function =</p><p>// =================================</p><p>function imbalance_comments($comment, $args, $depth) {</p><p> $default = urlencode(get_bloginfo('template_directory') . '/images/default-avatar.png');</p><p> $GLOBALS['comment'] = $comment; ?></p><p> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"></p><p> <div id="comment-<?php comment_ID(); ?>"></p><p> <div class="comment-author vcard"></p><p> <?php echo get_avatar($comment,$size='55', $default ); ?></p><p> <?php printf(__('<cite class="fn">%s</cite> <span class="says">wrote:</span>'), get_comment_author_link()) ?></p><p> </div></p><p> <?php if ($comment->comment_approved == '0') : ?></p><p> <em><?php _e('Your comment is awaiting moderation.') ?></em></p><p> <br /></p><p> <?php endif; ?></p><p> </p><p> <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','') ?></div></p><p> </p><p> <?php comment_text() ?></p><p></p><p> <div class="reply"></p><p> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?></p><p> </div></p><p> </div></p><p><?php</p><p>}</p><p></p><p></p><p>// ==========================</p><p>// = Include Photo-Galleria =</p><p>// ==========================</p><p>if ( get_option('imbalance_gallery_off') == 'checked') { /* do nothing */ } else { include TEMPLATEPATH . '/js/photo-galleria/photo-galleria.php'; } </p><p></p><p> </p><p></p><p>// ==========================</p><p>// = Include Twitter widget =</p><p>// ==========================</p><p>include TEMPLATEPATH . '/js/twitter/twitter.php';</p><p></p><p></p><p></p><p>// ====================</p><p>// = Add options page =</p><p>// ====================</p><p>function themeoptions_admin_menu()</p><p>{</p><p> // here's where we add our theme options page link to the dashboard sidebar</p><p> add_theme_page("Theme Options", "Theme Options", 'edit_themes', basename(__FILE__), 'themeoptions_page');</p><p>}</p><p></p><p>function themeoptions_page()</p><p>{</p><p> if ( $_POST['update_themeoptions'] == 'true' ) { themeoptions_update(); } //check options update</p><p> // here's the main function that will generate our options page</p><p> ?></p><p> <div class="wrap"></p><p> <div id="icon-themes" class="icon32"><br /></div></p><p> <h2>IMBALANCE Theme Options</h2></p><p></p><p> <form method="POST" action=""></p><p> <input type="hidden" name="update_themeoptions" value="true" /></p><p></p><p> <h3>Your social links</h3></p><p> </p><p> </p><p><table width="90%" border="0"></p><p> <tr></p><p> <td valign="top" width="50%"><p><label for="fbkurl"><strong>Facebook URL</strong></label><br /><input type="text" name="fbkurl" id="fbkurl" size="32" value="<?php echo get_option('imbalance_fbkurl'); ?>"/></p><p><small><strong>example:</strong><br /><em>http://www.facebook.com/wpshower</em></small></p></td></p><p> <td valign="top"width="50%"><p><label for="twturl"><strong>Twitter URL</strong></label><br /><input type="text" name="twturl" id="twturl" size="32" value="<?php echo get_option('imbalance_twturl'); ?>"/></p><p><small><strong>example:</strong><br /><em>http://twitter.com/wpshower</em></small></p></p><p></td></p><p> </tr></p><p></table></p><p></p><p> <h3>Custom logo</h3></p><p> </p><p> </p><p><table width="90%" border="0"></p><p> <tr></p><p> <td valign="top" width="50%"><p><label for="custom_logo"><strong>URL to your custom logo</strong></label><br /><input type="text" name="custom_logo" id="custom_logo" size="32" value="<?php echo get_option('imbalance_custom_logo'); ?>"/></p><p><small><strong>Usage:</strong><br /><em><a href="<?php bloginfo("url"); ?>/wp-admin/media-new.php">Upload your logo</a> (461 x 70px) using WordPress Media Library and insert its URL here</em></small></p></td></p><p> <td valign="top"width="50%"><p></p><p> <?php </p><p> ob_start();</p><p> ob_implicit_flush(0);</p><p> echo get_option('imbalance_custom_logo'); </p><p> $my_logo = ob_get_contents();</p><p> ob_end_clean();</p><p> if (</p><p> $my_logo == ''</p><p> ): ?></p><p> <a href="<?php bloginfo("url"); ?>/"></p><p> <img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>"></a></p><p> <?php else: ?></p><p> <a href="<?php bloginfo("url"); ?>/"><img src="<?php echo get_option('imbalance_custom_logo'); ?>"></a> </p><p> <?php endif ?></p><p> </p></p><p></td></p><p> </tr></p><p></table></p><p></p><p> <h3>Advanced options</h3></p><p> </p><p> </p><p><table width="90%" border="0"></p><p><tr></p><p> <td valign="top" width="50%"><p><label for="excln"><strong>Excerpt lenght (in words)</strong></label><br /><input type="text" name="excln" id="excln" size="32" value="<?php echo get_option('imbalance_excln'); ?>"/><p><small><strong>Dafault value:</strong><em>35<br />- clean the field to disable excerpt completely<br />- automatically disabled if advanced-excerpt plugin is installed</em></small></p></p><p> </td></p><p></p><p> <td valign="top"width="50%"></p><p> <p><input type="checkbox" name="gallery_off" id="gallery_off" <?php echo get_option('imbalance_gallery_off'); ?> /></p><p> <label for="gallery_off"><strong>Disable jQuery Gallery?</strong><br /></label></p><p> </p></p><p> <p><small><em>Select the checkbox to disable jQuery Photo-Galleria<br />on your posts and pages in favour of WordPress photo gallery</em></small></p></p><p> <br /></p><p> <p><input type="checkbox" name="sidebar_off" id="sidebar_off" <?php echo get_option('imbalance_sidebar_off'); ?> /></p><p> <label for="sidebar_off"><strong>Disable Featured Posts on top of Sidebar?</strong><br /></label></p></p><p> <p><small><em>Select the checkbox to disable featured posts display on top of your sidebar</em></small></p> </p><p> </td></p><p></p><p> </tr></p><p></table></p><p> </p><p> </p><p> </p><p> <p><input type="submit" name="search" value="Update Options" class="button button-primary" /></p></p><p> </form></p><p></p><p> </div></p><p> <?php</p><p>}</p><p></p><p>add_action('admin_menu', 'themeoptions_admin_menu');</p><p></p><p></p><p></p><p>// Update options function</p><p></p><p>function themeoptions_update()</p><p>{</p><p> // this is where validation would go</p><p> update_option('imbalance_fbkurl', $_POST['fbkurl']);</p><p> update_option('imbalance_twturl', $_POST['twturl']);</p><p> update_option('imbalance_excln', $_POST['excln']);</p><p> update_option('imbalance_custom_logo', $_POST['custom_logo']);</p><p> if ($_POST['gallery_off']=='on') { $display = 'checked'; } else { $display = ''; }</p><p> update_option('imbalance_gallery_off', $display);</p><p> if ($_POST['sidebar_off']=='on') { $display = 'checked'; } else { $display = ''; }</p><p> update_option('imbalance_sidebar_off', $display);</p><p></p><p>}</p><p>?>[/php]</p></blockquote><p></p>
[QUOTE="FrostAgent, post: 1930911"] [b]AW: Verschiedene Seiten, verschiedene Sidebars - Wordpress[/b] Hatte die Datei falsch hochgeladen, nun wird mir auch das Seitentemplate zur Auswahl angeboten. Das Problem, dass ein anderes Menü als gewünscht erscheint besteht dennoch. Hier ist meine functions.php, den ersten Teil hatte ich für die sidebars eingefügt, wobei man dort sich etwas ändern könnte, wenn ich die beiden sidebar.php gar nicht mehr benötige. [php]<?php function firsttec_widgets_init() { register_sidebar( array( 'id' => 'left-sidebar', 'name' => __( 'Left Sidebar', $text_domain ), 'description' => __( 'This is the left sidebar.', $text_domain ), 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'id' => 'kontakt-sidebar', 'name' => __( 'kontakt Sidebar', $text_domain ), 'description' => __( 'This is the kontakt sidebar.', $text_domain ), 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'firsttec_widgets_init' ); // =========== // = Sidebar = // =========== if ( function_exists('register_sidebar') ) register_sidebar(); // ==================================== // = WordPress 2.9+ Thumbnail Support = // ==================================== add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 305, 9999 ); // 305 pixels wide by 380 pixels tall, set last parameter to true for hard crop mode add_image_size( 'background', 305, 9999 ); // Set thumbnail size // =========================== // = WordPress 3.0+ Nav Menu = // =========================== register_nav_menus( array( 'custom-menu'=>__('Custom menu'), ) ); function custom_menu(){ wp_list_pages('title_li=&depth=1'); } // ================================== // = WP 3.0 Custom Background Setup = // ================================== if ( function_exists( 'add_custom_background' ) ) { add_custom_background(); } // ========================= // = Change excerpt lenght = // ========================= add_filter('excerpt_length', 'my_excerpt_length'); function my_excerpt_length($length) { return get_option('imbalance_excln'); } // ================================= // = Change default excerpt symbol = // ================================= function imbalance_excerpt($text) { return str_replace('[...]', '...', $text); } add_filter('the_excerpt', 'imbalance_excerpt'); // ================================= // = Add comment callback function = // ================================= function imbalance_comments($comment, $args, $depth) { $default = urlencode(get_bloginfo('template_directory') . '/images/default-avatar.png'); $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <?php echo get_avatar($comment,$size='55', $default ); ?> <?php printf(__('<cite class="fn">%s</cite> <span class="says">wrote:</span>'), get_comment_author_link()) ?> </div> <?php if ($comment->comment_approved == '0') : ?> <em><?php _e('Your comment is awaiting moderation.') ?></em> <br /> <?php endif; ?> <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php 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('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div> </div> <?php } // ========================== // = Include Photo-Galleria = // ========================== if ( get_option('imbalance_gallery_off') == 'checked') { /* do nothing */ } else { include TEMPLATEPATH . '/js/photo-galleria/photo-galleria.php'; } // ========================== // = Include Twitter widget = // ========================== include TEMPLATEPATH . '/js/twitter/twitter.php'; // ==================== // = Add options page = // ==================== function themeoptions_admin_menu() { // here's where we add our theme options page link to the dashboard sidebar add_theme_page("Theme Options", "Theme Options", 'edit_themes', basename(__FILE__), 'themeoptions_page'); } function themeoptions_page() { if ( $_POST['update_themeoptions'] == 'true' ) { themeoptions_update(); } //check options update // here's the main function that will generate our options page ?> <div class="wrap"> <div id="icon-themes" class="icon32"><br /></div> <h2>IMBALANCE Theme Options</h2> <form method="POST" action=""> <input type="hidden" name="update_themeoptions" value="true" /> <h3>Your social links</h3> <table width="90%" border="0"> <tr> <td valign="top" width="50%"><p><label for="fbkurl"><strong>Facebook URL</strong></label><br /><input type="text" name="fbkurl" id="fbkurl" size="32" value="<?php echo get_option('imbalance_fbkurl'); ?>"/></p><p><small><strong>example:</strong><br /><em>http://www.facebook.com/wpshower</em></small></p></td> <td valign="top"width="50%"><p><label for="twturl"><strong>Twitter URL</strong></label><br /><input type="text" name="twturl" id="twturl" size="32" value="<?php echo get_option('imbalance_twturl'); ?>"/></p><p><small><strong>example:</strong><br /><em>http://twitter.com/wpshower</em></small></p> </td> </tr> </table> <h3>Custom logo</h3> <table width="90%" border="0"> <tr> <td valign="top" width="50%"><p><label for="custom_logo"><strong>URL to your custom logo</strong></label><br /><input type="text" name="custom_logo" id="custom_logo" size="32" value="<?php echo get_option('imbalance_custom_logo'); ?>"/></p><p><small><strong>Usage:</strong><br /><em><a href="<?php bloginfo("url"); ?>/wp-admin/media-new.php">Upload your logo</a> (461 x 70px) using WordPress Media Library and insert its URL here</em></small></p></td> <td valign="top"width="50%"><p> <?php ob_start(); ob_implicit_flush(0); echo get_option('imbalance_custom_logo'); $my_logo = ob_get_contents(); ob_end_clean(); if ( $my_logo == '' ): ?> <a href="<?php bloginfo("url"); ?>/"> <img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>"></a> <?php else: ?> <a href="<?php bloginfo("url"); ?>/"><img src="<?php echo get_option('imbalance_custom_logo'); ?>"></a> <?php endif ?> </p> </td> </tr> </table> <h3>Advanced options</h3> <table width="90%" border="0"> <tr> <td valign="top" width="50%"><p><label for="excln"><strong>Excerpt lenght (in words)</strong></label><br /><input type="text" name="excln" id="excln" size="32" value="<?php echo get_option('imbalance_excln'); ?>"/><p><small><strong>Dafault value:</strong><em>35<br />- clean the field to disable excerpt completely<br />- automatically disabled if advanced-excerpt plugin is installed</em></small></p> </td> <td valign="top"width="50%"> <p><input type="checkbox" name="gallery_off" id="gallery_off" <?php echo get_option('imbalance_gallery_off'); ?> /> <label for="gallery_off"><strong>Disable jQuery Gallery?</strong><br /></label> </p> <p><small><em>Select the checkbox to disable jQuery Photo-Galleria<br />on your posts and pages in favour of WordPress photo gallery</em></small></p> <br /> <p><input type="checkbox" name="sidebar_off" id="sidebar_off" <?php echo get_option('imbalance_sidebar_off'); ?> /> <label for="sidebar_off"><strong>Disable Featured Posts on top of Sidebar?</strong><br /></label></p> <p><small><em>Select the checkbox to disable featured posts display on top of your sidebar</em></small></p> </td> </tr> </table> <p><input type="submit" name="search" value="Update Options" class="button button-primary" /></p> </form> </div> <?php } add_action('admin_menu', 'themeoptions_admin_menu'); // Update options function function themeoptions_update() { // this is where validation would go update_option('imbalance_fbkurl', $_POST['fbkurl']); update_option('imbalance_twturl', $_POST['twturl']); update_option('imbalance_excln', $_POST['excln']); update_option('imbalance_custom_logo', $_POST['custom_logo']); if ($_POST['gallery_off']=='on') { $display = 'checked'; } else { $display = ''; } update_option('imbalance_gallery_off', $display); if ($_POST['sidebar_off']=='on') { $display = 'checked'; } else { $display = ''; } update_option('imbalance_sidebar_off', $display); } ?>[/php] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ★ = 12, ◇ = 4 und die Hälfte von ★ zu ◇ addiert wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Verschiedene Seiten, verschiedene Sidebars - Wordpress
Oben