Jak přidat popisek a titulek rubriky

Úvodní stránka Fórum podpory WordPressu Problémy s WordPressem Jak přidat popisek a titulek rubriky

Zvolené téma obsahuje celkem 1 odpověď. Do diskuze (2 účastníci) se naposledy zapojil uživatel  sjiamnocna a poslední změna je stará 9 let, 5 měsíců.

Aktuálně jsou na stránce zobrazeny 2 příspěvky - 1. až 2. (z celkem 2)
  • Autor
    Příspěvky
  • #21132

    gony
    Participant
    Web

    Dobrý den,
    Chtěl bych se zeptat jak je možné přidat do rubriky popis. Při vytváření rubriky je možné popisek doplnit, ale na stránkách se nezobrazuje. Níže zasílám jak vypadá muj archive, děkuji za rady.

    <?php global $theme; get_header(); ?>
    
        <div id="main">
        
            <?php $theme->hook('main_before'); ?>
        
            <div id="content">
                
                <?php $theme->hook('content_before'); ?>
            
                <h2 class="page-title"><?php
        
                   /* If this is a daily archive */ 
                   if (is_day()) { printf( __( 'Daily Archives: <span>%s</span>', 'themater' ), get_the_date() ); 
                    
                    /* If this is a monthly archive */ 
                    } elseif (is_month()) { printf( __( 'Monthly Archives: <span>%s</span>', 'themater' ), get_the_date('F Y') );
                      
                    /* If this is a yearly archive */ 
                    } elseif (is_year()) { printf( __( 'Yearly Archives: <span>%s</span>', 'themater' ), get_the_date('Y') );
                    
                    /* If this is a general archive */ 
                    } else { _e( 'Blog Archives', 'themater' ); } 
                ?></h2>
            
                <?php 
                    if (have_posts()) : while (have_posts()) : the_post();
                         
                         /**
                         * The default post formatting from the post.php template file will be used.
                         * If you want to customize the post formatting for your archive pages:
                         * 
                         *   - Create a new file: post-archive.php
                         *   - Copy/Paste the content of post.php to post-archive.php
                         *   - Edit and customize the post-archive.php file for your needs.
                         * 
                         * Learn more about the get_template_part() function: http://codex.wordpress.org/Function_Reference/get_template_part
                         */
                         
                        get_template_part('post', 'archive');
                    endwhile;
                    
                    else :
                        get_template_part('post', 'noresults');
                    endif; 
                    
                    get_template_part('navigation');
                ?>
                
                <?php $theme->hook('content_after'); ?>
            
            </div><!-- #content -->
        
            <?php get_sidebars(); ?>
            
            <?php $theme->hook('main_after'); ?>
            
        </div><!-- #main -->
        
    <?php get_footer(); ?>
    #21152

    sjiamnocna
    Participant
    Web

    Na svých stránkách věnovaných začátečníkům wordpressu, jsem se snažil udělat podle kategorií obsah webu. Tam jsem udělal několik cyklů pro načtení všech podkategorií a výpis názvu a popisu každé z nich nějak takto:

    $childcategs=array(7,16,6,5);
    foreach($childcategs as $cat){
    echo'<div class="category cat-'.$cat.'">';
    echo '<h4 class="cattitle">'.get_cat_name($cat).'</h4>';
    echo '<h5 class="catdesc">'.category_description($cat).'</h5>';
    //další kód...

    V normálním případě byste to udělal nějak takhle:

    echo '<h4>'.single_cat_title('',false).'</h4>';
    echo '<h5>'.category_description(get_term_by('name',single_cat_title('',false),'category')).'</h5>';
Aktuálně jsou na stránce zobrazeny 2 příspěvky - 1. až 2. (z celkem 2)

Pokud chcete odpovědět na toto téma, musíte se nejdříve přihlásit.

WordPress – novinky, návody a zajímavosti