Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter wpdsbarnes

    (@wpdsbarnes)

    Thank you so much! I had myself in a … loop (had to).

    Basically one just needs to say, if this category has children, links pls,
    otherwise, normal archive page.

    In the child theme I copied the contents of “archive.php” to “category.php” (So, archive.php will be a show all page) which looks like this for the next person that wonders:

    <?php
    /**
     * The template for displaying archive pages
     *
     * @link https://developer.ww.wp.xz.cn/themes/basics/template-hierarchy/
     *
     * @package WordPress
     * @subpackage Twenty_Twenty_One
     * @since Twenty Twenty-One 1.0
     */
    
    get_header();
    $description = get_the_archive_description();
    ?>
    
    <?php if ( have_posts() ) : ?>
    	<header class="page-header alignwide">
    		<?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?>
    		<?php if ( $description ) : ?> <div class="archive-description"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> <?php endif; ?>
    	</header><!-- .page-header -->
    
    	<?php $category_id = get_query_var( 'cat' ); ?>
    	<?php $parent_categories = get_categories( array('child_of' => $category_id) ); ?>
    	
    	<div class="entry-content">
    		<?php foreach($parent_categories as $category) { 
    		//  echo title of the subcategory as a link
    			echo '<p> <a href="' . get_category_link( $category->term_id ) .  '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' .  $category->name.'</a> </p>';
    		} ?>
    	</div>
    
    	<?php if( ! $parent_categories ){
    		while ( have_posts() ) : 
    			the_post();
    			get_template_part( 'template-parts/content/content', get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) );
    		endwhile;
    	} ?>
    
    <?php else : ?>
    	<?php get_template_part( 'template-parts/content/content-none' ); ?>
    <?php endif; ?>
    
    <?php get_footer(); ?>

    Resolved

    Thread Starter wpdsbarnes

    (@wpdsbarnes)

    I’m sorry to say, but the documentation linked does not mention anything about what is or isn’t a valid name for the directory.

    It simply says: “Create a new directory and name it after the plugin (e.g. plugin-name).”

    Further documentation from this link, say the “best practices” section, is predominantly about keeping the code clean. Using prefixes for functions and classes is mentioned, but, as far as I can tell, nothing about naming the folder itself.

    Best regards.

    • This reply was modified 4 years, 8 months ago by wpdsbarnes.
    Thread Starter wpdsbarnes

    (@wpdsbarnes)

    I believe I’ve isolated the issue down to the child theme folder being named with a number “1988”.

    When I change the name to “nineteeneightyeight” the featured image appears again as an option.

    Sorry If I’ve missed it, but is there documentation about what is and is not a valid theme name?

    Since the featured image option has reappeared, and that was the original issue, I’ll mark this as resolved.

    Thread Starter wpdsbarnes

    (@wpdsbarnes)

    I’m using the Gutenberg editor.

    I’d attempted adding theme support w/o the second arg.
    Attempted as you showed, unfortunately, the featured image option is still missing.

    Thread Starter wpdsbarnes

    (@wpdsbarnes)

    @diondesigns & @aetherunbound

    you’re both awesome!
    I’d stopped putting the paths into file_get_contents() at some point (and apparently was checking if a string was a file).

    Thank you both so much for the response!

    Resolved.

Viewing 5 replies - 1 through 5 (of 5 total)