19.11.2006, 11:38
|
#1 (permalink)
| | PostRank: 4
Registriert seit: 24.07.2005
Beiträge: 183
| Eine Kategorie auf der Startseite ausblenden Hallo,
ich suche eine Modifikation, mit der ich eine Kategorie (ID=7) auf der Startseite ausblenden kann. Mein template sieht derzeit so aus: Code: <div id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<p class="info"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/document.gif" alt="" /> <?php the_time('j. F Y, H:i \U\h\r') ?>, Autor: <?php the_author_posts_link(); ?>, in: <?php the_category(', ') ?></p><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="entry">
<?php the_content('[weiter]'); ?>
</div>
<p class="info"><?php edit_post_link('Edit','','<strong>|</strong>'); ?> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/comments.gif" alt="" /> <?php comments_popup_link('kommentieren »', '1 Kommentar »', '% Kommentare »'); ?></p>
</div>
<?php comments_template(); ?>
<?php endwhile; ?>
<p align="center"><?php next_posts_link('« Previous Entries') ?> <?php previous_posts_link('Next Entries »') ?></p>
<?php else : ?>
<h3 align="center">Not Found</h3>
<p align="center">Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>
</div>
<!-- end content-->
Kann mir da jemand eine IF-Anweisung o.ä. einbauen, damit Kategorie "7" dort nicht mit angezzeigt wird?
Ich hab mit der Suche "Kategorie ausblenden" leider keine passende Antwort auf mein Problem finden können. |
| |
19.11.2006, 12:14
|
#2 (permalink)
| | WPD-Team
Registriert seit: 20.08.2005 Ort: Berlin
Beiträge: 15.543
| Ungetestet: PHP-Code:
<div id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php if (! in_category('7')) { ?>
<div class="post" id="post-<?php the_ID(); ?>">
<p class="info"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/document.gif" alt="" /> <?php the_time('j. F Y, H:i \U\h\r') ?>, Autor: <?php the_author_posts_link(); ?>, in: <?php the_category(', ') ?></p><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="entry">
<?php the_content('[weiter]'); ?>
</div>
<p class="info"><?php edit_post_link('Edit','','<strong>|</strong>'); ?> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/comments.gif" alt="" /> <?php comments_popup_link('kommentieren »', '1 Kommentar »', '% Kommentare »'); ?></p>
</div>
<?php } ?>
<?php comments_template(); ?>
<?php endwhile; ?>
<p align="center"><?php next_posts_link('« Previous Entries') ?> <?php previous_posts_link('Next Entries »') ?></p>
<?php else : ?>
<h3 align="center">Not Found</h3>
<p align="center">Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>
</div>
<!-- end content--> |
| |
19.11.2006, 12:15
|
#3 (permalink)
| | PostRank: 4
Registriert seit: 24.07.2005
Beiträge: 183
| Funktioniert prima. Verbindlichsten Dank! |
| |
09.12.2007, 12:39
|
#4 (permalink)
| | PostRank: 1
Registriert seit: 28.11.2007
Beiträge: 34
| Habe genau das selbe Anliegen, ich will bestimmte Kategorien auf der Startseite ausblenden, mein index.php Code: PHP-Code: <?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?> <div class="entry"> <div id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><?php if(function_exists('the_ratings')) { the_ratings(); } ?> <p class="postmetadata"><?php the_time('F jS, Y') ?> by <?php the_author() ?> | Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
<?php the_content('Weiter lesen »'); ?>
</div></div>
<?php endwhile; ?>
<div class="navigation"> <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> </div>
<?php else : ?> <div class="entry"> <h2>Not Found</h2> <p>Sorry, but you are looking for something that isn't here.</p> </div> <?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?> Dann habe ich sie so geändert, doch dann kommt ein Fehler und es erscheint nur die Fehlermeldung: PHP-Code: <?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?> <?php if (! in_category('11')) { ?> <div class="entry"> <div id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><?php if(function_exists('the_ratings')) { the_ratings(); } ?> <p class="postmetadata"><?php the_time('F jS, Y') ?> by <?php the_author() ?> | Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
<?php the_content('Weiter lesen »'); ?>
</div></div>
<?php endwhile; ?>
<div class="navigation"> <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> </div>
<?php else : ?> <div class="entry"> <h2>Not Found</h2> <p>Sorry, but you are looking for something that isn't here.</p> </div> <?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?> Wäre für Hilfe dankbar!
PS: Ich will mehrere Kategorien verstecken... |
| |
09.12.2007, 12:42
|
#5 (permalink)
| | WPD-Team
Registriert seit: 20.08.2005 Ort: Berlin
Beiträge: 15.543
| Wenn mir dir helfen soll wäre natürlich die Fehlermeldung interessant 
Aber vermutlich fehlt vor dem endwhile. |
| |
09.12.2007, 12:49
|
#6 (permalink)
| | PostRank: 1
Registriert seit: 28.11.2007
Beiträge: 34
| Danke, klappt!
Fehlermeldung, wenn ich mehrere Kategorien verstecken will: Parse error: syntax error, unexpected T_ENDWHILE in public_html/wordpress/wp-content/themes/red-top/index.php on line 28 |
| |
09.12.2007, 16:21
|
#7 (permalink)
| | PostRank: 1
Registriert seit: 28.11.2007
Beiträge: 34
| Hat niemand nen Rat, wie ich mehrere Kategorien auf der startseite verstecken kann? |
| |
10.12.2007, 02:04
|
#8 (permalink)
| | PostRank: 4
Registriert seit: 27.06.2007 Ort: Berlin
Beiträge: 251
| Code: <?php get_header(); ?>
<div id="content">
<?php query_posts($query_string . 'paged&posts_per_page=5&cat=-46,-47,-49,-50,-140'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="entry">
<div id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><?php if(function_exists('the_ratings')) { the_ratings(); } ?>
<p class="postmetadata"><?php the_time('F jS, Y') ?> by <?php the_author() ?> | Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
<?php the_content('Weiter lesen »'); ?>
</div></div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
</div>
<?php else : ?>
<div class="entry">
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn't here.</p>
</div>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
posts_per_page: Wieviele Beiträge anzeigen lassen?
cat: Welche Kats ausblenden? Minus beachten!!! |
| |
25.01.2008, 21:32
|
#9 (permalink)
| | PostRank: 0
Registriert seit: 06.01.2008
Beiträge: 17
| is vielleicht ne blöde frage,
aber wenn ich eine oder mehrere kategorien in der index.php ausblende, dann werden diese doch in den anderen kategorien auch nicht mehr angezeigt. |
| |
25.01.2008, 21:35
|
#10 (permalink)
| | PostRank: 6
Registriert seit: 02.11.2006 Ort: Hamburg
Beiträge: 517
| Zum verstecken von einzelnen Kategorien gibt es ein praktisches Plug-In: Advanced Category Excluder
damit kann man festlegen wo Kategorien versteckt werden sollen.
(Archive | Home | RSS-Posts | RSS-Comments | Suchergebnisse)
Geändert von funkygog (25.01.2008 um 21:38 Uhr).
|
| | | Themen-Optionen | | | | Ansicht | Linear-Darstellung |
Forumregeln
| Es ist dir nicht erlaubt, neue Themen zu verfassen. Es ist dir nicht erlaubt, auf Beiträge zu antworten. Es ist dir nicht erlaubt, Anhänge hochzuladen. Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten. HTML-Code ist aus. | | | Alle Zeitangaben in WEZ +1. Es ist jetzt 19:08 Uhr. | |