I’m just guessing… is this the right place to insert code?
in content-page.php:
Somewhere here:
<div class="entry-content">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'lodestar' ),
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>'
) );
?>
</div>
-
This reply was modified 5 years, 2 months ago by
meideserve.
Hello there,
You should be able to show more than one item in the category pages.
Have you check the content settings via Settings > General/Reading.
Many thanks.
Hi Adam, yes I know about that function. However, my question is not about showing more than one item. My question is – which is the .php file to be edited, for your Lodestar theme, to be able to customise the design of the page showing all the posts of the category? I do not wish to have the category page just show many posts one by one top to bottom as per mentioned above.
Thanks…
Hello there,
That would be the archive.php file that would need to be edited there.
You may wish to consider building a child theme where you’re making these sorts of changes.
I hope this is useful.
Hi Adam, sorry for the late reply! Yes, will consider child themes!
Sorry for a relatively newbie question, but I saw the code:
“<?php
the_archive_title( ‘<h1 class=”page-title”>’, ‘</h1>’ );
the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ );
?>”
Referring to a sample Category Page here eg. https://staging17.meide.sg/category/cleaning/festival-cleaning/
How can i change the text “Category: ” into “All Articles About: ” ?
Basically I want to customize/change the_archive_title specified in archive.php
While those changes are outside the scope of support we can offer here, others have posted ways to get around handling of get_the_archive filter. I’d recommend searching the web for “get_the_archive_filter” and “remove category” to see what others have done for this.
Thank you for your advice! I am working on that and will update once I find out how to get it done…
Meanwhile, may I ask too – how do I change, edit, or remove the “featured image” shown on each category page?
Referring to a sample Category Page here eg. https://staging17.meide.sg/category/cleaning/festival-cleaning/
– it keeps showing only the main home page featured image.
I managed to pinpoint to this file: header-image.php under:
public_html
wp-content
themes
lodestar
components
header
header-image.php
and the code is:
<div class="custom-header">
<?php
$header_image = get_header_image();
$jetpack_portfolio_featured_image = get_option( 'jetpack_portfolio_featured_image' );
// If this is a single post or page with a featured image (but not a portfolio)
if ( has_post_thumbnail() && ( is_singular() && 'jetpack-portfolio' !== get_post_type() && lodestar_jetpack_featured_image_display() ) ) :
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
$thumbnail_attributes = wp_get_attachment_image_src( $post_thumbnail_id, 'lodestar-featured-image' );
?>
<div class="custom-header-image" style="background-image: url(<?php echo esc_url( $thumbnail_attributes[0] ); ?>)">
<?php get_template_part( 'components/header/site', 'branding' ); ?>
</div>
<?php
// Else if this is a portfolio archive, and the Portfolio featured image is set
// TODO: Decide if this image should also be shown for Portfolio types and tags archives
elseif (
( is_post_type_archive( 'jetpack-portfolio' ) || is_tax( 'jetpack-portfolio-type' ) || is_tax( 'jetpack-portfolio-tag') || 'jetpack-portfolio' === get_post_type() ) && isset( $jetpack_portfolio_featured_image ) && '' != $jetpack_portfolio_featured_image ) :
$featured_image_attributes = wp_get_attachment_image_src( $jetpack_portfolio_featured_image, 'lodestar-featured-image' ); ?>
<div class="custom-header-image" style="background-image: url(<?php echo esc_url( $featured_image_attributes[0] ); ?>)">
<?php get_template_part( 'components/header/site', 'branding' ); ?>
</div>
<?php
// Else if the Custom Header image has been set
elseif ( ! empty( $header_image ) ) : ?>
<div class="custom-header-image" style="background-image: url(<?php echo esc_url( $header_image ); ?>)">
<?php get_template_part( 'components/header/site', 'branding' ); ?>
</div>
<?php
// Otherwise, show an empty header background.
else : ?>
<div class="custom-header-image">
<?php get_template_part( 'components/header/site', 'branding' ); ?>
</div>
<?php endif; ?>
</div><!-- .custom-header -->
is there a code i can add in to enable featured image in my Tags and Categories?
also in any case, supernovia, thank you very much! i added the code to my functions.php:
add_filter( ‘get_the_archive_title’, function ($title) {
if ( is_category() ) {
$title = single_cat_title( ‘Articles: ‘, false );
} elseif ( is_tag() ) {
$title = single_tag_title( ”, false );
} elseif ( is_author() ) {
$title = ‘<span class=”vcard”>’ . get_the_author() . ‘</span>’ ;
} elseif ( is_tax() ) { //for custom post types
$title = sprintf( __( ‘%1$s’ ), single_term_title( ”, false ) );
} elseif (is_post_type_archive()) {
$title = post_type_archive_title( ”, false );
}
return $title;
});
and it helped solved the earlier problem. Really seek your awesome advice for the featured image issue abovementioned. 🙂
Ah I’m glad to hear you figured it out, @meideserve!
If you didn’t do this already, I’d recommend moving your changes to a child theme or a functions.php plugin, just so you can update your theme smoothly:
https://developer.ww.wp.xz.cn/themes/advanced-topics/child-themes/
And there are a handful of plugins that will let you add featured images to category pages. You could either use one of those, or see how they go about it, then add that to your child theme.
Let us know if that helps!